index.js 370 B

1234567891011121314151617
  1. 'use strict';
  2. const pMapSeries = async (iterable, mapper) => {
  3. const result = [];
  4. let index = 0;
  5. for (const value of iterable) {
  6. // eslint-disable-next-line no-await-in-loop
  7. result.push(await mapper(await value, index++));
  8. }
  9. return result;
  10. };
  11. module.exports = pMapSeries;
  12. // TODO: Remove this for the next major release
  13. module.exports.default = pMapSeries;