-
Notifications
You must be signed in to change notification settings - Fork 1
repeat
Subhajit Sahu edited this page May 9, 2020
·
27 revisions
Repeats an iterable given times. [:running:] [:vhs:] [:package:] [:moon:]
iterable.repeat(x, n);
// x: an iterable
// n: times (-1 => Inf)
const iterable = require('extra-iterable');
var x = [1, 2];
[...iterable.repeat(x, 2)];
// [1, 2, 1, 2]
[...iterable.repeat(x, 3)];
// [1, 2, 1, 2, 1, 2]
- String.prototype.repeat(): MDN web docs
- Collections.nCopies(): Java [:running:]: https://npm.runkit.com/@extra-iterable/repeat [:vhs:]: https://asciinema.org/a/Hw7i7bTp4JRv34Lwf4JYxdiIT [:package:]: https://www.npmjs.com/package/@extra-iterable/repeat [:moon:]: https://www.npmjs.com/package/@extra-iterable/repeat.min