JSON that optimized to have a same reference when a same contents.
$ npm install --save eqson
const eqson = require("eqson");
const a = { foo: [ 100 ], bar: [ 100 ], baz: [ 10, [ 100 ] ] };
const b = eqson(a);
b
has the same contents as a
.
assert.deepEqual(a, b);
b.foo
and b.bar
, b.baz[1]
have a same reference.
assert(b.foo === b.bar);
assert(b.foo === b.baz[1]);
MIT