Help with Min/Max Promise Completion


Help with Min/Max Promise Completion

I'm trying to leverage a series of nested promises, but I only need a proportion of calls to complete before I pass the result back up. Bluebird's Promise.some() only requires a certain portion of the promise iterable to pass, but ALL must return results before it triggers a then(). I want a proportion of promises, like a race condition for a group of promises. Something like:

Promise.min([Promise iterable lenght 20], threshold = 5) .then((results)=>{ console.log(results.length) // 5 }) 

Any pointers? I'm sure there's a solution, but I can't seem to find anything help in Bluebird or SO.

Submitted August 12, 2017 at 03:09AM by talaqen
via reddit http://ift.tt/2uxOsZ3

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s