2.2.5 • Published 3 years ago
@extra-object/remove-path-update v2.2.5
Removes value at path in a nested object. :running: :package: :ledger:
Alternatives: remove, remove$, removePath$. Similar: hasPath, getPath, setPath$, removePath$. Similar: get, set, remove. This is part of package extra-object.
object.removePath$(x, p);
// x: a nested object (updated)
// p: path
// --> x
const object = require('extra-object');
var x = {a: {b: 2, c: 3}, d: 4};
object.removePath$(x, ['d'], 40);
// { a: { b: 2, c: 3 } }
x;
// { a: { b: 2, c: 3 } }
object.removePath$(x, ['a', 'b'], 20);
// { a: { c: 3 } }
object.removePath$(x, ['a', 'b', 'c'], 30);
// { a: { c: 3 } }