You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@kessler/async-map-limit

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kessler/async-map-limit

like Promise.all() but with limit on concurrency

3.0.1
latest
Source
npmnpm
Version published
Weekly downloads
187
-3.61%
Maintainers
0
Weekly downloads
 
Created
Source

@kessler/async-map-limit

A Promise.all() based implementation for doing async map with limit on concurrency.

impl.js contains my experiments with various methods to do it.

bench compares them using two different benchmark modules

const map = require('@kessler/async-map-limit')

main()

async function main() {
    // process the array, 2 items at a time 
    const result = await map([1, 2, 3, 4, 5, 6], asyncMapper, 2)
}

function asyncMapper(value) {
    return new Promise((resolve) => {
        setImmediate(() => resolve(value))
    })
}

Keywords

async

FAQs

Package last updated on 02 Sep 2024

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