Skip to content

Latest commit

 

History

History
58 lines (48 loc) · 2.04 KB

diffUpdate.md

File metadata and controls

58 lines (48 loc) · 2.04 KB

Object Agent

A javascript library for working with objects

npm build coverage deps size vulnerabilities license


diffUpdate(object1, object2) ⇒ object

Performs a deep comparison of two objects, returns a new object with only the first level values that have been changed or added on the second object.

Param Type Description
object1 object The initial object.
object2 object The changed object.

Example

import { diffUpdate } from 'object-agent';

const item1 = {
    a: ['b'],
    c: 'd',
    e: null
}
const item2 = {
    a: ['b'],
    c: null,
    e: null,
    f: 'g'
}

diffUpdate(item1, item2);
// => { c: null, f: 'g' }