Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@f/times

micro-js31MIT1.0.0

Run a function n times and aggregate the results into an array

readme

times

Build status Git tag NPM version Code style

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 run fn(i)
  • fn - Receives a single argument, the current index. Also called with the same this context as times.

Returns: An array of the return values of fn.

License

MIT