Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

async-map

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-map

Transform each value in an array asynchronously

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

async-map

Transform each value in an array asynchronously

install

npm install async-map

usage

const map = require('async-map')
const load = require('img-load')

var paths = ['images/foo.png', 'images/bar.png']
var images = map(paths, load, (error, image, index) => {
  if (error) throw error

  // Immediately add image to DOM...
  document.body.appendChild(image)

  // or, only display when all images have been loaded
  if (images.length === paths.length) {
    for (var image of images) {
      document.body.appendChild(image)
    }
  }
})

result = map(values, iterator, callback)

Performs iterator on each value in values in sequence. result is populated as each value in the initial array is transformed.

  • values: An array of values to be transformed
  • iterator: A function of the form iterator(value, callback), e.g. fs.stat(path, callback)
  • callback: A function of the form callback(error, value, index) which receives each transformed value as iterator completes

license

MIT © Brandon Semilla

Keywords

FAQs

Package last updated on 08 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc