1.0.2 • Published 2 months ago

sequent-promises v1.0.2

Weekly downloads
11
License
MIT
Repository
github
Last release
2 months ago

sequent-promises

npm npm bundle size

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, isSuccessful, isError]).then(
  ({ success, errors, results }) => {
    console.log(success); // [result, result]
    console.log(errors); // ['Not running: Promise was not running']
    console.log(results); // [result, 'Not running: Promise was not running', result]
    console.log(isSuccessful); // true - last promise
    console.log(isError); // false - last promise
    console.log(isNotRunningError(errors[0])); //true;
  },
);

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.

1.0.2

2 months ago

1.0.1

2 months ago

1.0.0

7 months ago

0.1.4

2 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.0

4 years ago

0.1.1

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago