evaera / roblox-lua-promise

Promise implementation for Roblox
https://eryn.io/roblox-lua-promise/
MIT License
281 stars 78 forks source link

Add Promise.some #10

Closed evaera closed 5 years ago

evaera commented 5 years ago

Promise.some(array<Promise>, amount)

Resolves when at least amount Promises have resolved with an array of the resolved values in the order that they resolved.

Rejects if enough input Promises rejected that the promise can no longer resolve. Still pending Promises become cancelled if they have no more consumers.

Promise.any

Promise.some with 1 amount, except resolved value is value directly instead of an array with one element. This is different than Promise.race, because Promise.race rejects if any input rejects, but Promise.any will only reject if all input promises reject.