promise-many

1.0.3 • Public • Published

promise-many

Given a collection of promises and/or values, defer resolution and rejection until all promises in the collection have resolved or rejected. Finally, resolve or reject with an Array of all values gathered.


Example

    promiseMany([1,2,3, Promise.resolve(4)])
    //    => resolved with [1,2,3,4]

    promiseMany([1,2,3, Promise.reject(4)])
    //    => rejected with [1,2,3,4]

    var rejectedEventually = new Promise(function(_resolve, _reject){
        setTimeout(function(){
            _reject(3);
        }, 200);
    });
    promiseMany([1,2,rejectedEventually, Promise.resolve(4)])
    //    => rejected with [1,2,3,4]

Readme

Keywords

none

Package Sidebar

Install

npm i promise-many

Weekly Downloads

5

Version

1.0.3

License

MIT

Unpacked Size

16.4 kB

Total Files

8

Last publish

Collaborators

  • rmunson