asyncIterator.js 360 B

1234567891011121314
  1. export default (function (iterable) {
  2. if (typeof Symbol === "function") {
  3. if (Symbol.asyncIterator) {
  4. var method = iterable[Symbol.asyncIterator];
  5. if (method != null) return method.call(iterable);
  6. }
  7. if (Symbol.iterator) {
  8. return iterable[Symbol.iterator]();
  9. }
  10. }
  11. throw new TypeError("Object is not async iterable");
  12. });