repeat - nodef/extra-array GitHub Wiki

Repeat an array given times.

Similar: repeat, cycle, rotate, reverse.

function repeat(x, n)
// x: an array
// n: times [1]
const xarray = require('extra-array');

var x = [1, 2];
xarray.repeat(x, 2);
// → [ 1, 2, 1, 2 ]

xarray.repeat(x, 3);
// → [ 1, 2, 1, 2, 1, 2 ]

References