Skip to content

ydeshayes/diffable-object

Repository files navigation

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'
        }
    }
}

About

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

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published