Use custom object formatters for any part of a diff, not just leaf nodes

This commit is contained in:
Steve Gravrock
2020-02-01 18:49:06 -08:00
committed by Steve Gravrock
parent 25816a6e77
commit 873d1c2945
15 changed files with 669 additions and 141 deletions

View File

@@ -39,5 +39,13 @@ describe('ObjectPath', function() {
expect(path.toString()).toEqual('$.foo');
expect(root.toString()).toEqual('');
})
});
describe('#dereference', function() {
it('returns the value corresponding to the path', function () {
var path = new ObjectPath().add('foo').add(1).add('bar');
var obj = {foo: ['', {bar: 42}]};
expect(path.dereference(obj)).toEqual(42);
});
});
});