Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@extra-array/fill-update

nodef28MIT2.10.19TypeScript support: included

Fills with given value.

extra, array, fill, update, fill$

readme

Fills with given value. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Alternatives: fill, fill$.

This is part of package extra-array.


array.fill$(x, v, [i], [I]);
// x: an array (updated)
// v: value
// i: start index (0)
// I: end index (X)
// → x
const array = require("extra-array");

var x = [1, 2, 3, 4];
array.fill$(x, 2);
// [ 2, 2, 2, 2 ]

x;
// [ 2, 2, 2, 2 ]

var x = [1, 2, 3, 4];
array.fill$(x, 2, 1);
// [ 1, 2, 2, 2 ]

var x = [1, 2, 3, 4];
array.fill$(x, 2, 1, 3);
// [ 1, 2, 2, 4 ]


References