carlosingles / json-patch-query

Implementation of JSON Patch Query as proposed by the TM Forum
2 stars 0 forks source link

fix: removing multiple elements from same array #4

Closed carlosingles closed 2 years ago

carlosingles commented 2 years ago

currently when removing elements from an array, it is possible for the incorrect elements to be removed due to the paths for the elements becoming invalid.

this is due to the elements being removed upfront, so the indexes of the array are no longer applicable since it has been modified.

this PR fixes the issue, by replacing the removed element with a unique Symbol and removing the elements after the entire collection of paths has been executed against.

resolves #3