sequent-promises
Call promises one by one, ignoring the state (fulfilled or rejected). and returning the collected data in the tuple { results, errors }
.
Install
npm
npm install sequent-promises
yarn
yarn add sequent-promises
Usage
import sequentPromises, { isNotRunningError } from 'sequent-promises';
const result = 'result';
const error = new Error('error');
const promiseResolve = () => Promise.resolve(result);
const promiseReject = () => Promise.reject(error);
sequentPromises([promiseResolve, promiseReject, promiseResolve]).then(({ results, errors }) => {
console.log(results);
console.log(errors);
console.log(isNotRunningError(errors[0]));
});
Run tests
npm test
Maintainer
Krivega Dmitriy
Contributing
Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.
📝 License
Copyright © 2020 Krivega Dmitriy.
This project is MIT licensed.