@f/times
v1.0.0
Published
Run a function n times and aggregate the results into an array
Downloads
10
Readme
times
Run a function n times and aggregate the results into an array
Installation
$ npm install @f/times
Usage
var times = require('@f/times')
times(3, identity) === [0, 1, 2]
API
times(n, fn)
n
- The number of times to runfn(i)
fn
- Receives a single argument, the current index. Also called with the samethis
context astimes
.
Returns: An array of the return values of fn
.
License
MIT