2.0.1 • Published 8 years ago

map-async-promise v2.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

map-async-promise

Allows mapping of an async function over an array and returns a promise once all items in the array have resolved.

With no dependencies.

Usage

const readFiles = (resolve, reject, element, index, arr) => {
  fs.readFile(element, 'utf8', function (err, data) {
    if (err) return reject(err);
    resolve(data);
  });
};


forEachPromise(readFiles)(['some/path/to/file', 'another/path/to/file'])
  .then(results => {
    console.log(results);
  })
  .catch(err => console.log(err));

Installation

npm install map-async-promise

2.0.1

8 years ago

2.0.0

8 years ago

1.0.11

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago