Fixed removing multiple items from an array
This commit is contained in:
parent
0a7df1dad9
commit
745b77725b
|
@ -283,10 +283,12 @@ export function remove (path) {
|
||||||
* @return {ESONPatch}
|
* @return {ESONPatch}
|
||||||
*/
|
*/
|
||||||
export function removeAll (paths) {
|
export function removeAll (paths) {
|
||||||
return paths.map(path => ({
|
return paths
|
||||||
op: 'remove',
|
.map(path => ({
|
||||||
path: compileJSONPointer(path)
|
op: 'remove',
|
||||||
}))
|
path: compileJSONPointer(path)
|
||||||
|
}))
|
||||||
|
.reverse() // reverse is needed for arrays: delete the last index first
|
||||||
}
|
}
|
||||||
// TODO: test removeAll
|
// TODO: test removeAll
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue