-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
Comparing arrays with simple objects results in a weird broken patch.
import { diff } from 'jiff'
const $old = [{ id: 1 }]
const $new = [{ id: 2 }]
const $patch = diff($old, $new)
console.log($patch)
Expected outcome:
[
{ op: "test", path: "/0/id", value: 1 },
{ op: "replace", path: "/0/id", value: 2 },
]
Actual outcome:
[
{ op: "add", path: "/0", value: { id: 2 } },
{ op: "test", path: "/1", value: { id: 1 } },
{ op: "remove", path: "/1" },
]
I tried with a custom hasher method from another issue, but this didn't help.
Update: I switched to https://github.com/Starcounter-Jack/JSON-Patch which does exactly what I expected above.
Moai-, steida and tanrichMoai- and steida
Metadata
Metadata
Assignees
Labels
No labels