asyncIterator.js 863 B

1234567891011121314151617181920212223242526272829303132
  1. "use strict";
  2. exports.__esModule = true;
  3. var _getIterator2 = require("../core-js/get-iterator");
  4. var _getIterator3 = _interopRequireDefault(_getIterator2);
  5. var _iterator = require("../core-js/symbol/iterator");
  6. var _iterator2 = _interopRequireDefault(_iterator);
  7. var _symbol = require("../core-js/symbol");
  8. var _symbol2 = _interopRequireDefault(_symbol);
  9. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10. exports.default = function (iterable) {
  11. if (typeof _symbol2.default === "function") {
  12. if (_symbol2.default.asyncIterator) {
  13. var method = iterable[_symbol2.default.asyncIterator];
  14. if (method != null) return method.call(iterable);
  15. }
  16. if (_iterator2.default) {
  17. return (0, _getIterator3.default)(iterable);
  18. }
  19. }
  20. throw new TypeError("Object is not async iterable");
  21. };