Skip to content

kunukmak/async-map

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

async-map

transform multiple values asynchronously in parallel

install

npm badge

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)

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

About

Transform each value in an array asynchronously

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%