2.10.19 • Published 2 years ago
@extra-array/remove-path-update v2.10.19
Removes value at path in a nested array. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:
Alternatives: remove, remove$, removePath$. Similar: hasPath, getPath, setPath$, removePath$. Similar: get, set, remove.
This is part of package extra-array.
array.removePath$(x, p);
// x: a nested array (updated)
// p: path
// → x
const array = require("extra-array");
var x = [[2, 4], 6, 8];
array.removePath$(x, [1], 60);
// [ [ 2, 4 ], 8 ]
x;
// [ [ 2, 4 ], 8 ]
array.removePath$(x, [0, 1], 40);
// [ [ 2 ], 8 ]
array.removePath$(x, [0, 1, 2], 100);
// [ [ 2 ], 8 ] (path not present, no effect)