Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 24x 24x 24x 48x 24x | function countDiffAndComplex(prevProps, props) {
const keys = Object.keys(prevProps).concat(Object.keys(props))
// reflect types in the documentation if changed
const quicks = [ 'string', 'number', 'undefined', 'boolean', 'symbol' ]
const [diff, comp] = keys.reduce( (stat,k) => {
return [
stat[0] + (prevProps[k] !== props[k] ? 1 : 0),
stat[1] + (!quicks.includes(typeof(props[k])) ? 1 : 0)
]
}, [0, 0])
return [diff, comp]
}
export default countDiffAndComplex |