Closed labzy88 closed 2 years ago
Hi,
Forgive me if this is expected behaviour! I am very new to this rfc6902 and yet to learn more, however I thought it was worth mentioning...
It appears that converting an entire JSON document from an Array to an Object does not work. For example:
test('issue/79', t => { const old = [ { id: 1, name: 'test1' }, { id: 2, name: 'test2' } ] const newObj = { prop1: 'string', prop2: ['array'], prop3: 1 } const expectedPatches: [ReplaceOperation] = [ { op: 'replace', path: '', value: newObj } ]; const patches = createPatch(old, newObj); t.deepEqual(patches, expectedPatches); const nullArray = applyPatch(old, patches); t.true(patches.length === nullArray.length); t.deepEqual(old, newObj as any); })
The patch does not appear to be applied in this case.
Also, thanks for such a great library!
Best,
I realise now it's obvious changing type won't work! Sorry for the false issue, will close now! Thanks
Hi,
Forgive me if this is expected behaviour! I am very new to this rfc6902 and yet to learn more, however I thought it was worth mentioning...
It appears that converting an entire JSON document from an Array to an Object does not work. For example:
The patch does not appear to be applied in this case.
Also, thanks for such a great library!
Best,