n-times

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i n-times

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • rafaelrinaldi