1.0.1 • Published 7 months ago

diffable-object v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

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

7 months ago

1.0.0

8 months ago