We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <script src="https://cdn.jsdelivr.net/npm/jsondiffpatch/dist/jsondiffpatch.umd.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/fast-json-patch.min.js"></script> </head> <body> <script> var differ = new jsondiffpatch.DiffPatcher({ objectHash(o, i) { return o.id || '$$index:' + i }, }) var d1 = { children: [ { id: 1, children: [ { id: 2, key: 1 } ] } ] } var d2 = { children: [ { id: 2, key: 1 }, { id: 1, children: [] } ] } var delta = differ.diff(d1, d2) var jsonPatches = jsondiffpatch.formatters.jsonpatch.format(delta) /* ↓ only one child [{"op": "remove", "path": "/children/1/children/0"}, {"op": "add", "path": "/children/0", "value": {"id": 2, "key": 1 } } ] */ jsonpatch.applyPatch(d1, jsonPatches) // fast-json-patch.min.js:8 Uncaught TypeError: Cannot read properties of undefined (reading 'children') </script> </body> </html>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: