compare-obj
Version:
Recursively compare 2 objects on a property bases to get the difference
18 lines (14 loc) • 342 B
JavaScript
const compare = require('./')
const data = {
id: 'foobarbaz',
name: 'Bazzy',
contactNumber: '0000000',
contactIds: ['one', 'two', 'three']
}
const initialValues = {
id: 'foobarbaz',
name: 'Bazzy',
contactIds: ['one', 'two']
}
console.log(compare(data, initialValues))
// { contactNumber: '0000000', contactIds: [ 'three' ] }