JSPM

promise-iterators

1.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q8455F

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

npm

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, ...]