shared
utils
string
object
is
extension
js
tracking
string
dom
when
selection
position
iframe
event
scroll
console
node
string
project
fs
console
diff
Type:Function
Status:stable
Since:1.0.0
Platform:jsnode
@blackbyte.sugar.shared.object
This function take two objects and return an object that contains only what has been changed between the two. This function is a simple wrapper around the nice object-diff package from Thomas Jensen that you can find here: https://www.npmjs.com/package/object-diff
Params
- object1*-Object
The first object used for the diff process
- object2*-Object
The second object used for the diff process
- settings{}Object
An object of settings to configure the diff process:
Return
- -Object
The object that contains only the differences between the two
Example
import { diff } from '@blackbyte/sugar/object';
const myObject1 = {
hello: 'world',
plop: 'yop'
};
const myObject2 = {
coco: 'plop',
hello: 'hey!',
plop: 'yop'
};
diff(myObject1, myObject2);
{
coco: 'plop',
hello: 'hey!'
}Todo
- testsnormal
Author
- Olivier Bosselolivier.bossel@gmail.comhttps://blackbyte.space