promise-iterators
v1.1.0
Published
Package provides utils for promises
Downloads
4
Readme
Package provides utils for promises
Install
yarn add promise-iterators
or
npm i -S promise-iterators
Methods
- mapSeries
- mapSeriesSafe (avoid crashing on exception)
- eachSeries
- eachSeriesSafe
Example
import { mapSeries } from 'promise-iterators'
const idList = [1,2,3,4,5]
const data = await mapSeries(idList, async (id, index) => {
const result = await api.getObject(id)
return result
})
console.log(data) // [obj1, obj2, obj3, ...]