any.js (421B)
1 "use strict"; 2 module.exports = function(Promise) { 3 var SomePromiseArray = Promise._SomePromiseArray; 4 function any(promises) { 5 var ret = new SomePromiseArray(promises); 6 var promise = ret.promise(); 7 ret.setHowMany(1); 8 ret.setUnwrap(); 9 ret.init(); 10 return promise; 11 } 12 13 Promise.any = function (promises) { 14 return any(promises); 15 }; 16 17 Promise.prototype.any = function () { 18 return any(this); 19 }; 20 21 };