Socket
Socket
Sign inDemoInstall

limited-map

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    limited-map

Async map function with limited concurrency


Version published
Weekly downloads
2
decreased by-75%
Maintainers
1
Install size
3.52 kB
Created
Weekly downloads
 

Readme

Source

limited-map

Async map function with limited concurrency for JavaScript. This is a replacement for Promise.all(items.map(asyncCallback)). For example, this is useful if you have an API that you don't want to overload with your request flood.

Example

const limitedMap = require("limited-map");

async function fetchDocs() {
  const docs = await limitedMap(urls, url => getJSON(url), 30);
  return docs;
}

API

limitedMap<T, U>(
  items: Array<T>, 
  callback: (item: T, index: number, array: Array<T>) => Promise<U>, 
  concurrency: number
): Promise<Array<U>>

License

MIT

FAQs

Last updated on 30 Apr 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc