2.10.19 • Published 2 years ago

@extra-array/set-path-update.min v2.10.19

Weekly downloads
10
License
MIT
Repository
github
Last release
2 years ago

Sets value at path in a nested array. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Alternatives: set, set$, setPath$. Similar: hasPath, getPath, setPath$, removePath$. Similar: get, set, remove.

This is part of package extra-array.

This is browserified, minified version of @extra-array/set-path-update. It is exported as global variable array_setPath$. CDN: unpkg, jsDelivr.

array.setPath$(x, p, v);
// x: a nested array (updated)
// p: path
// v: value
// → x
const array = require("extra-array");

var x = [[2, 4], 6, 8];
array.setPath$(x, [1], 60);
// [ [ 2, 4 ], 60, 8 ]

x;
// [ [ 2, 4 ], 60, 8 ]

array.setPath$(x, [0, 1], 40);
// [ [ 2, 40 ], 60, 8 ]

array.setPath$(x, [0, 1, 2], 100);
// [ [ 2, 40 ], 60, 8 ] (path not present, no effect)

References

2.10.19

2 years ago

2.10.18

3 years ago

2.10.17

3 years ago

2.10.16

3 years ago

2.10.15

3 years ago

2.10.10

3 years ago

2.10.11

3 years ago

2.10.12

3 years ago

2.10.13

3 years ago

2.10.14

3 years ago

2.10.9

3 years ago

2.10.8

4 years ago

2.10.7

4 years ago

2.10.6

4 years ago

2.10.5

4 years ago