@bakkerjoeri/repeat

Repeat a callback a given number of times.

Usage no npm install needed!

<script type="module">
  import bakkerjoeriRepeat from 'https://cdn.skypack.dev/@bakkerjoeri/repeat';
</script>

README

repeat

Repeat a callback a given number of times.

Installation

npm install @bakkerjoeri/repeat

Usage

import repeat from '@bakkerjoeri/repeat';

const count = (i) => console.log(i);
repeat(3, count);
// => 0
// => 1
// => 2

The callback is called with a 0-based iteration count as its first argument.