Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/krivega/sequent-promises
https://github.com/krivega/sequent-promises
Last synced: 26 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/krivega/sequent-promises
- Owner: Krivega
- License: mit
- Created: 2020-02-25T07:13:35.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-21T11:51:05.000Z (8 months ago)
- Last Synced: 2024-12-07T19:32:35.221Z (about 1 month ago)
- Language: TypeScript
- Size: 1.12 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# sequent-promises
[![npm](https://img.shields.io/npm/v/sequent-promises?style=flat-square)](https://www.npmjs.com/package/sequent-promises)
![npm bundle size](https://img.shields.io/bundlephobia/minzip/sequent-promises?style=flat-square)Call promises one by one, ignoring the state (fulfilled or rejected). and returning the collected data in the tuple `{ results, errors }`.
## Install
npm
```sh
npm install sequent-promises
```yarn
```sh
yarn add sequent-promises
```## Usage
```js
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
```sh
npm test
```## Maintainer
**Krivega Dmitriy**
- Website:
- Github: [@Krivega](https://github.com/Krivega)## Contributing
Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://github.com/Krivega/sequent-promises/issues). You can also take a look at the [contributing guide](https://github.com/Krivega/sequent-promises/blob/master/CONTRIBUTING.md).## 📝 License
Copyright © 2020 [Krivega Dmitriy](https://github.com/Krivega).
This project is [MIT](https://github.com/Krivega/sequent-promises/blob/master/LICENSE) licensed.