Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

Latest commit

 

History

History
58 lines (48 loc) · 1.98 KB

diffUpdate.md

File metadata and controls

58 lines (48 loc) · 1.98 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
object1 Object
object2 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' }