Skip to content

Calculates a diff of two objects, and returns the different object paths

Notifications You must be signed in to change notification settings

InterAl/object-diff-paths

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

object-diff-paths

Calculates a diff of 2 objects, and returns a list of the different object paths.

The object paths can then be used in lodash.get/lodash.set.

Installation

$ npm i object-diff-paths

Usage

const o1 = {
    a: {
        b: {
            c: { s: 't' },
        }
    }
};
const o2 = {...o1, a: {...o1.a, b: {...o1.a.b, d: 'e'}}};

const diff = objectDiff(o1, o2);

assert.deepEqual(diff, [
    'a.b.d'
]);

About

Calculates a diff of two objects, and returns the different object paths

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published