map-limit
async.mapLimit's functionality available as a standalone npm module
Last updated 10 years ago by hughsk .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install map-limit 
SYNC missed versions from official npm registry.

map-limit Flattr this!experimental

async.mapLimit's functionality available as a standalone npm module.

I often find myself pulling in async for this method alone, so in the spirit of breaking things into smaller pieces here's that method as a single thing you can require.

Usage

map-limit

mapLimit(arr, limit, iterator, callback)

The same as map only no more than "limit" iterators will be simultaneously running at any time.

Note that the items are not processed in batches, so there is no guarantee that the first "limit" iterator functions will complete before any others are started.

Arguments

  • arr - An array to iterate over.
  • limit - The maximum number of iterators to run at any time.
  • iterator(item, callback) - A function to apply to each item in the array. The iterator is passed a callback(err, transformed) which must be called once it has completed with an error (which can be null) and a transformed item.
  • callback(err, results) - A callback which is called after all the iterator functions have finished, or an error has occurred. Results is an array of the transformed items from the original array.

License

MIT. See LICENSE.md for details.

Current Tags

  • 0.0.1                                ...           latest (10 years ago)

2 Versions

  • 0.0.1                                ...           10 years ago
  • 0.0.0                                ...           11 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (1)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |