asyncIterator.js.map 4.15 KB
{"version":3,"names":["_asyncIterator","iterable","method","async","sync","retry","Symbol","asyncIterator","iterator","call","AsyncFromSyncIterator","TypeError","s","n","next","prototype","AsyncFromSyncIteratorContinuation","apply","arguments","return","value","ret","undefined","Promise","resolve","done","throw","thr","reject","r","Object","then"],"sources":["../../src/helpers/asyncIterator.js"],"sourcesContent":["/* @minVersion 7.15.9 */\n\nexport default function _asyncIterator(iterable) {\n  var method,\n    async,\n    sync,\n    retry = 2;\n\n  if (typeof Symbol !== \"undefined\") {\n    async = Symbol.asyncIterator;\n    sync = Symbol.iterator;\n  }\n\n  while (retry--) {\n    if (async && (method = iterable[async]) != null) {\n      return method.call(iterable);\n    }\n    if (sync && (method = iterable[sync]) != null) {\n      return new AsyncFromSyncIterator(method.call(iterable));\n    }\n\n    async = \"@@asyncIterator\";\n    sync = \"@@iterator\";\n  }\n\n  throw new TypeError(\"Object is not async iterable\");\n}\n\nfunction AsyncFromSyncIterator(s) {\n  AsyncFromSyncIterator = function (s) {\n    this.s = s;\n    this.n = s.next;\n  };\n  AsyncFromSyncIterator.prototype = {\n    /* SyncIterator */ s: null,\n    /* SyncIterator.[[Next]] */ n: null,\n    next: function () {\n      return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));\n    },\n    return: function (value) {\n      var ret = this.s.return;\n      if (ret === undefined) {\n        return Promise.resolve({ value: value, done: true });\n      }\n      return AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments));\n    },\n    throw: function (value) {\n      var thr = this.s.return;\n      if (thr === undefined) return Promise.reject(value);\n      return AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments));\n    },\n  };\n\n  function AsyncFromSyncIteratorContinuation(r) {\n    // This step is _before_ calling AsyncFromSyncIteratorContinuation in the spec.\n    if (Object(r) !== r) {\n      return Promise.reject(new TypeError(r + \" is not an object.\"));\n    }\n\n    var done = r.done;\n    return Promise.resolve(r.value).then(function (value) {\n      return { value: value, done: done };\n    });\n  }\n\n  return new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