You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
421 B
22 lines
421 B
3 years ago
|
"use strict";
|
||
|
module.exports = function(Promise) {
|
||
|
var SomePromiseArray = Promise._SomePromiseArray;
|
||
|
function any(promises) {
|
||
|
var ret = new SomePromiseArray(promises);
|
||
|
var promise = ret.promise();
|
||
|
ret.setHowMany(1);
|
||
|
ret.setUnwrap();
|
||
|
ret.init();
|
||
|
return promise;
|
||
|
}
|
||
|
|
||
|
Promise.any = function (promises) {
|
||
|
return any(promises);
|
||
|
};
|
||
|
|
||
|
Promise.prototype.any = function () {
|
||
|
return any(this);
|
||
|
};
|
||
|
|
||
|
};
|