repeat-function

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

Usage no npm install needed!

<script type="module">
  import repeatFunction from 'https://cdn.skypack.dev/repeat-function';
</script>

README

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 ]