multipromiseresolver
v1.0.3
Published
Helper function to replace the inbuilt Promise.all Function
Downloads
3
Readme
Helper function to replace the inbuilt Promise.all Function
Specification:
- Preserves Order Of Results
- Uses recommended ES6 features
Parameters:
- An Array of promises
How To Use:
Install the module by typing
npm i multipromiseresolver
in the node terminalImport the module by writing
const allPromises = require('multipromiseresolver')
Call the
allPromises
function on two valid Array inputs
Example
const promise1 = Promise.resolve(3);
const promise2 = 42;
const promise3 = new Promise((resolve, reject) => {
setTimeout(resolve, 100, 'foo');
});
allPromises([promise1, promise2, promise3]).then((values) => {
console.log(values);
});
//=> [3, 42, "foo"]