-
Notifications
You must be signed in to change notification settings - Fork 1
fill
Subhajit Sahu edited this page May 9, 2020
·
23 revisions
Fills with given value. [:running:] [:vhs:] [:package:] [:moon:]
iterable.fill(x, v, [i], [I]);
// x: an iterable
// v: value
// i: start index (0)
// I: end index (end)
const iterable = require('extra-iterable');
var x = [1, 2, 3, 4];
[...iterable.fill(x, 2)];
// [2, 2, 2, 2]
[...iterable.fill(x, 2, 1)];
// [1, 2, 2, 2]
[...iterable.fill(x, 2, 1, 3)];
// [1, 2, 2, 4]
- immutable-iterable-prototype: @azu
- Array.prototype.fill(): MDN web docs [:running:]: https://npm.runkit.com/@extra-iterable/fill [:vhs:]: https://asciinema.org/a/vPaegGdJEpO4Ty2lw7A50S6FN [:package:]: https://www.npmjs.com/package/@extra-iterable/fill [:moon:]: https://www.npmjs.com/package/@extra-iterable/fill.min