Utils
About
This is a package with utilitary functions and other stuff that's commonly used in a bunch of services. This will be added on continously and splitted up in to several smaller packages if needed in the future.
Modules
Diff
Returns the difference between two objects.
Example:
const obj1 = { a: 'existing data', b: 'to be removed', c: ['to', 'be', 'updated'] }
const obj2 = { a: 'existing data', c: ['updated'], d: { data: 'added' } }
const difference = diff(obj1, obj2)
/*
Output:
{
added: { d: { data: 'added' } },
removed: { b: 'to be removed' },
unchanged: { a: 'existing data' },
updated: {
c: {
newValue: ['updated'],
oldValue: ['to', 'be', 'updated']
}
},
}
*/