source: trip-planner-front/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 787 bytes
Line 
1function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2 try {
3 var info = gen[key](arg);
4 var value = info.value;
5 } catch (error) {
6 reject(error);
7 return;
8 }
9
10 if (info.done) {
11 resolve(value);
12 } else {
13 Promise.resolve(value).then(_next, _throw);
14 }
15}
16
17export default function _asyncToGenerator(fn) {
18 return function () {
19 var self = this,
20 args = arguments;
21 return new Promise(function (resolve, reject) {
22 var gen = fn.apply(self, args);
23
24 function _next(value) {
25 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
26 }
27
28 function _throw(err) {
29 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
30 }
31
32 _next(undefined);
33 });
34 };
35}
Note: See TracBrowser for help on using the repository browser.