https://github.com/bendrucker/map-times
Iterate through a count collecting results for each index
https://github.com/bendrucker/map-times
Last synced: 12 months ago
JSON representation
Iterate through a count collecting results for each index
- Host: GitHub
- URL: https://github.com/bendrucker/map-times
- Owner: bendrucker
- License: mit
- Created: 2015-07-28T18:42:27.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2019-08-19T21:46:14.000Z (almost 7 years ago)
- Last Synced: 2025-08-03T07:05:13.460Z (12 months ago)
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# map-times [](https://travis-ci.org/bendrucker/map-times) [](https://greenkeeper.io/)
> Iterate through a count collecting results for each index
## Install
```
$ npm install --save map-times
```
## Usage
```js
var times = require('map-times')
times(3, function (index) {
return index * 2
})
//=> [0, 2, 4]
```
## API
#### `times(count, callback)` -> `array`
##### count
*Required*
Type: `number`
The number of times to call the callback.
##### callback
*Required*
Type: `function`
Arguments: `index`
A function that will be called the specified number of times with the index of the call.
## License
MIT © [Ben Drucker](http://bendrucker.me)