benjamine / jsondiffpatch

Diff & patch JavaScript objects
MIT License
4.83k stars 472 forks source link

Question about jsonpatch formatter #320

Open danielglh opened 2 years ago

danielglh commented 2 years ago

We observed some weird behavior when using jsonpatch formatter. The diff was right but the output of jsonpatch formatter looks off.

When I looked into the jsonpatch formatter implementation, a method reorderOps caught my attention. I'm wondering why is it necessary to reorder the ops before they are returned, and why in this particular logic (remove first in desc order, then move and rest)?

aryelu commented 2 years ago

Hi, can you please write what is the expected order and what did you get?