0.1.6 • Published 6 years ago
iterable-repeat v0.1.6
iterable-repeat
NOTE: iterable-repeat was renamed to @extra-iterable/repeat.
Repeat iterable n times, like String.repeat().
const repeat = require('iterable-repeat');
// repeat(<iterable>, [times=1], [begin=0], [end], [target=[]], [at])
repeat(new Set(['a', 'b']), 3);
// ['a', 'b', 'a', 'b', 'a', 'b']
repeat(['a', 'b', 'c', 'd'], 2, 1);
// ['b', 'c', 'd', 'b', 'c', 'd']
repeat('abcd', 2, 1, 3);
// ['b', 'c', 'b', 'c']
repeat('abcd', 2, 1, 3, ['z', 'y']);
// ['z', 'y', 'b', 'c', 'b', 'c']
repeat('abcd', 2, 1, 3, ['z', 'y'], 1);
// ['z', 'b', 'c', 'b', 'c']