README
p-race
A better
Promise.race()
This fixes the silly behavior of Promise.race()
returning a forever pending promise when supplied an empty iterable, which could create some really hard to debug problems.
Promise.race()
returns the first promise to fulfill or reject. Check out p-any
if you like to get the first promise to fulfill.
Install
$ npm install p-race
Usage
import pRace from 'p-race';
Promise.race([]);
// Returns a forever pending promise…
pRace([]);
//=> [RangeError: Expected the input to contain at least one item]
API
See the Promise.race()
docs.