1.0.0 • Published 7 years ago
prom-race v1.0.0
prom-race
A better
Promise.race
Why use It?
Promise.race()returning a forever pending promise when supplied an empty iterable, butprom-racewill NOT!prom-racewill call the others promises'cancelmethod if possible.
Installation
npm install prom-race
# or use yarn
yarn add prom-raceUsage
const promRace = require('prom-race')API
race
Parameters
iterable{Iterable} An iterable object, such as an Array.optionsObject {{}}options.cancelWhenFinished{boolean} - Whether call the others promises'cancelmethod. (optional, defaulttrue)
Returns Promise<any>
Contributing
- Fork it!
- Create your new branch:
git checkout -b feature-neworgit checkout -b fix-which-bug - Start your magic work now
- Make sure npm test passes
- Commit your changes:
git commit -am 'feat: some description (close #123)'orgit commit -am 'fix: some description (fix #123)' - Push to the branch:
git push - Submit a pull request :)
Authors
This library is written and maintained by imcuttle, moyuyc95@gmail.com.
License
MIT - imcuttle 🐟
1.0.0
7 years ago