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.

21 lines
421 B

4 years ago
  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. Promise.any = function (promises) {
  13. return any(promises);
  14. };
  15. Promise.prototype.any = function () {
  16. return any(this);
  17. };
  18. };