@kessler/async-map-limit

3.0.0 • Public • Published

@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))
    })
}

Readme

Keywords

Package Sidebar

Install

npm i @kessler/async-map-limit

Weekly Downloads

64

Version

3.0.0

License

Apache-2.0

Unpacked Size

11.1 kB

Total Files

9

Last publish

Collaborators

  • kessler