-
Notifications
You must be signed in to change notification settings - Fork 1
repeat
Subhajit Sahu edited this page Feb 3, 2021
·
27 revisions
Repeat an iterable given times.
function repeat(x, n)
// x: an iterable
// n: times [-1 ⇒ Inf]
const xiterable = require('extra-iterable');
var x = [1, 2];
[...xiterable.repeat(x, 2)];
// → [1, 2, 1, 2]
[...xiterable.repeat(x, 3)];
// → [1, 2, 1, 2, 1, 2]