Package Exports
- promise-map-series
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-map-series) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
promise-map-series
Call an iterator function for each element of an array in series, ensuring that no iterator is called before the promise returned by the previous iterator is fulfilled, in effect preventing parallel execution. Like async.mapSeries, but for promises.
Installation
npm install --save promise-map-series
Usage
var mapSeries = require('promise-map-series')
mapSeries(array, iterator[, thisArg]).then(function (newArray) {
...
})
array
: An array of values (should not be promises).iterator
: Function that returns a promise or a value for the new array. Theiterator
will be called once for each element. Ifiterator
returns a promise, theniterator
will only be called for the next element once that promise is fulfilled. If the promise is rejected oriterator
throws an error, iteration will stop immediately andmapSeries
returns a rejected promise. Theiterator
function receives three arguments:item
: The current item in the array.index
: The current index in the array.array
: The originalarray
argument.
thisArg
(optional): Value to use asthis
when executingiterator
.