Given the following es6:
function* foo() {
try {
yield someValue;
}
catch (err) {
var obj = {err: err};
}
}
6to5@1.3.11 produces the following es5:
"use strict";
var foo = regeneratorRuntime.mark(function foo() {
var obj;
return regeneratorRuntime.wrap(function foo$(_context) {
while (true) switch (_context.prev = _context.next) {
case 0: _context.prev = 0;
_context.next = 3;
return someValue;
case 3: _context.next = 8;
break;
case 5: _context.prev = 5;
_context.t0 = _context["catch"](0);
obj = { _context.t0: _context.t0 };
case 8:
case "end": return _context.stop();
}
}, foo, this, [[0, 5]]);
});
The part of the output is problematic:
obj = { _context.t0: _context.t0 };
which comes from this line of es6:
The correct output would be:
obj = { err: _context.t0 };
Thanks!
Given the following es6:
6to5@1.3.11produces the following es5:The part of the output is problematic:
which comes from this line of es6:
The correct output would be:
Thanks!