repeat-function

Construct an array by repeating a value (or function) a number of times.

npm install repeat-function
4 downloads in the last week
13 downloads in the last month

Repeat a value a number of times. You can also pass a function.

repeat(limit, value);
> repeat(10, 'hi');
['hi', 'hi', 'hi', 'hi', 'hi', 'hi', 'hi', 'hi', 'hi', 'hi']

> repeat(10, Math.random);
[ 0.3722359158564359, 0.2253044811077416, 0.007700880523771048, 0.17186463717371225, 0.4193427243735641, 0.7379662005696446, 0.23550302837975323, 0.9457539631985128, 0.8877920298837125, 0.997513564536348 ]
npm loves you