You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 257B

123456789101112
  1. 'use strict';
  2. const pReduce = require('p-reduce');
  3. module.exports = (iterable, iterator) => {
  4. const ret = [];
  5. return pReduce(iterable, (a, b, i) => {
  6. return Promise.resolve(iterator(b, i)).then(val => {
  7. ret.push(val);
  8. });
  9. }).then(() => ret);
  10. };