a-synchronous / a-synchronous/rubico
reduce.pool
Open
enhancement
- Dominant language
- JavaScript
- Stars
- 283
- Forks
- 17
- PR merge metrics
- No merged PRs in 30d
Description
```coffeescript
reduce.pool(maxConcurrency number, foldable Foldable, init function|any) -> Promise|any
```
`reduce` with limited concurrency.
```javascript
// (from number, to number) => AsyncIterator
const asyncRange = async function* (from, to) {
let number = from
while (++number < to) {
yield number
}
}
const asyncAdd = async (a, b) => a + b
reduce.pool(20, map(tap(console.log))(asyncAdd), 0)(asyncRange(1, 1000)).then(console.log)
// 1
// 2
// 3
// ...
// 999
// 499499
```
Contributor guide
Assessment
This issue has not been assessed yet.