Package Exports
- promise-iterators
- promise-iterators/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (promise-iterators) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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, ...]