n-times
v1.0.0
Published
Run a function N times
Downloads
13
Maintainers
Readme
n-times
Run a function 𝘕 times
Install
$ npm install n-times --save
Usage
const times = require('n-times');
const beep = bop => console.log(bop);
times(3, beep, 'yadda');
// => yadda
// => yadda
// => yadda
API
times(n, fn, ...args)
n
Required
Type: integer
Number of times to run a function.
fn
Required
Type: function
Function to run N times.
Receives the value of current iteration as the last argument.
...args
Type: arguments
List of arguments to pass to fn
on every call.
License
MIT © Rafael Rinaldi