Wraps array for grid access. Immutable, such that underlying array is not modified and a call to set returns a new GridArray1d.
array
set
GridArray1d
const myArray = [ `a`, `b`, `c`, `d`, `e`, `f` ];let g = wrap(myArray, 3); // 3 columns wideg.get({ x:1, y:2 }); // Get value at cell position// Note that `set` returns a new instanceg = g.set(10, { x:1, y:2 }); // Set value at cell positiong.array; // Get reference to current array Copy
const myArray = [ `a`, `b`, `c`, `d`, `e`, `f` ];let g = wrap(myArray, 3); // 3 columns wideg.get({ x:1, y:2 }); // Get value at cell position// Note that `set` returns a new instanceg = g.set(10, { x:1, y:2 }); // Set value at cell positiong.array; // Get reference to current array
Use wrapMutable to modify an array in-place
Array to wrap
Width of grid
Wraps
array
for grid access. Immutable, such that underlying array is not modified and a call toset
returns a newGridArray1d
.Use wrapMutable to modify an array in-place