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