async-map

0.2.0 • Public • Published

async-map

Transform multiple values asynchronously

install

npm install async-map

usage

const asyncMap = require('async-map')
const loadImage = require('img-load')
 
let paths = ['images/foo.png', 'images/bar.png']
asyncMap(paths, loadImage, (err, images) => {
  if (err) throw err
  for (let image of images) {
    document.body.appendChild(image)
  }
})

asyncMap(values, iterator, callback) -> result

Performs iterator on each value in values in parallel, and passes the result into callback when complete.

  • values: An array of values to be transformed
  • iterator(value, callback): Any function that receives a value and a callback, e.g. fs.stat(path, callback)
  • callback(err, result): The function called upon completion or abortion of the mapping process

license

MIT © Brandon Semilla

Readme

Keywords

Package Sidebar

Install

npm i async-map

Weekly Downloads

1

Version

0.2.0

License

MIT

Last publish

Collaborators

  • semibran