npm.io
1.2.0 • Published 3 years ago

q-map-throttle

Licence
MIT
Version
1.2.0
Deps
6
Size
775 kB
Vulns
0
Weekly
0

q-map-throttle

A utility for throttling Q promises created using map()

import Q from 'q';
import { map } from 'q-map-throttle';

Q.map = map

const myArray = [1,2,3,4,5,6,7,8]

// Limits promise concurrency to 3
Q.map(myArray, function(element) {
    return promiseFactory(element)
}, 3)
    .then(function(resolvedArray) {
        doSomething()
    })

Keywords