diffable-object
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Experimental

Diffable object

Small library that is tracking the changes done to an object and all his children (can be objects or arrays).

Importing library

import createDiffableObject from 'diffable-object'

Usage

import createDiffableObject from 'diffable-object'

const source = {
    foo: {
        bar: {
            key: 'value',
            key2: 'value2'
        }
    },
    other: {
        key1: 'value'
    }
};
const obj = createDiffableObject(source);

obj.foo.bar.key = 'change';

console.log(obj.getChanges());

Print:

 {
    foo: {
        bar: {
            key: 'change'
        }
    }
}

Readme

Keywords

Package Sidebar

Install

npm i diffable-object

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

26.9 kB

Total Files

19

Last publish

Collaborators

  • ydeshayes