Fixed removing multiple items from an array

This commit is contained in:
jos 2017-11-22 13:38:18 +01:00
parent 0a7df1dad9
commit 745b77725b
1 changed files with 6 additions and 4 deletions

View File

@ -283,10 +283,12 @@ export function remove (path) {
* @return {ESONPatch}
*/
export function removeAll (paths) {
return paths.map(path => ({
return paths
.map(path => ({
op: 'remove',
path: compileJSONPointer(path)
}))
.reverse() // reverse is needed for arrays: delete the last index first
}
// TODO: test removeAll