source: imaps-frontend/node_modules/@babel/runtime/helpers/esm/asyncIterator.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.5 KB
Line 
1function _asyncIterator(r) {
2 var n,
3 t,
4 o,
5 e = 2;
6 for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) {
7 if (t && null != (n = r[t])) return n.call(r);
8 if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r));
9 t = "@@asyncIterator", o = "@@iterator";
10 }
11 throw new TypeError("Object is not async iterable");
12}
13function AsyncFromSyncIterator(r) {
14 function AsyncFromSyncIteratorContinuation(r) {
15 if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object."));
16 var n = r.done;
17 return Promise.resolve(r.value).then(function (r) {
18 return {
19 value: r,
20 done: n
21 };
22 });
23 }
24 return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) {
25 this.s = r, this.n = r.next;
26 }, AsyncFromSyncIterator.prototype = {
27 s: null,
28 n: null,
29 next: function next() {
30 return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
31 },
32 "return": function _return(r) {
33 var n = this.s["return"];
34 return void 0 === n ? Promise.resolve({
35 value: r,
36 done: !0
37 }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
38 },
39 "throw": function _throw(r) {
40 var n = this.s["return"];
41 return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
42 }
43 }, new AsyncFromSyncIterator(r);
44}
45export { _asyncIterator as default };
Note: See TracBrowser for help on using the repository browser.