Skip to content
wolfram77 edited this page Mar 31, 2020 · 27 revisions

Repeats an iterable given times.

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]

references

Clone this wiki locally