You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, with the following code both when.any([]) and when.any([resolvesToUndefinedFirst,...]) behave exactly the same way.
I'm wondering why that is and what the rationale about it is. At first glance it seems to me that when.any([]) (and similarly when.some) should throw a range error.
(Similarly, when calling when.any without an array argument).
when.any([]).then(function(val){document.body.innerHTML=JSON.stringify(val);});varp=when.resolve(undefined);when.any([p]).then(function(val){document.body.innerHTML+=" "+JSON.stringify(val);});// ends up with body being `undefined undefined`
@benjamingr Yeah, it seems pretty reasonable to reject for any kind of N-winner race where it's known up front that there simply aren't enough inputs to ever fulfill it. That jives with the notion that at the point where it's known that the race can't be fulfilled, it rejects. I think we considered doing that for 3.0, but it fell off the radar.
Using a RangeError as suggested in petkaantonov/bluebird#233 seems pretty reasonable--better than returning never() like race() has to do :(
@unscriptable and @scothis, this would be a breaking change for 3.x, but honestly, I think I'd rather just call it a bug and fix it in 3.3 than wait for 4.0 (when.some is already deprecated anyway). Any thoughts or objections?
Currently, with the following code both
when.any([])
andwhen.any([resolvesToUndefinedFirst,...])
behave exactly the same way.I'm wondering why that is and what the rationale about it is. At first glance it seems to me that
when.any([])
(and similarlywhen.some
) should throw a range error.(Similarly, when calling
when.any
without an array argument).Thanks!
Related: petkaantonov/bluebird#233
Online example: http://jsfiddle.net/3RAk8/
The text was updated successfully, but these errors were encountered: