@nocobase/plugin-workflow-json-query 1.9.7 → 2.0.0-alpha.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1520,7 +1520,7 @@ var dateTime = function () {
1520
1520
  def.integerFormat.mandatoryDigits = def.width.min;
1521
1521
  }
1522
1522
  }
1523
- if ('YMD'.indexOf(def.component) !== -1) {
1523
+ if (def.component === 'Y') {
1524
1524
  // §9.8.4.4
1525
1525
  def.n = -1;
1526
1526
  if (def.width && def.width.max !== undefined) {
@@ -1533,6 +1533,11 @@ var dateTime = function () {
1533
1533
  }
1534
1534
  }
1535
1535
  }
1536
+ // if the previous part is also an integer with no intervening markup, then its width for parsing must be precisely defined
1537
+ var previousPart = spec[spec.length - 1];
1538
+ if (previousPart && previousPart.integerFormat) {
1539
+ previousPart.integerFormat.parseWidth = previousPart.integerFormat.mandatoryDigits;
1540
+ }
1536
1541
  }
1537
1542
  if (def.component === 'Z' || def.component === 'z') {
1538
1543
  def.integerFormat = analyseIntegerPicture(def.presentation1);
@@ -1909,7 +1914,6 @@ var dateTime = function () {
1909
1914
  return offsetHours * 60 + offsetMinutes;
1910
1915
  };
1911
1916
  } else if (part.integerFormat) {
1912
- part.integerFormat.n = part.n;
1913
1917
  res = generateRegex(part.integerFormat);
1914
1918
  } else {
1915
1919
  // must be a month or day name
@@ -1960,16 +1964,6 @@ var dateTime = function () {
1960
1964
  // type === 'integer'
1961
1965
  matcher.type = 'integer';
1962
1966
  var isUpper = formatSpec["case"] === tcase.UPPER;
1963
- var occurrences;
1964
- if (formatSpec.n && formatSpec.n > 0) {
1965
- if (formatSpec.optionalDigits === 0) {
1966
- occurrences = "{".concat(formatSpec.n, "}");
1967
- } else {
1968
- occurrences = "{".concat(formatSpec.n - formatSpec.optionalDigits, ",").concat(formatSpec.n, "}");
1969
- }
1970
- } else {
1971
- occurrences = '+';
1972
- }
1973
1967
  switch (formatSpec.primary) {
1974
1968
  case formats.LETTERS:
1975
1969
  matcher.regex = isUpper ? '[A-Z]+' : '[a-z]+';
@@ -1990,7 +1984,12 @@ var dateTime = function () {
1990
1984
  };
1991
1985
  break;
1992
1986
  case formats.DECIMAL:
1993
- matcher.regex = "[0-9]".concat(occurrences);
1987
+ matcher.regex = '[0-9]';
1988
+ if (formatSpec.parseWidth) {
1989
+ matcher.regex += "{".concat(formatSpec.parseWidth, "}");
1990
+ } else {
1991
+ matcher.regex += '+';
1992
+ }
1994
1993
  if (formatSpec.ordinal) {
1995
1994
  // ordinals
1996
1995
  matcher.regex += '(?:th|st|nd|rd)';
@@ -2276,7 +2275,9 @@ module.exports = dateTime;
2276
2275
  (function (global){(function (){
2277
2276
  "use strict";
2278
2277
 
2279
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
2278
+ function _regeneratorKeys(e) { var n = Object(e), r = []; for (var t in n) r.unshift(t); return function e() { for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e; return e.done = !0, e; }; }
2279
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
2280
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
2280
2281
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2281
2282
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
2282
2283
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
@@ -2556,6 +2557,7 @@ var functions = function () {
2556
2557
  _char = ' ';
2557
2558
  }
2558
2559
  var result;
2560
+ width = Math.trunc(width);
2559
2561
  var padLength = Math.abs(width) - length(str);
2560
2562
  if (padLength > 0) {
2561
2563
  var padding = new Array(padLength + 1).join(_char);
@@ -2590,34 +2592,31 @@ var functions = function () {
2590
2592
  * @returns {Boolean} - true if str contains token
2591
2593
  */
2592
2594
  function _evaluateMatcher() {
2593
- _evaluateMatcher = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(matcher, str) {
2595
+ _evaluateMatcher = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(matcher, str) {
2594
2596
  var result;
2595
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2596
- while (1) switch (_context.prev = _context.next) {
2597
+ return _regenerator().w(function (_context) {
2598
+ while (1) switch (_context.n) {
2597
2599
  case 0:
2598
2600
  result = matcher.apply(this, [str]); // eslint-disable-line no-useless-call
2599
2601
  if (!isPromise(result)) {
2600
- _context.next = 5;
2602
+ _context.n = 2;
2601
2603
  break;
2602
2604
  }
2603
- _context.next = 4;
2605
+ _context.n = 1;
2604
2606
  return result;
2605
- case 4:
2606
- result = _context.sent;
2607
- case 5:
2607
+ case 1:
2608
+ result = _context.v;
2609
+ case 2:
2608
2610
  if (!(result && !(typeof result.start === 'number' || result.end === 'number' || Array.isArray(result.groups) || isFunction(result.next)))) {
2609
- _context.next = 7;
2611
+ _context.n = 3;
2610
2612
  break;
2611
2613
  }
2612
2614
  throw {
2613
2615
  code: "T1010",
2614
2616
  stack: new Error().stack
2615
2617
  };
2616
- case 7:
2617
- return _context.abrupt("return", result);
2618
- case 8:
2619
- case "end":
2620
- return _context.stop();
2618
+ case 3:
2619
+ return _context.a(2, result);
2621
2620
  }
2622
2621
  }, _callee, this);
2623
2622
  }));
@@ -2634,35 +2633,32 @@ var functions = function () {
2634
2633
  * @returns {Array} The array of match objects
2635
2634
  */
2636
2635
  function _contains() {
2637
- _contains = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(str, token) {
2636
+ _contains = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(str, token) {
2638
2637
  var result, matches;
2639
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2640
- while (1) switch (_context2.prev = _context2.next) {
2638
+ return _regenerator().w(function (_context2) {
2639
+ while (1) switch (_context2.n) {
2641
2640
  case 0:
2642
2641
  if (!(typeof str === 'undefined')) {
2643
- _context2.next = 2;
2642
+ _context2.n = 1;
2644
2643
  break;
2645
2644
  }
2646
- return _context2.abrupt("return", undefined);
2647
- case 2:
2645
+ return _context2.a(2, undefined);
2646
+ case 1:
2648
2647
  if (!(typeof token === 'string')) {
2649
- _context2.next = 6;
2648
+ _context2.n = 2;
2650
2649
  break;
2651
2650
  }
2652
2651
  result = str.indexOf(token) !== -1;
2653
- _context2.next = 10;
2652
+ _context2.n = 4;
2654
2653
  break;
2655
- case 6:
2656
- _context2.next = 8;
2654
+ case 2:
2655
+ _context2.n = 3;
2657
2656
  return evaluateMatcher(token, str);
2658
- case 8:
2659
- matches = _context2.sent;
2657
+ case 3:
2658
+ matches = _context2.v;
2660
2659
  result = typeof matches !== 'undefined';
2661
- case 10:
2662
- return _context2.abrupt("return", result);
2663
- case 11:
2664
- case "end":
2665
- return _context2.stop();
2660
+ case 4:
2661
+ return _context2.a(2, result);
2666
2662
  }
2667
2663
  }, _callee2);
2668
2664
  }));
@@ -2680,19 +2676,19 @@ var functions = function () {
2680
2676
  * @returns {Array} The array of match objects
2681
2677
  */
2682
2678
  function _match() {
2683
- _match = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(str, regex, limit) {
2679
+ _match = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(str, regex, limit) {
2684
2680
  var result, count, matches;
2685
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
2686
- while (1) switch (_context3.prev = _context3.next) {
2681
+ return _regenerator().w(function (_context3) {
2682
+ while (1) switch (_context3.n) {
2687
2683
  case 0:
2688
2684
  if (!(typeof str === 'undefined')) {
2689
- _context3.next = 2;
2685
+ _context3.n = 1;
2690
2686
  break;
2691
2687
  }
2692
- return _context3.abrupt("return", undefined);
2693
- case 2:
2688
+ return _context3.a(2, undefined);
2689
+ case 1:
2694
2690
  if (!(limit < 0)) {
2695
- _context3.next = 4;
2691
+ _context3.n = 2;
2696
2692
  break;
2697
2693
  }
2698
2694
  throw {
@@ -2701,24 +2697,24 @@ var functions = function () {
2701
2697
  code: 'D3040',
2702
2698
  index: 3
2703
2699
  };
2704
- case 4:
2700
+ case 2:
2705
2701
  result = createSequence();
2706
2702
  if (!(typeof limit === 'undefined' || limit > 0)) {
2707
- _context3.next = 19;
2703
+ _context3.n = 6;
2708
2704
  break;
2709
2705
  }
2710
2706
  count = 0;
2711
- _context3.next = 9;
2707
+ _context3.n = 3;
2712
2708
  return evaluateMatcher(regex, str);
2713
- case 9:
2714
- matches = _context3.sent;
2709
+ case 3:
2710
+ matches = _context3.v;
2715
2711
  if (!(typeof matches !== 'undefined')) {
2716
- _context3.next = 19;
2712
+ _context3.n = 6;
2717
2713
  break;
2718
2714
  }
2719
- case 11:
2715
+ case 4:
2720
2716
  if (!(typeof matches !== 'undefined' && (typeof limit === 'undefined' || count < limit))) {
2721
- _context3.next = 19;
2717
+ _context3.n = 6;
2722
2718
  break;
2723
2719
  }
2724
2720
  result.push({
@@ -2726,24 +2722,21 @@ var functions = function () {
2726
2722
  index: matches.start,
2727
2723
  groups: matches.groups
2728
2724
  });
2729
- _context3.next = 15;
2725
+ _context3.n = 5;
2730
2726
  return evaluateMatcher(matches.next);
2731
- case 15:
2732
- matches = _context3.sent;
2727
+ case 5:
2728
+ matches = _context3.v;
2733
2729
  count++;
2734
- _context3.next = 11;
2730
+ _context3.n = 4;
2735
2731
  break;
2736
- case 19:
2737
- return _context3.abrupt("return", result);
2738
- case 20:
2739
- case "end":
2740
- return _context3.stop();
2732
+ case 6:
2733
+ return _context3.a(2, result);
2741
2734
  }
2742
2735
  }, _callee3);
2743
2736
  }));
2744
2737
  return _match.apply(this, arguments);
2745
2738
  }
2746
- function replace(_x8, _x9, _x10, _x11) {
2739
+ function replace(_x8, _x9, _x0, _x1) {
2747
2740
  return _replace.apply(this, arguments);
2748
2741
  }
2749
2742
  /**
@@ -2752,20 +2745,20 @@ var functions = function () {
2752
2745
  * @returns {String} Base 64 encoding of the binary data
2753
2746
  */
2754
2747
  function _replace() {
2755
- _replace = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(str, pattern, replacement, limit) {
2748
+ _replace = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(str, pattern, replacement, limit) {
2756
2749
  var self, replacer, result, position, count, index, matches, replacedWith;
2757
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
2758
- while (1) switch (_context4.prev = _context4.next) {
2750
+ return _regenerator().w(function (_context4) {
2751
+ while (1) switch (_context4.n) {
2759
2752
  case 0:
2760
2753
  if (!(typeof str === 'undefined')) {
2761
- _context4.next = 2;
2754
+ _context4.n = 1;
2762
2755
  break;
2763
2756
  }
2764
- return _context4.abrupt("return", undefined);
2765
- case 2:
2757
+ return _context4.a(2, undefined);
2758
+ case 1:
2766
2759
  self = this; // pattern cannot be an empty string
2767
2760
  if (!(pattern === '')) {
2768
- _context4.next = 5;
2761
+ _context4.n = 2;
2769
2762
  break;
2770
2763
  }
2771
2764
  throw {
@@ -2774,9 +2767,9 @@ var functions = function () {
2774
2767
  value: pattern,
2775
2768
  index: 2
2776
2769
  };
2777
- case 5:
2770
+ case 2:
2778
2771
  if (!(limit < 0)) {
2779
- _context4.next = 7;
2772
+ _context4.n = 3;
2780
2773
  break;
2781
2774
  }
2782
2775
  throw {
@@ -2785,7 +2778,7 @@ var functions = function () {
2785
2778
  value: limit,
2786
2779
  index: 4
2787
2780
  };
2788
- case 7:
2781
+ case 3:
2789
2782
  if (typeof replacement === 'string') {
2790
2783
  replacer = function replacer(regexMatch) {
2791
2784
  var substitute = '';
@@ -2841,12 +2834,12 @@ var functions = function () {
2841
2834
  result = '';
2842
2835
  position = 0;
2843
2836
  if (!(typeof limit === 'undefined' || limit > 0)) {
2844
- _context4.next = 47;
2837
+ _context4.n = 15;
2845
2838
  break;
2846
2839
  }
2847
2840
  count = 0;
2848
2841
  if (!(typeof pattern === 'string')) {
2849
- _context4.next = 18;
2842
+ _context4.n = 4;
2850
2843
  break;
2851
2844
  }
2852
2845
  index = str.indexOf(pattern, position);
@@ -2858,71 +2851,68 @@ var functions = function () {
2858
2851
  index = str.indexOf(pattern, position);
2859
2852
  }
2860
2853
  result += str.substring(position);
2861
- _context4.next = 45;
2854
+ _context4.n = 14;
2862
2855
  break;
2863
- case 18:
2864
- _context4.next = 20;
2856
+ case 4:
2857
+ _context4.n = 5;
2865
2858
  return evaluateMatcher(pattern, str);
2866
- case 20:
2867
- matches = _context4.sent;
2859
+ case 5:
2860
+ matches = _context4.v;
2868
2861
  if (!(typeof matches !== 'undefined')) {
2869
- _context4.next = 44;
2862
+ _context4.n = 13;
2870
2863
  break;
2871
2864
  }
2872
- case 22:
2865
+ case 6:
2873
2866
  if (!(typeof matches !== 'undefined' && (typeof limit === 'undefined' || count < limit))) {
2874
- _context4.next = 41;
2867
+ _context4.n = 12;
2875
2868
  break;
2876
2869
  }
2877
2870
  result += str.substring(position, matches.start);
2878
2871
  replacedWith = replacer.apply(self, [matches]);
2879
2872
  if (!isPromise(replacedWith)) {
2880
- _context4.next = 29;
2873
+ _context4.n = 8;
2881
2874
  break;
2882
2875
  }
2883
- _context4.next = 28;
2876
+ _context4.n = 7;
2884
2877
  return replacedWith;
2885
- case 28:
2886
- replacedWith = _context4.sent;
2887
- case 29:
2878
+ case 7:
2879
+ replacedWith = _context4.v;
2880
+ case 8:
2888
2881
  if (!(typeof replacedWith === 'string')) {
2889
- _context4.next = 33;
2882
+ _context4.n = 9;
2890
2883
  break;
2891
2884
  }
2892
2885
  result += replacedWith;
2893
- _context4.next = 34;
2886
+ _context4.n = 10;
2894
2887
  break;
2895
- case 33:
2888
+ case 9:
2896
2889
  throw {
2897
2890
  code: "D3012",
2898
2891
  stack: new Error().stack,
2899
2892
  value: replacedWith
2900
2893
  };
2901
- case 34:
2894
+ case 10:
2902
2895
  position = matches.start + matches.match.length;
2903
2896
  count++;
2904
- _context4.next = 38;
2897
+ _context4.n = 11;
2905
2898
  return evaluateMatcher(matches.next);
2906
- case 38:
2907
- matches = _context4.sent;
2908
- _context4.next = 22;
2899
+ case 11:
2900
+ matches = _context4.v;
2901
+ _context4.n = 6;
2909
2902
  break;
2910
- case 41:
2903
+ case 12:
2911
2904
  result += str.substring(position);
2912
- _context4.next = 45;
2905
+ _context4.n = 14;
2913
2906
  break;
2914
- case 44:
2907
+ case 13:
2915
2908
  result = str;
2916
- case 45:
2917
- _context4.next = 48;
2909
+ case 14:
2910
+ _context4.n = 16;
2918
2911
  break;
2919
- case 47:
2912
+ case 15:
2920
2913
  result = str;
2921
- case 48:
2922
- return _context4.abrupt("return", result);
2923
- case 49:
2924
- case "end":
2925
- return _context4.stop();
2914
+ case 16:
2915
+ return _context4.a(2, result);
2926
2916
  }
2927
2917
  }, _callee4, this);
2928
2918
  }));
@@ -3075,7 +3065,7 @@ var functions = function () {
3075
3065
  * @param {Integer} [limit] - max number of substrings
3076
3066
  * @returns {Array} The array of string
3077
3067
  */
3078
- function split(_x12, _x13, _x14) {
3068
+ function split(_x10, _x11, _x12) {
3079
3069
  return _split.apply(this, arguments);
3080
3070
  }
3081
3071
  /**
@@ -3085,19 +3075,19 @@ var functions = function () {
3085
3075
  * @returns {String} The concatenated string
3086
3076
  */
3087
3077
  function _split() {
3088
- _split = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(str, separator, limit) {
3078
+ _split = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(str, separator, limit) {
3089
3079
  var result, count, matches, start;
3090
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
3091
- while (1) switch (_context5.prev = _context5.next) {
3080
+ return _regenerator().w(function (_context5) {
3081
+ while (1) switch (_context5.n) {
3092
3082
  case 0:
3093
3083
  if (!(typeof str === 'undefined')) {
3094
- _context5.next = 2;
3084
+ _context5.n = 1;
3095
3085
  break;
3096
3086
  }
3097
- return _context5.abrupt("return", undefined);
3098
- case 2:
3087
+ return _context5.a(2, undefined);
3088
+ case 1:
3099
3089
  if (!(limit < 0)) {
3100
- _context5.next = 4;
3090
+ _context5.n = 2;
3101
3091
  break;
3102
3092
  }
3103
3093
  throw {
@@ -3106,57 +3096,54 @@ var functions = function () {
3106
3096
  value: limit,
3107
3097
  index: 3
3108
3098
  };
3109
- case 4:
3099
+ case 2:
3110
3100
  result = [];
3111
3101
  if (!(typeof limit === 'undefined' || limit > 0)) {
3112
- _context5.next = 29;
3102
+ _context5.n = 9;
3113
3103
  break;
3114
3104
  }
3115
3105
  if (!(typeof separator === 'string')) {
3116
- _context5.next = 10;
3106
+ _context5.n = 3;
3117
3107
  break;
3118
3108
  }
3119
3109
  result = str.split(separator, limit);
3120
- _context5.next = 29;
3110
+ _context5.n = 9;
3121
3111
  break;
3122
- case 10:
3112
+ case 3:
3123
3113
  count = 0;
3124
- _context5.next = 13;
3114
+ _context5.n = 4;
3125
3115
  return evaluateMatcher(separator, str);
3126
- case 13:
3127
- matches = _context5.sent;
3116
+ case 4:
3117
+ matches = _context5.v;
3128
3118
  if (!(typeof matches !== 'undefined')) {
3129
- _context5.next = 28;
3119
+ _context5.n = 8;
3130
3120
  break;
3131
3121
  }
3132
3122
  start = 0;
3133
- case 16:
3123
+ case 5:
3134
3124
  if (!(typeof matches !== 'undefined' && (typeof limit === 'undefined' || count < limit))) {
3135
- _context5.next = 25;
3125
+ _context5.n = 7;
3136
3126
  break;
3137
3127
  }
3138
3128
  result.push(str.substring(start, matches.start));
3139
3129
  start = matches.end;
3140
- _context5.next = 21;
3130
+ _context5.n = 6;
3141
3131
  return evaluateMatcher(matches.next);
3142
- case 21:
3143
- matches = _context5.sent;
3132
+ case 6:
3133
+ matches = _context5.v;
3144
3134
  count++;
3145
- _context5.next = 16;
3135
+ _context5.n = 5;
3146
3136
  break;
3147
- case 25:
3137
+ case 7:
3148
3138
  if (typeof limit === 'undefined' || count < limit) {
3149
3139
  result.push(str.substring(start));
3150
3140
  }
3151
- _context5.next = 29;
3141
+ _context5.n = 9;
3152
3142
  break;
3153
- case 28:
3143
+ case 8:
3154
3144
  result.push(str);
3155
- case 29:
3156
- return _context5.abrupt("return", result);
3157
- case 30:
3158
- case "end":
3159
- return _context5.stop();
3145
+ case 9:
3146
+ return _context5.a(2, result);
3160
3147
  }
3161
3148
  }, _callee5);
3162
3149
  }));
@@ -3407,8 +3394,8 @@ var functions = function () {
3407
3394
  }
3408
3395
  var minimumExponentSize = 0;
3409
3396
  if (exponentPresent) {
3410
- minimumExponentSize = parts.exponentPart.split('').filter(function (_char10) {
3411
- return decimalDigitFamily.indexOf(_char10) !== -1;
3397
+ minimumExponentSize = parts.exponentPart.split('').filter(function (_char0) {
3398
+ return decimalDigitFamily.indexOf(_char0) !== -1;
3412
3399
  }).length;
3413
3400
  }
3414
3401
  return {
@@ -3801,7 +3788,7 @@ var functions = function () {
3801
3788
  if (arg !== 0) {
3802
3789
  result = true;
3803
3790
  }
3804
- } else if (arg !== null && _typeof(arg) === 'object') {
3791
+ } else if (arg !== null && _typeof(arg) === 'object' && !isFunction(arg)) {
3805
3792
  if (Object.keys(arg).length > 0) {
3806
3793
  result = true;
3807
3794
  }
@@ -3852,7 +3839,7 @@ var functions = function () {
3852
3839
  * @param {Function} func - function to apply
3853
3840
  * @returns {Array} Map array
3854
3841
  */
3855
- function map(_x15, _x16) {
3842
+ function map(_x13, _x14) {
3856
3843
  return _map.apply(this, arguments);
3857
3844
  }
3858
3845
  /**
@@ -3862,47 +3849,44 @@ var functions = function () {
3862
3849
  * @returns {Array} Map array
3863
3850
  */
3864
3851
  function _map() {
3865
- _map = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(arr, func) {
3852
+ _map = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(arr, func) {
3866
3853
  var result, i, func_args, res;
3867
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
3868
- while (1) switch (_context6.prev = _context6.next) {
3854
+ return _regenerator().w(function (_context6) {
3855
+ while (1) switch (_context6.n) {
3869
3856
  case 0:
3870
3857
  if (!(typeof arr === 'undefined')) {
3871
- _context6.next = 2;
3858
+ _context6.n = 1;
3872
3859
  break;
3873
3860
  }
3874
- return _context6.abrupt("return", undefined);
3875
- case 2:
3861
+ return _context6.a(2, undefined);
3862
+ case 1:
3876
3863
  result = createSequence(); // do the map - iterate over the arrays, and invoke func
3877
3864
  i = 0;
3878
- case 4:
3865
+ case 2:
3879
3866
  if (!(i < arr.length)) {
3880
- _context6.next = 13;
3867
+ _context6.n = 5;
3881
3868
  break;
3882
3869
  }
3883
3870
  func_args = hofFuncArgs(func, arr[i], i, arr); // invoke func
3884
- _context6.next = 8;
3871
+ _context6.n = 3;
3885
3872
  return func.apply(this, func_args);
3886
- case 8:
3887
- res = _context6.sent;
3873
+ case 3:
3874
+ res = _context6.v;
3888
3875
  if (typeof res !== 'undefined') {
3889
3876
  result.push(res);
3890
3877
  }
3891
- case 10:
3878
+ case 4:
3892
3879
  i++;
3893
- _context6.next = 4;
3880
+ _context6.n = 2;
3894
3881
  break;
3895
- case 13:
3896
- return _context6.abrupt("return", result);
3897
- case 14:
3898
- case "end":
3899
- return _context6.stop();
3882
+ case 5:
3883
+ return _context6.a(2, result);
3900
3884
  }
3901
3885
  }, _callee6, this);
3902
3886
  }));
3903
3887
  return _map.apply(this, arguments);
3904
3888
  }
3905
- function filter(_x17, _x18) {
3889
+ function filter(_x15, _x16) {
3906
3890
  return _filter.apply(this, arguments);
3907
3891
  }
3908
3892
  /**
@@ -3913,48 +3897,45 @@ var functions = function () {
3913
3897
  * @returns {*} Matching element
3914
3898
  */
3915
3899
  function _filter() {
3916
- _filter = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(arr, func) {
3900
+ _filter = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(arr, func) {
3917
3901
  var result, i, entry, func_args, res;
3918
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
3919
- while (1) switch (_context7.prev = _context7.next) {
3902
+ return _regenerator().w(function (_context7) {
3903
+ while (1) switch (_context7.n) {
3920
3904
  case 0:
3921
3905
  if (!(typeof arr === 'undefined')) {
3922
- _context7.next = 2;
3906
+ _context7.n = 1;
3923
3907
  break;
3924
3908
  }
3925
- return _context7.abrupt("return", undefined);
3926
- case 2:
3909
+ return _context7.a(2, undefined);
3910
+ case 1:
3927
3911
  result = createSequence();
3928
3912
  i = 0;
3929
- case 4:
3913
+ case 2:
3930
3914
  if (!(i < arr.length)) {
3931
- _context7.next = 14;
3915
+ _context7.n = 5;
3932
3916
  break;
3933
3917
  }
3934
3918
  entry = arr[i];
3935
3919
  func_args = hofFuncArgs(func, entry, i, arr); // invoke func
3936
- _context7.next = 9;
3920
+ _context7.n = 3;
3937
3921
  return func.apply(this, func_args);
3938
- case 9:
3939
- res = _context7.sent;
3922
+ case 3:
3923
+ res = _context7.v;
3940
3924
  if (_boolean(res)) {
3941
3925
  result.push(entry);
3942
3926
  }
3943
- case 11:
3927
+ case 4:
3944
3928
  i++;
3945
- _context7.next = 4;
3929
+ _context7.n = 2;
3946
3930
  break;
3947
- case 14:
3948
- return _context7.abrupt("return", result);
3949
- case 15:
3950
- case "end":
3951
- return _context7.stop();
3931
+ case 5:
3932
+ return _context7.a(2, result);
3952
3933
  }
3953
3934
  }, _callee7, this);
3954
3935
  }));
3955
3936
  return _filter.apply(this, arguments);
3956
3937
  }
3957
- function single(_x19, _x20) {
3938
+ function single(_x17, _x18) {
3958
3939
  return _single.apply(this, arguments);
3959
3940
  }
3960
3941
  /**
@@ -3963,73 +3944,70 @@ var functions = function () {
3963
3944
  * @returns {Array} Zipped array
3964
3945
  */
3965
3946
  function _single() {
3966
- _single = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(arr, func) {
3947
+ _single = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(arr, func) {
3967
3948
  var hasFoundMatch, result, i, entry, positiveResult, func_args, res;
3968
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
3969
- while (1) switch (_context8.prev = _context8.next) {
3949
+ return _regenerator().w(function (_context8) {
3950
+ while (1) switch (_context8.n) {
3970
3951
  case 0:
3971
3952
  if (!(typeof arr === 'undefined')) {
3972
- _context8.next = 2;
3953
+ _context8.n = 1;
3973
3954
  break;
3974
3955
  }
3975
- return _context8.abrupt("return", undefined);
3976
- case 2:
3956
+ return _context8.a(2, undefined);
3957
+ case 1:
3977
3958
  hasFoundMatch = false;
3978
3959
  i = 0;
3979
- case 4:
3960
+ case 2:
3980
3961
  if (!(i < arr.length)) {
3981
- _context8.next = 23;
3962
+ _context8.n = 7;
3982
3963
  break;
3983
3964
  }
3984
3965
  entry = arr[i];
3985
3966
  positiveResult = true;
3986
3967
  if (!(typeof func !== 'undefined')) {
3987
- _context8.next = 13;
3968
+ _context8.n = 4;
3988
3969
  break;
3989
3970
  }
3990
3971
  func_args = hofFuncArgs(func, entry, i, arr); // invoke func
3991
- _context8.next = 11;
3972
+ _context8.n = 3;
3992
3973
  return func.apply(this, func_args);
3993
- case 11:
3994
- res = _context8.sent;
3974
+ case 3:
3975
+ res = _context8.v;
3995
3976
  positiveResult = _boolean(res);
3996
- case 13:
3977
+ case 4:
3997
3978
  if (!positiveResult) {
3998
- _context8.next = 20;
3979
+ _context8.n = 6;
3999
3980
  break;
4000
3981
  }
4001
3982
  if (hasFoundMatch) {
4002
- _context8.next = 19;
3983
+ _context8.n = 5;
4003
3984
  break;
4004
3985
  }
4005
3986
  result = entry;
4006
3987
  hasFoundMatch = true;
4007
- _context8.next = 20;
3988
+ _context8.n = 6;
4008
3989
  break;
4009
- case 19:
3990
+ case 5:
4010
3991
  throw {
4011
3992
  stack: new Error().stack,
4012
3993
  code: "D3138",
4013
3994
  index: i
4014
3995
  };
4015
- case 20:
3996
+ case 6:
4016
3997
  i++;
4017
- _context8.next = 4;
3998
+ _context8.n = 2;
4018
3999
  break;
4019
- case 23:
4000
+ case 7:
4020
4001
  if (hasFoundMatch) {
4021
- _context8.next = 25;
4002
+ _context8.n = 8;
4022
4003
  break;
4023
4004
  }
4024
4005
  throw {
4025
4006
  stack: new Error().stack,
4026
4007
  code: "D3139"
4027
4008
  };
4028
- case 25:
4029
- return _context8.abrupt("return", result);
4030
- case 26:
4031
- case "end":
4032
- return _context8.stop();
4009
+ case 8:
4010
+ return _context8.a(2, result);
4033
4011
  }
4034
4012
  }, _callee8, this);
4035
4013
  }));
@@ -4062,7 +4040,7 @@ var functions = function () {
4062
4040
  * @param {Object} init - Initial value
4063
4041
  * @returns {*} Result
4064
4042
  */
4065
- function foldLeft(_x21, _x22, _x23) {
4043
+ function foldLeft(_x19, _x20, _x21) {
4066
4044
  return _foldLeft.apply(this, arguments);
4067
4045
  }
4068
4046
  /**
@@ -4071,20 +4049,20 @@ var functions = function () {
4071
4049
  * @returns {Array} Array of keys
4072
4050
  */
4073
4051
  function _foldLeft() {
4074
- _foldLeft = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(sequence, func, init) {
4052
+ _foldLeft = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(sequence, func, init) {
4075
4053
  var result, arity, index, args;
4076
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
4077
- while (1) switch (_context9.prev = _context9.next) {
4054
+ return _regenerator().w(function (_context9) {
4055
+ while (1) switch (_context9.n) {
4078
4056
  case 0:
4079
4057
  if (!(typeof sequence === 'undefined')) {
4080
- _context9.next = 2;
4058
+ _context9.n = 1;
4081
4059
  break;
4082
4060
  }
4083
- return _context9.abrupt("return", undefined);
4084
- case 2:
4061
+ return _context9.a(2, undefined);
4062
+ case 1:
4085
4063
  arity = getFunctionArity(func);
4086
4064
  if (!(arity < 2)) {
4087
- _context9.next = 5;
4065
+ _context9.n = 2;
4088
4066
  break;
4089
4067
  }
4090
4068
  throw {
@@ -4092,7 +4070,7 @@ var functions = function () {
4092
4070
  code: "D3050",
4093
4071
  index: 1
4094
4072
  };
4095
- case 5:
4073
+ case 2:
4096
4074
  if (typeof init === 'undefined' && sequence.length > 0) {
4097
4075
  result = sequence[0];
4098
4076
  index = 1;
@@ -4100,9 +4078,9 @@ var functions = function () {
4100
4078
  result = init;
4101
4079
  index = 0;
4102
4080
  }
4103
- case 6:
4081
+ case 3:
4104
4082
  if (!(index < sequence.length)) {
4105
- _context9.next = 16;
4083
+ _context9.n = 5;
4106
4084
  break;
4107
4085
  }
4108
4086
  args = [result, sequence[index]];
@@ -4112,18 +4090,15 @@ var functions = function () {
4112
4090
  if (arity >= 4) {
4113
4091
  args.push(sequence);
4114
4092
  }
4115
- _context9.next = 12;
4093
+ _context9.n = 4;
4116
4094
  return func.apply(this, args);
4117
- case 12:
4118
- result = _context9.sent;
4095
+ case 4:
4096
+ result = _context9.v;
4119
4097
  index++;
4120
- _context9.next = 6;
4098
+ _context9.n = 3;
4121
4099
  break;
4122
- case 16:
4123
- return _context9.abrupt("return", result);
4124
- case 17:
4125
- case "end":
4126
- return _context9.stop();
4100
+ case 5:
4101
+ return _context9.a(2, result);
4127
4102
  }
4128
4103
  }, _callee9, this);
4129
4104
  }));
@@ -4286,7 +4261,7 @@ var functions = function () {
4286
4261
  * @param {*} func - the function to apply to each key/value pair
4287
4262
  * @returns {Array} - the resultant array
4288
4263
  */
4289
- function each(_x24, _x25) {
4264
+ function each(_x22, _x23) {
4290
4265
  return _each.apply(this, arguments);
4291
4266
  }
4292
4267
  /**
@@ -4295,36 +4270,33 @@ var functions = function () {
4295
4270
  * @throws custom error with code 'D3137'
4296
4271
  */
4297
4272
  function _each() {
4298
- _each = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(obj, func) {
4299
- var result, key, func_args, val;
4300
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
4301
- while (1) switch (_context10.prev = _context10.next) {
4273
+ _each = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(obj, func) {
4274
+ var result, key, func_args, val, _t, _t2;
4275
+ return _regenerator().w(function (_context0) {
4276
+ while (1) switch (_context0.n) {
4302
4277
  case 0:
4303
4278
  result = createSequence();
4304
- _context10.t0 = _regeneratorRuntime().keys(obj);
4305
- case 2:
4306
- if ((_context10.t1 = _context10.t0()).done) {
4307
- _context10.next = 11;
4279
+ _t = _regeneratorKeys(obj);
4280
+ case 1:
4281
+ if ((_t2 = _t()).done) {
4282
+ _context0.n = 3;
4308
4283
  break;
4309
4284
  }
4310
- key = _context10.t1.value;
4285
+ key = _t2.value;
4311
4286
  func_args = hofFuncArgs(func, obj[key], key, obj); // invoke func
4312
- _context10.next = 7;
4287
+ _context0.n = 2;
4313
4288
  return func.apply(this, func_args);
4314
- case 7:
4315
- val = _context10.sent;
4289
+ case 2:
4290
+ val = _context0.v;
4316
4291
  if (typeof val !== 'undefined') {
4317
4292
  result.push(val);
4318
4293
  }
4319
- _context10.next = 2;
4294
+ _context0.n = 1;
4320
4295
  break;
4321
- case 11:
4322
- return _context10.abrupt("return", result);
4323
- case 12:
4324
- case "end":
4325
- return _context10.stop();
4296
+ case 3:
4297
+ return _context0.a(2, result);
4326
4298
  }
4327
- }, _callee10, this);
4299
+ }, _callee0, this);
4328
4300
  }));
4329
4301
  return _each.apply(this, arguments);
4330
4302
  }
@@ -4391,7 +4363,7 @@ var functions = function () {
4391
4363
  * @param {*} comparator - comparator function
4392
4364
  * @returns {Array} - sorted array
4393
4365
  */
4394
- function sort(_x26, _x27) {
4366
+ function sort(_x24, _x25) {
4395
4367
  return _sort.apply(this, arguments);
4396
4368
  }
4397
4369
  /**
@@ -4400,29 +4372,29 @@ var functions = function () {
4400
4372
  * @returns {Array} the shuffled array
4401
4373
  */
4402
4374
  function _sort() {
4403
- _sort = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(arr, comparator) {
4375
+ _sort = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(arr, comparator) {
4404
4376
  var comp, merge, _msort, result;
4405
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
4406
- while (1) switch (_context15.prev = _context15.next) {
4377
+ return _regenerator().w(function (_context13) {
4378
+ while (1) switch (_context13.n) {
4407
4379
  case 0:
4408
4380
  if (!(typeof arr === 'undefined')) {
4409
- _context15.next = 2;
4381
+ _context13.n = 1;
4410
4382
  break;
4411
4383
  }
4412
- return _context15.abrupt("return", undefined);
4413
- case 2:
4384
+ return _context13.a(2, undefined);
4385
+ case 1:
4414
4386
  if (!(arr.length <= 1)) {
4415
- _context15.next = 4;
4387
+ _context13.n = 2;
4416
4388
  break;
4417
4389
  }
4418
- return _context15.abrupt("return", arr);
4419
- case 4:
4390
+ return _context13.a(2, arr);
4391
+ case 2:
4420
4392
  if (!(typeof comparator === 'undefined')) {
4421
- _context15.next = 10;
4393
+ _context13.n = 4;
4422
4394
  break;
4423
4395
  }
4424
4396
  if (!(!isArrayOfNumbers(arr) && !isArrayOfStrings(arr))) {
4425
- _context15.next = 7;
4397
+ _context13.n = 3;
4426
4398
  break;
4427
4399
  }
4428
4400
  throw {
@@ -4430,148 +4402,137 @@ var functions = function () {
4430
4402
  code: "D3070",
4431
4403
  index: 1
4432
4404
  };
4433
- case 7:
4405
+ case 3:
4434
4406
  comp = /*#__PURE__*/function () {
4435
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(a, b) {
4436
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
4437
- while (1) switch (_context11.prev = _context11.next) {
4407
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(a, b) {
4408
+ return _regenerator().w(function (_context1) {
4409
+ while (1) switch (_context1.n) {
4438
4410
  case 0:
4439
- return _context11.abrupt("return", a > b);
4440
- case 1:
4441
- case "end":
4442
- return _context11.stop();
4411
+ return _context1.a(2, a > b);
4443
4412
  }
4444
- }, _callee11);
4413
+ }, _callee1);
4445
4414
  }));
4446
- return function comp(_x30, _x31) {
4415
+ return function comp(_x28, _x29) {
4447
4416
  return _ref.apply(this, arguments);
4448
4417
  };
4449
4418
  }();
4450
- _context15.next = 11;
4419
+ _context13.n = 5;
4451
4420
  break;
4452
- case 10:
4421
+ case 4:
4453
4422
  // for internal usage of functionSort (i.e. order-by syntax)
4454
4423
  comp = comparator;
4455
- case 11:
4424
+ case 5:
4456
4425
  merge = /*#__PURE__*/function () {
4457
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(l, r) {
4426
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(l, r) {
4458
4427
  var _merge_iter, merged;
4459
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
4460
- while (1) switch (_context13.prev = _context13.next) {
4428
+ return _regenerator().w(function (_context11) {
4429
+ while (1) switch (_context11.n) {
4461
4430
  case 0:
4462
4431
  _merge_iter = /*#__PURE__*/function () {
4463
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(result, left, right) {
4464
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
4465
- while (1) switch (_context12.prev = _context12.next) {
4432
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(result, left, right) {
4433
+ return _regenerator().w(function (_context10) {
4434
+ while (1) switch (_context10.n) {
4466
4435
  case 0:
4467
4436
  if (!(left.length === 0)) {
4468
- _context12.next = 4;
4437
+ _context10.n = 1;
4469
4438
  break;
4470
4439
  }
4471
4440
  Array.prototype.push.apply(result, right);
4472
- _context12.next = 19;
4441
+ _context10.n = 6;
4473
4442
  break;
4474
- case 4:
4443
+ case 1:
4475
4444
  if (!(right.length === 0)) {
4476
- _context12.next = 8;
4445
+ _context10.n = 2;
4477
4446
  break;
4478
4447
  }
4479
4448
  Array.prototype.push.apply(result, left);
4480
- _context12.next = 19;
4449
+ _context10.n = 6;
4481
4450
  break;
4482
- case 8:
4483
- _context12.next = 10;
4451
+ case 2:
4452
+ _context10.n = 3;
4484
4453
  return comp(left[0], right[0]);
4485
- case 10:
4486
- if (!_context12.sent) {
4487
- _context12.next = 16;
4454
+ case 3:
4455
+ if (!_context10.v) {
4456
+ _context10.n = 5;
4488
4457
  break;
4489
4458
  }
4490
4459
  // invoke the comparator function
4491
4460
  // if it returns true - swap left and right
4492
4461
  result.push(right[0]);
4493
- _context12.next = 14;
4462
+ _context10.n = 4;
4494
4463
  return _merge_iter(result, left, right.slice(1));
4495
- case 14:
4496
- _context12.next = 19;
4464
+ case 4:
4465
+ _context10.n = 6;
4497
4466
  break;
4498
- case 16:
4467
+ case 5:
4499
4468
  // otherwise keep the same order
4500
4469
  result.push(left[0]);
4501
- _context12.next = 19;
4470
+ _context10.n = 6;
4502
4471
  return _merge_iter(result, left.slice(1), right);
4503
- case 19:
4504
- case "end":
4505
- return _context12.stop();
4472
+ case 6:
4473
+ return _context10.a(2);
4506
4474
  }
4507
- }, _callee12);
4475
+ }, _callee10);
4508
4476
  }));
4509
- return function merge_iter(_x34, _x35, _x36) {
4477
+ return function merge_iter(_x32, _x33, _x34) {
4510
4478
  return _ref3.apply(this, arguments);
4511
4479
  };
4512
4480
  }();
4513
4481
  merged = [];
4514
- _context13.next = 4;
4482
+ _context11.n = 1;
4515
4483
  return _merge_iter(merged, l, r);
4516
- case 4:
4517
- return _context13.abrupt("return", merged);
4518
- case 5:
4519
- case "end":
4520
- return _context13.stop();
4484
+ case 1:
4485
+ return _context11.a(2, merged);
4521
4486
  }
4522
- }, _callee13);
4487
+ }, _callee11);
4523
4488
  }));
4524
- return function merge(_x32, _x33) {
4489
+ return function merge(_x30, _x31) {
4525
4490
  return _ref2.apply(this, arguments);
4526
4491
  };
4527
4492
  }();
4528
4493
  _msort = /*#__PURE__*/function () {
4529
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(array) {
4494
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(array) {
4530
4495
  var middle, left, right;
4531
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
4532
- while (1) switch (_context14.prev = _context14.next) {
4496
+ return _regenerator().w(function (_context12) {
4497
+ while (1) switch (_context12.n) {
4533
4498
  case 0:
4534
4499
  if (!(!Array.isArray(array) || array.length <= 1)) {
4535
- _context14.next = 4;
4500
+ _context12.n = 1;
4536
4501
  break;
4537
4502
  }
4538
- return _context14.abrupt("return", array);
4539
- case 4:
4503
+ return _context12.a(2, array);
4504
+ case 1:
4540
4505
  middle = Math.floor(array.length / 2);
4541
4506
  left = array.slice(0, middle);
4542
4507
  right = array.slice(middle);
4543
- _context14.next = 9;
4508
+ _context12.n = 2;
4544
4509
  return _msort(left);
4545
- case 9:
4546
- left = _context14.sent;
4547
- _context14.next = 12;
4510
+ case 2:
4511
+ left = _context12.v;
4512
+ _context12.n = 3;
4548
4513
  return _msort(right);
4549
- case 12:
4550
- right = _context14.sent;
4551
- _context14.next = 15;
4514
+ case 3:
4515
+ right = _context12.v;
4516
+ _context12.n = 4;
4552
4517
  return merge(left, right);
4553
- case 15:
4554
- return _context14.abrupt("return", _context14.sent);
4555
- case 16:
4556
- case "end":
4557
- return _context14.stop();
4518
+ case 4:
4519
+ return _context12.a(2, _context12.v);
4520
+ case 5:
4521
+ return _context12.a(2);
4558
4522
  }
4559
- }, _callee14);
4523
+ }, _callee12);
4560
4524
  }));
4561
- return function msort(_x37) {
4525
+ return function msort(_x35) {
4562
4526
  return _ref4.apply(this, arguments);
4563
4527
  };
4564
4528
  }();
4565
- _context15.next = 15;
4529
+ _context13.n = 6;
4566
4530
  return _msort(arr);
4567
- case 15:
4568
- result = _context15.sent;
4569
- return _context15.abrupt("return", result);
4570
- case 17:
4571
- case "end":
4572
- return _context15.stop();
4531
+ case 6:
4532
+ result = _context13.v;
4533
+ return _context13.a(2, result);
4573
4534
  }
4574
- }, _callee15);
4535
+ }, _callee13);
4575
4536
  }));
4576
4537
  return _sort.apply(this, arguments);
4577
4538
  }
@@ -4635,45 +4596,42 @@ var functions = function () {
4635
4596
  * @param {object} func - the predicate function (lambda or native)
4636
4597
  * @returns {object} - sifted object
4637
4598
  */
4638
- function sift(_x28, _x29) {
4599
+ function sift(_x26, _x27) {
4639
4600
  return _sift.apply(this, arguments);
4640
4601
  }
4641
4602
  function _sift() {
4642
- _sift = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(arg, func) {
4643
- var result, item, entry, func_args, res;
4644
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
4645
- while (1) switch (_context16.prev = _context16.next) {
4603
+ _sift = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(arg, func) {
4604
+ var result, item, entry, func_args, res, _t3, _t4;
4605
+ return _regenerator().w(function (_context14) {
4606
+ while (1) switch (_context14.n) {
4646
4607
  case 0:
4647
4608
  result = {};
4648
- _context16.t0 = _regeneratorRuntime().keys(arg);
4649
- case 2:
4650
- if ((_context16.t1 = _context16.t0()).done) {
4651
- _context16.next = 12;
4609
+ _t3 = _regeneratorKeys(arg);
4610
+ case 1:
4611
+ if ((_t4 = _t3()).done) {
4612
+ _context14.n = 3;
4652
4613
  break;
4653
4614
  }
4654
- item = _context16.t1.value;
4615
+ item = _t4.value;
4655
4616
  entry = arg[item];
4656
4617
  func_args = hofFuncArgs(func, entry, item, arg); // invoke func
4657
- _context16.next = 8;
4618
+ _context14.n = 2;
4658
4619
  return func.apply(this, func_args);
4659
- case 8:
4660
- res = _context16.sent;
4620
+ case 2:
4621
+ res = _context14.v;
4661
4622
  if (_boolean(res)) {
4662
4623
  result[item] = entry;
4663
4624
  }
4664
- _context16.next = 2;
4625
+ _context14.n = 1;
4665
4626
  break;
4666
- case 12:
4627
+ case 3:
4667
4628
  // empty objects should be changed to undefined
4668
4629
  if (Object.keys(result).length === 0) {
4669
4630
  result = undefined;
4670
4631
  }
4671
- return _context16.abrupt("return", result);
4672
- case 14:
4673
- case "end":
4674
- return _context16.stop();
4632
+ return _context14.a(2, result);
4675
4633
  }
4676
- }, _callee16, this);
4634
+ }, _callee14, this);
4677
4635
  }));
4678
4636
  return _sift.apply(this, arguments);
4679
4637
  }
@@ -4742,6 +4700,7 @@ module.exports = functions;
4742
4700
  },{"./utils":6}],3:[function(require,module,exports){
4743
4701
  "use strict";
4744
4702
 
4703
+ function _regeneratorValues(e) { if (null != e) { var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"], r = 0; if (t) return t.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) return { next: function next() { return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e }; } }; } throw new TypeError(_typeof(e) + " is not iterable"); }
4745
4704
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
4746
4705
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4747
4706
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
@@ -4749,7 +4708,8 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
4749
4708
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
4750
4709
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4751
4710
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
4752
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
4711
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
4712
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
4753
4713
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4754
4714
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
4755
4715
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
@@ -4813,140 +4773,140 @@ var jsonata = function () {
4813
4773
  * @returns {*} Evaluated input data
4814
4774
  */
4815
4775
  function _evaluate() {
4816
- _evaluate = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(expr, input, environment) {
4817
- var result, entryCallback, ii, exitCallback;
4818
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
4819
- while (1) switch (_context4.prev = _context4.next) {
4776
+ _evaluate = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(expr, input, environment) {
4777
+ var result, entryCallback, ii, exitCallback, _t2;
4778
+ return _regenerator().w(function (_context4) {
4779
+ while (1) switch (_context4.n) {
4820
4780
  case 0:
4821
4781
  entryCallback = environment.lookup(Symbol["for"]('jsonata.__evaluate_entry'));
4822
4782
  if (!entryCallback) {
4823
- _context4.next = 4;
4783
+ _context4.n = 1;
4824
4784
  break;
4825
4785
  }
4826
- _context4.next = 4;
4786
+ _context4.n = 1;
4827
4787
  return entryCallback(expr, input, environment);
4828
- case 4:
4829
- _context4.t0 = expr.type;
4830
- _context4.next = _context4.t0 === 'path' ? 7 : _context4.t0 === 'binary' ? 11 : _context4.t0 === 'unary' ? 15 : _context4.t0 === 'name' ? 19 : _context4.t0 === 'string' ? 21 : _context4.t0 === 'number' ? 21 : _context4.t0 === 'value' ? 21 : _context4.t0 === 'wildcard' ? 23 : _context4.t0 === 'descendant' ? 25 : _context4.t0 === 'parent' ? 27 : _context4.t0 === 'condition' ? 29 : _context4.t0 === 'block' ? 33 : _context4.t0 === 'bind' ? 37 : _context4.t0 === 'regex' ? 41 : _context4.t0 === 'function' ? 43 : _context4.t0 === 'variable' ? 47 : _context4.t0 === 'lambda' ? 49 : _context4.t0 === 'partial' ? 51 : _context4.t0 === 'apply' ? 55 : _context4.t0 === 'transform' ? 59 : 61;
4788
+ case 1:
4789
+ _t2 = expr.type;
4790
+ _context4.n = _t2 === 'path' ? 2 : _t2 === 'binary' ? 4 : _t2 === 'unary' ? 6 : _t2 === 'name' ? 8 : _t2 === 'string' ? 9 : _t2 === 'number' ? 9 : _t2 === 'value' ? 9 : _t2 === 'wildcard' ? 10 : _t2 === 'descendant' ? 11 : _t2 === 'parent' ? 12 : _t2 === 'condition' ? 13 : _t2 === 'block' ? 15 : _t2 === 'bind' ? 17 : _t2 === 'regex' ? 19 : _t2 === 'function' ? 20 : _t2 === 'variable' ? 22 : _t2 === 'lambda' ? 23 : _t2 === 'partial' ? 24 : _t2 === 'apply' ? 26 : _t2 === 'transform' ? 28 : 29;
4831
4791
  break;
4832
- case 7:
4833
- _context4.next = 9;
4792
+ case 2:
4793
+ _context4.n = 3;
4834
4794
  return evaluatePath(expr, input, environment);
4835
- case 9:
4836
- result = _context4.sent;
4837
- return _context4.abrupt("break", 61);
4838
- case 11:
4839
- _context4.next = 13;
4795
+ case 3:
4796
+ result = _context4.v;
4797
+ return _context4.a(3, 29);
4798
+ case 4:
4799
+ _context4.n = 5;
4840
4800
  return evaluateBinary(expr, input, environment);
4841
- case 13:
4842
- result = _context4.sent;
4843
- return _context4.abrupt("break", 61);
4844
- case 15:
4845
- _context4.next = 17;
4801
+ case 5:
4802
+ result = _context4.v;
4803
+ return _context4.a(3, 29);
4804
+ case 6:
4805
+ _context4.n = 7;
4846
4806
  return evaluateUnary(expr, input, environment);
4847
- case 17:
4848
- result = _context4.sent;
4849
- return _context4.abrupt("break", 61);
4850
- case 19:
4807
+ case 7:
4808
+ result = _context4.v;
4809
+ return _context4.a(3, 29);
4810
+ case 8:
4851
4811
  result = evaluateName(expr, input, environment);
4852
- return _context4.abrupt("break", 61);
4853
- case 21:
4812
+ return _context4.a(3, 29);
4813
+ case 9:
4854
4814
  result = evaluateLiteral(expr, input, environment);
4855
- return _context4.abrupt("break", 61);
4856
- case 23:
4815
+ return _context4.a(3, 29);
4816
+ case 10:
4857
4817
  result = evaluateWildcard(expr, input, environment);
4858
- return _context4.abrupt("break", 61);
4859
- case 25:
4818
+ return _context4.a(3, 29);
4819
+ case 11:
4860
4820
  result = evaluateDescendants(expr, input, environment);
4861
- return _context4.abrupt("break", 61);
4862
- case 27:
4821
+ return _context4.a(3, 29);
4822
+ case 12:
4863
4823
  result = environment.lookup(expr.slot.label);
4864
- return _context4.abrupt("break", 61);
4865
- case 29:
4866
- _context4.next = 31;
4824
+ return _context4.a(3, 29);
4825
+ case 13:
4826
+ _context4.n = 14;
4867
4827
  return evaluateCondition(expr, input, environment);
4868
- case 31:
4869
- result = _context4.sent;
4870
- return _context4.abrupt("break", 61);
4871
- case 33:
4872
- _context4.next = 35;
4828
+ case 14:
4829
+ result = _context4.v;
4830
+ return _context4.a(3, 29);
4831
+ case 15:
4832
+ _context4.n = 16;
4873
4833
  return evaluateBlock(expr, input, environment);
4874
- case 35:
4875
- result = _context4.sent;
4876
- return _context4.abrupt("break", 61);
4877
- case 37:
4878
- _context4.next = 39;
4834
+ case 16:
4835
+ result = _context4.v;
4836
+ return _context4.a(3, 29);
4837
+ case 17:
4838
+ _context4.n = 18;
4879
4839
  return evaluateBindExpression(expr, input, environment);
4880
- case 39:
4881
- result = _context4.sent;
4882
- return _context4.abrupt("break", 61);
4883
- case 41:
4840
+ case 18:
4841
+ result = _context4.v;
4842
+ return _context4.a(3, 29);
4843
+ case 19:
4884
4844
  result = evaluateRegex(expr, input, environment);
4885
- return _context4.abrupt("break", 61);
4886
- case 43:
4887
- _context4.next = 45;
4845
+ return _context4.a(3, 29);
4846
+ case 20:
4847
+ _context4.n = 21;
4888
4848
  return evaluateFunction(expr, input, environment);
4889
- case 45:
4890
- result = _context4.sent;
4891
- return _context4.abrupt("break", 61);
4892
- case 47:
4849
+ case 21:
4850
+ result = _context4.v;
4851
+ return _context4.a(3, 29);
4852
+ case 22:
4893
4853
  result = evaluateVariable(expr, input, environment);
4894
- return _context4.abrupt("break", 61);
4895
- case 49:
4854
+ return _context4.a(3, 29);
4855
+ case 23:
4896
4856
  result = evaluateLambda(expr, input, environment);
4897
- return _context4.abrupt("break", 61);
4898
- case 51:
4899
- _context4.next = 53;
4857
+ return _context4.a(3, 29);
4858
+ case 24:
4859
+ _context4.n = 25;
4900
4860
  return evaluatePartialApplication(expr, input, environment);
4901
- case 53:
4902
- result = _context4.sent;
4903
- return _context4.abrupt("break", 61);
4904
- case 55:
4905
- _context4.next = 57;
4861
+ case 25:
4862
+ result = _context4.v;
4863
+ return _context4.a(3, 29);
4864
+ case 26:
4865
+ _context4.n = 27;
4906
4866
  return evaluateApplyExpression(expr, input, environment);
4907
- case 57:
4908
- result = _context4.sent;
4909
- return _context4.abrupt("break", 61);
4910
- case 59:
4867
+ case 27:
4868
+ result = _context4.v;
4869
+ return _context4.a(3, 29);
4870
+ case 28:
4911
4871
  result = evaluateTransformExpression(expr, input, environment);
4912
- return _context4.abrupt("break", 61);
4913
- case 61:
4872
+ return _context4.a(3, 29);
4873
+ case 29:
4914
4874
  if (!Object.prototype.hasOwnProperty.call(expr, 'predicate')) {
4915
- _context4.next = 70;
4875
+ _context4.n = 33;
4916
4876
  break;
4917
4877
  }
4918
4878
  ii = 0;
4919
- case 63:
4879
+ case 30:
4920
4880
  if (!(ii < expr.predicate.length)) {
4921
- _context4.next = 70;
4881
+ _context4.n = 33;
4922
4882
  break;
4923
4883
  }
4924
- _context4.next = 66;
4884
+ _context4.n = 31;
4925
4885
  return evaluateFilter(expr.predicate[ii].expr, result, environment);
4926
- case 66:
4927
- result = _context4.sent;
4928
- case 67:
4886
+ case 31:
4887
+ result = _context4.v;
4888
+ case 32:
4929
4889
  ii++;
4930
- _context4.next = 63;
4890
+ _context4.n = 30;
4931
4891
  break;
4932
- case 70:
4892
+ case 33:
4933
4893
  if (!(expr.type !== 'path' && Object.prototype.hasOwnProperty.call(expr, 'group'))) {
4934
- _context4.next = 74;
4894
+ _context4.n = 35;
4935
4895
  break;
4936
4896
  }
4937
- _context4.next = 73;
4897
+ _context4.n = 34;
4938
4898
  return evaluateGroupExpression(expr.group, result, environment);
4939
- case 73:
4940
- result = _context4.sent;
4941
- case 74:
4899
+ case 34:
4900
+ result = _context4.v;
4901
+ case 35:
4942
4902
  exitCallback = environment.lookup(Symbol["for"]('jsonata.__evaluate_exit'));
4943
4903
  if (!exitCallback) {
4944
- _context4.next = 78;
4904
+ _context4.n = 36;
4945
4905
  break;
4946
4906
  }
4947
- _context4.next = 78;
4907
+ _context4.n = 36;
4948
4908
  return exitCallback(expr, input, environment, result);
4949
- case 78:
4909
+ case 36:
4950
4910
  if (result && isSequence(result) && !result.tupleStream) {
4951
4911
  if (expr.keepArray) {
4952
4912
  result.keepSingleton = true;
@@ -4957,10 +4917,7 @@ var jsonata = function () {
4957
4917
  result = result.keepSingleton ? result : result[0];
4958
4918
  }
4959
4919
  }
4960
- return _context4.abrupt("return", result);
4961
- case 80:
4962
- case "end":
4963
- return _context4.stop();
4920
+ return _context4.a(2, result);
4964
4921
  }
4965
4922
  }, _callee4);
4966
4923
  }));
@@ -4970,10 +4927,10 @@ var jsonata = function () {
4970
4927
  return _evaluatePath.apply(this, arguments);
4971
4928
  }
4972
4929
  function _evaluatePath() {
4973
- _evaluatePath = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(expr, input, environment) {
4930
+ _evaluatePath = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(expr, input, environment) {
4974
4931
  var inputSequence, resultSequence, isTupleStream, tupleBindings, ii, step;
4975
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
4976
- while (1) switch (_context5.prev = _context5.next) {
4932
+ return _regenerator().w(function (_context5) {
4933
+ while (1) switch (_context5.n) {
4977
4934
  case 0:
4978
4935
  // expr is an array of steps
4979
4936
  // if the first step is a variable reference ($...), including root reference ($$),
@@ -4987,9 +4944,9 @@ var jsonata = function () {
4987
4944
  isTupleStream = false;
4988
4945
  tupleBindings = undefined; // evaluate each step in turn
4989
4946
  ii = 0;
4990
- case 4:
4947
+ case 1:
4991
4948
  if (!(ii < expr.steps.length)) {
4992
- _context5.next = 28;
4949
+ _context5.n = 10;
4993
4950
  break;
4994
4951
  }
4995
4952
  step = expr.steps[ii];
@@ -4999,46 +4956,46 @@ var jsonata = function () {
4999
4956
 
5000
4957
  // if the first step is an explicit array constructor, then just evaluate that (i.e. don't iterate over a context array)
5001
4958
  if (!(ii === 0 && step.consarray)) {
5002
- _context5.next = 13;
4959
+ _context5.n = 3;
5003
4960
  break;
5004
4961
  }
5005
- _context5.next = 10;
4962
+ _context5.n = 2;
5006
4963
  return _evaluate2(step, inputSequence, environment);
5007
- case 10:
5008
- resultSequence = _context5.sent;
5009
- _context5.next = 22;
4964
+ case 2:
4965
+ resultSequence = _context5.v;
4966
+ _context5.n = 7;
5010
4967
  break;
5011
- case 13:
4968
+ case 3:
5012
4969
  if (!isTupleStream) {
5013
- _context5.next = 19;
4970
+ _context5.n = 5;
5014
4971
  break;
5015
4972
  }
5016
- _context5.next = 16;
4973
+ _context5.n = 4;
5017
4974
  return evaluateTupleStep(step, inputSequence, tupleBindings, environment);
5018
- case 16:
5019
- tupleBindings = _context5.sent;
5020
- _context5.next = 22;
4975
+ case 4:
4976
+ tupleBindings = _context5.v;
4977
+ _context5.n = 7;
5021
4978
  break;
5022
- case 19:
5023
- _context5.next = 21;
4979
+ case 5:
4980
+ _context5.n = 6;
5024
4981
  return evaluateStep(step, inputSequence, environment, ii === expr.steps.length - 1);
5025
- case 21:
5026
- resultSequence = _context5.sent;
5027
- case 22:
4982
+ case 6:
4983
+ resultSequence = _context5.v;
4984
+ case 7:
5028
4985
  if (!(!isTupleStream && (typeof resultSequence === 'undefined' || resultSequence.length === 0))) {
5029
- _context5.next = 24;
4986
+ _context5.n = 8;
5030
4987
  break;
5031
4988
  }
5032
- return _context5.abrupt("break", 28);
5033
- case 24:
4989
+ return _context5.a(3, 10);
4990
+ case 8:
5034
4991
  if (typeof step.focus === 'undefined') {
5035
4992
  inputSequence = resultSequence;
5036
4993
  }
5037
- case 25:
4994
+ case 9:
5038
4995
  ii++;
5039
- _context5.next = 4;
4996
+ _context5.n = 1;
5040
4997
  break;
5041
- case 28:
4998
+ case 10:
5042
4999
  if (isTupleStream) {
5043
5000
  if (expr.tuple) {
5044
5001
  // tuple stream is carrying ancestry information - keep this
@@ -5058,18 +5015,15 @@ var jsonata = function () {
5058
5015
  resultSequence.keepSingleton = true;
5059
5016
  }
5060
5017
  if (!expr.hasOwnProperty('group')) {
5061
- _context5.next = 34;
5018
+ _context5.n = 12;
5062
5019
  break;
5063
5020
  }
5064
- _context5.next = 33;
5021
+ _context5.n = 11;
5065
5022
  return evaluateGroupExpression(expr.group, isTupleStream ? tupleBindings : resultSequence, environment);
5066
- case 33:
5067
- resultSequence = _context5.sent;
5068
- case 34:
5069
- return _context5.abrupt("return", resultSequence);
5070
- case 35:
5071
- case "end":
5072
- return _context5.stop();
5023
+ case 11:
5024
+ resultSequence = _context5.v;
5025
+ case 12:
5026
+ return _context5.a(2, resultSequence);
5073
5027
  }
5074
5028
  }, _callee5);
5075
5029
  }));
@@ -5091,72 +5045,72 @@ var jsonata = function () {
5091
5045
  * @param {boolean} lastStep - flag the last step in a path
5092
5046
  * @returns {*} Evaluated input data
5093
5047
  */
5094
- function evaluateStep(_x7, _x8, _x9, _x10) {
5048
+ function evaluateStep(_x7, _x8, _x9, _x0) {
5095
5049
  return _evaluateStep.apply(this, arguments);
5096
5050
  }
5097
5051
  function _evaluateStep() {
5098
- _evaluateStep = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(expr, input, environment, lastStep) {
5052
+ _evaluateStep = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(expr, input, environment, lastStep) {
5099
5053
  var result, ii, res, ss, resultSequence;
5100
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
5101
- while (1) switch (_context6.prev = _context6.next) {
5054
+ return _regenerator().w(function (_context6) {
5055
+ while (1) switch (_context6.n) {
5102
5056
  case 0:
5103
5057
  if (!(expr.type === 'sort')) {
5104
- _context6.next = 9;
5058
+ _context6.n = 4;
5105
5059
  break;
5106
5060
  }
5107
- _context6.next = 3;
5061
+ _context6.n = 1;
5108
5062
  return evaluateSortExpression(expr, input, environment);
5109
- case 3:
5110
- result = _context6.sent;
5063
+ case 1:
5064
+ result = _context6.v;
5111
5065
  if (!expr.stages) {
5112
- _context6.next = 8;
5066
+ _context6.n = 3;
5113
5067
  break;
5114
5068
  }
5115
- _context6.next = 7;
5069
+ _context6.n = 2;
5116
5070
  return evaluateStages(expr.stages, result, environment);
5117
- case 7:
5118
- result = _context6.sent;
5119
- case 8:
5120
- return _context6.abrupt("return", result);
5121
- case 9:
5071
+ case 2:
5072
+ result = _context6.v;
5073
+ case 3:
5074
+ return _context6.a(2, result);
5075
+ case 4:
5122
5076
  result = createSequence();
5123
5077
  ii = 0;
5124
- case 11:
5078
+ case 5:
5125
5079
  if (!(ii < input.length)) {
5126
- _context6.next = 28;
5080
+ _context6.n = 12;
5127
5081
  break;
5128
5082
  }
5129
- _context6.next = 14;
5083
+ _context6.n = 6;
5130
5084
  return _evaluate2(expr, input[ii], environment);
5131
- case 14:
5132
- res = _context6.sent;
5085
+ case 6:
5086
+ res = _context6.v;
5133
5087
  if (!expr.stages) {
5134
- _context6.next = 24;
5088
+ _context6.n = 10;
5135
5089
  break;
5136
5090
  }
5137
5091
  ss = 0;
5138
- case 17:
5092
+ case 7:
5139
5093
  if (!(ss < expr.stages.length)) {
5140
- _context6.next = 24;
5094
+ _context6.n = 10;
5141
5095
  break;
5142
5096
  }
5143
- _context6.next = 20;
5097
+ _context6.n = 8;
5144
5098
  return evaluateFilter(expr.stages[ss].expr, res, environment);
5145
- case 20:
5146
- res = _context6.sent;
5147
- case 21:
5099
+ case 8:
5100
+ res = _context6.v;
5101
+ case 9:
5148
5102
  ss++;
5149
- _context6.next = 17;
5103
+ _context6.n = 7;
5150
5104
  break;
5151
- case 24:
5105
+ case 10:
5152
5106
  if (typeof res !== 'undefined') {
5153
5107
  result.push(res);
5154
5108
  }
5155
- case 25:
5109
+ case 11:
5156
5110
  ii++;
5157
- _context6.next = 11;
5111
+ _context6.n = 5;
5158
5112
  break;
5159
- case 28:
5113
+ case 12:
5160
5114
  resultSequence = createSequence();
5161
5115
  if (lastStep && result.length === 1 && Array.isArray(result[0]) && !isSequence(result[0])) {
5162
5116
  resultSequence = result[0];
@@ -5174,16 +5128,13 @@ var jsonata = function () {
5174
5128
  }
5175
5129
  });
5176
5130
  }
5177
- return _context6.abrupt("return", resultSequence);
5178
- case 31:
5179
- case "end":
5180
- return _context6.stop();
5131
+ return _context6.a(2, resultSequence);
5181
5132
  }
5182
5133
  }, _callee6);
5183
5134
  }));
5184
5135
  return _evaluateStep.apply(this, arguments);
5185
5136
  }
5186
- function evaluateStages(_x11, _x12, _x13) {
5137
+ function evaluateStages(_x1, _x10, _x11) {
5187
5138
  return _evaluateStages.apply(this, arguments);
5188
5139
  }
5189
5140
  /**
@@ -5195,49 +5146,46 @@ var jsonata = function () {
5195
5146
  * @returns {*} Evaluated input data
5196
5147
  */
5197
5148
  function _evaluateStages() {
5198
- _evaluateStages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(stages, input, environment) {
5199
- var result, ss, stage, ee, tuple;
5200
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
5201
- while (1) switch (_context7.prev = _context7.next) {
5149
+ _evaluateStages = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(stages, input, environment) {
5150
+ var result, ss, stage, ee, tuple, _t3;
5151
+ return _regenerator().w(function (_context7) {
5152
+ while (1) switch (_context7.n) {
5202
5153
  case 0:
5203
5154
  result = input;
5204
5155
  ss = 0;
5205
- case 2:
5156
+ case 1:
5206
5157
  if (!(ss < stages.length)) {
5207
- _context7.next = 16;
5158
+ _context7.n = 6;
5208
5159
  break;
5209
5160
  }
5210
5161
  stage = stages[ss];
5211
- _context7.t0 = stage.type;
5212
- _context7.next = _context7.t0 === 'filter' ? 7 : _context7.t0 === 'index' ? 11 : 13;
5162
+ _t3 = stage.type;
5163
+ _context7.n = _t3 === 'filter' ? 2 : _t3 === 'index' ? 4 : 5;
5213
5164
  break;
5214
- case 7:
5215
- _context7.next = 9;
5165
+ case 2:
5166
+ _context7.n = 3;
5216
5167
  return evaluateFilter(stage.expr, result, environment);
5217
- case 9:
5218
- result = _context7.sent;
5219
- return _context7.abrupt("break", 13);
5220
- case 11:
5168
+ case 3:
5169
+ result = _context7.v;
5170
+ return _context7.a(3, 5);
5171
+ case 4:
5221
5172
  for (ee = 0; ee < result.length; ee++) {
5222
5173
  tuple = result[ee];
5223
5174
  tuple[stage.value] = ee;
5224
5175
  }
5225
- return _context7.abrupt("break", 13);
5226
- case 13:
5176
+ return _context7.a(3, 5);
5177
+ case 5:
5227
5178
  ss++;
5228
- _context7.next = 2;
5179
+ _context7.n = 1;
5229
5180
  break;
5230
- case 16:
5231
- return _context7.abrupt("return", result);
5232
- case 17:
5233
- case "end":
5234
- return _context7.stop();
5181
+ case 6:
5182
+ return _context7.a(2, result);
5235
5183
  }
5236
5184
  }, _callee7);
5237
5185
  }));
5238
5186
  return _evaluateStages.apply(this, arguments);
5239
5187
  }
5240
- function evaluateTupleStep(_x14, _x15, _x16, _x17) {
5188
+ function evaluateTupleStep(_x12, _x13, _x14, _x15) {
5241
5189
  return _evaluateTupleStep.apply(this, arguments);
5242
5190
  }
5243
5191
  /**
@@ -5248,30 +5196,30 @@ var jsonata = function () {
5248
5196
  * @returns {*} Result after applying predicates
5249
5197
  */
5250
5198
  function _evaluateTupleStep() {
5251
- _evaluateTupleStep = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(expr, input, tupleBindings, environment) {
5199
+ _evaluateTupleStep = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(expr, input, tupleBindings, environment) {
5252
5200
  var result, sorted, ss, tuple, stepEnv, ee, res, bb;
5253
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
5254
- while (1) switch (_context8.prev = _context8.next) {
5201
+ return _regenerator().w(function (_context8) {
5202
+ while (1) switch (_context8.n) {
5255
5203
  case 0:
5256
5204
  if (!(expr.type === 'sort')) {
5257
- _context8.next = 18;
5205
+ _context8.n = 7;
5258
5206
  break;
5259
5207
  }
5260
5208
  if (!tupleBindings) {
5261
- _context8.next = 7;
5209
+ _context8.n = 2;
5262
5210
  break;
5263
5211
  }
5264
- _context8.next = 4;
5212
+ _context8.n = 1;
5265
5213
  return evaluateSortExpression(expr, tupleBindings, environment);
5266
- case 4:
5267
- result = _context8.sent;
5268
- _context8.next = 13;
5214
+ case 1:
5215
+ result = _context8.v;
5216
+ _context8.n = 4;
5269
5217
  break;
5270
- case 7:
5271
- _context8.next = 9;
5218
+ case 2:
5219
+ _context8.n = 3;
5272
5220
  return evaluateSortExpression(expr, input, environment);
5273
- case 9:
5274
- sorted = _context8.sent;
5221
+ case 3:
5222
+ sorted = _context8.v;
5275
5223
  result = createSequence();
5276
5224
  result.tupleStream = true;
5277
5225
  for (ss = 0; ss < sorted.length; ss++) {
@@ -5281,18 +5229,18 @@ var jsonata = function () {
5281
5229
  tuple[expr.index] = ss;
5282
5230
  result.push(tuple);
5283
5231
  }
5284
- case 13:
5232
+ case 4:
5285
5233
  if (!expr.stages) {
5286
- _context8.next = 17;
5234
+ _context8.n = 6;
5287
5235
  break;
5288
5236
  }
5289
- _context8.next = 16;
5237
+ _context8.n = 5;
5290
5238
  return evaluateStages(expr.stages, result, environment);
5291
- case 16:
5292
- result = _context8.sent;
5293
- case 17:
5294
- return _context8.abrupt("return", result);
5295
- case 18:
5239
+ case 5:
5240
+ result = _context8.v;
5241
+ case 6:
5242
+ return _context8.a(2, result);
5243
+ case 7:
5296
5244
  result = createSequence();
5297
5245
  result.tupleStream = true;
5298
5246
  stepEnv = environment;
@@ -5304,16 +5252,16 @@ var jsonata = function () {
5304
5252
  });
5305
5253
  }
5306
5254
  ee = 0;
5307
- case 23:
5255
+ case 8:
5308
5256
  if (!(ee < tupleBindings.length)) {
5309
- _context8.next = 32;
5257
+ _context8.n = 11;
5310
5258
  break;
5311
5259
  }
5312
5260
  stepEnv = createFrameFromTuple(environment, tupleBindings[ee]);
5313
- _context8.next = 27;
5261
+ _context8.n = 9;
5314
5262
  return _evaluate2(expr, tupleBindings[ee]['@'], stepEnv);
5315
- case 27:
5316
- res = _context8.sent;
5263
+ case 9:
5264
+ res = _context8.v;
5317
5265
  // res is the binding sequence for the output tuple stream
5318
5266
  if (typeof res !== 'undefined') {
5319
5267
  if (!Array.isArray(res)) {
@@ -5341,30 +5289,27 @@ var jsonata = function () {
5341
5289
  result.push(tuple);
5342
5290
  }
5343
5291
  }
5344
- case 29:
5292
+ case 10:
5345
5293
  ee++;
5346
- _context8.next = 23;
5294
+ _context8.n = 8;
5347
5295
  break;
5348
- case 32:
5296
+ case 11:
5349
5297
  if (!expr.stages) {
5350
- _context8.next = 36;
5298
+ _context8.n = 13;
5351
5299
  break;
5352
5300
  }
5353
- _context8.next = 35;
5301
+ _context8.n = 12;
5354
5302
  return evaluateStages(expr.stages, result, environment);
5355
- case 35:
5356
- result = _context8.sent;
5357
- case 36:
5358
- return _context8.abrupt("return", result);
5359
- case 37:
5360
- case "end":
5361
- return _context8.stop();
5303
+ case 12:
5304
+ result = _context8.v;
5305
+ case 13:
5306
+ return _context8.a(2, result);
5362
5307
  }
5363
5308
  }, _callee8);
5364
5309
  }));
5365
5310
  return _evaluateTupleStep.apply(this, arguments);
5366
5311
  }
5367
- function evaluateFilter(_x18, _x19, _x20) {
5312
+ function evaluateFilter(_x16, _x17, _x18) {
5368
5313
  return _evaluateFilter.apply(this, arguments);
5369
5314
  }
5370
5315
  /**
@@ -5375,10 +5320,10 @@ var jsonata = function () {
5375
5320
  * @returns {*} Evaluated input data
5376
5321
  */
5377
5322
  function _evaluateFilter() {
5378
- _evaluateFilter = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(predicate, input, environment) {
5323
+ _evaluateFilter = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(predicate, input, environment) {
5379
5324
  var results, index, item, context, env, res;
5380
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
5381
- while (1) switch (_context9.prev = _context9.next) {
5325
+ return _regenerator().w(function (_context9) {
5326
+ while (1) switch (_context9.n) {
5382
5327
  case 0:
5383
5328
  results = createSequence();
5384
5329
  if (input && input.tupleStream) {
@@ -5388,7 +5333,7 @@ var jsonata = function () {
5388
5333
  input = createSequence(input);
5389
5334
  }
5390
5335
  if (!(predicate.type === 'number')) {
5391
- _context9.next = 10;
5336
+ _context9.n = 2;
5392
5337
  break;
5393
5338
  }
5394
5339
  index = Math.floor(predicate.value); // round it down
@@ -5396,7 +5341,10 @@ var jsonata = function () {
5396
5341
  // count in from end of array
5397
5342
  index = input.length + index;
5398
5343
  }
5399
- item = input[index];
5344
+ _context9.n = 1;
5345
+ return input[index];
5346
+ case 1:
5347
+ item = _context9.v;
5400
5348
  if (typeof item !== 'undefined') {
5401
5349
  if (Array.isArray(item)) {
5402
5350
  results = item;
@@ -5404,13 +5352,13 @@ var jsonata = function () {
5404
5352
  results.push(item);
5405
5353
  }
5406
5354
  }
5407
- _context9.next = 24;
5355
+ _context9.n = 6;
5408
5356
  break;
5409
- case 10:
5357
+ case 2:
5410
5358
  index = 0;
5411
- case 11:
5359
+ case 3:
5412
5360
  if (!(index < input.length)) {
5413
- _context9.next = 24;
5361
+ _context9.n = 6;
5414
5362
  break;
5415
5363
  }
5416
5364
  item = input[index];
@@ -5420,10 +5368,10 @@ var jsonata = function () {
5420
5368
  context = item['@'];
5421
5369
  env = createFrameFromTuple(environment, item);
5422
5370
  }
5423
- _context9.next = 18;
5371
+ _context9.n = 4;
5424
5372
  return _evaluate2(predicate, context, env);
5425
- case 18:
5426
- res = _context9.sent;
5373
+ case 4:
5374
+ res = _context9.v;
5427
5375
  if (isNumeric(res)) {
5428
5376
  res = [res];
5429
5377
  }
@@ -5443,21 +5391,18 @@ var jsonata = function () {
5443
5391
  // truthy
5444
5392
  results.push(item);
5445
5393
  }
5446
- case 21:
5394
+ case 5:
5447
5395
  index++;
5448
- _context9.next = 11;
5396
+ _context9.n = 3;
5449
5397
  break;
5450
- case 24:
5451
- return _context9.abrupt("return", results);
5452
- case 25:
5453
- case "end":
5454
- return _context9.stop();
5398
+ case 6:
5399
+ return _context9.a(2, results);
5455
5400
  }
5456
5401
  }, _callee9);
5457
5402
  }));
5458
5403
  return _evaluateFilter.apply(this, arguments);
5459
5404
  }
5460
- function evaluateBinary(_x21, _x22, _x23) {
5405
+ function evaluateBinary(_x19, _x20, _x21) {
5461
5406
  return _evaluateBinary.apply(this, arguments);
5462
5407
  }
5463
5408
  /**
@@ -5468,97 +5413,91 @@ var jsonata = function () {
5468
5413
  * @returns {*} Evaluated input data
5469
5414
  */
5470
5415
  function _evaluateBinary() {
5471
- _evaluateBinary = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(expr, input, environment) {
5472
- var result, lhs, op, evalrhs, rhs;
5473
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
5474
- while (1) switch (_context11.prev = _context11.next) {
5416
+ _evaluateBinary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(expr, input, environment) {
5417
+ var result, lhs, op, evalrhs, rhs, _t4, _t5, _t6;
5418
+ return _regenerator().w(function (_context1) {
5419
+ while (1) switch (_context1.p = _context1.n) {
5475
5420
  case 0:
5476
- _context11.next = 2;
5421
+ _context1.n = 1;
5477
5422
  return _evaluate2(expr.lhs, input, environment);
5478
- case 2:
5479
- lhs = _context11.sent;
5423
+ case 1:
5424
+ lhs = _context1.v;
5480
5425
  op = expr.value; //defer evaluation of RHS to allow short-circuiting
5481
5426
  evalrhs = /*#__PURE__*/function () {
5482
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
5483
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
5484
- while (1) switch (_context10.prev = _context10.next) {
5427
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
5428
+ return _regenerator().w(function (_context0) {
5429
+ while (1) switch (_context0.n) {
5485
5430
  case 0:
5486
- _context10.next = 2;
5431
+ _context0.n = 1;
5487
5432
  return _evaluate2(expr.rhs, input, environment);
5488
- case 2:
5489
- return _context10.abrupt("return", _context10.sent);
5490
- case 3:
5491
- case "end":
5492
- return _context10.stop();
5433
+ case 1:
5434
+ return _context0.a(2, _context0.v);
5493
5435
  }
5494
- }, _callee10);
5436
+ }, _callee0);
5495
5437
  }));
5496
5438
  return function evalrhs() {
5497
5439
  return _ref3.apply(this, arguments);
5498
5440
  };
5499
5441
  }();
5500
5442
  if (!(op === "and" || op === "or")) {
5501
- _context11.next = 17;
5443
+ _context1.n = 5;
5502
5444
  break;
5503
5445
  }
5504
- _context11.prev = 6;
5505
- _context11.next = 9;
5446
+ _context1.p = 2;
5447
+ _context1.n = 3;
5506
5448
  return evaluateBooleanExpression(lhs, evalrhs, op);
5507
- case 9:
5508
- return _context11.abrupt("return", _context11.sent);
5509
- case 12:
5510
- _context11.prev = 12;
5511
- _context11.t0 = _context11["catch"](6);
5512
- _context11.t0.position = expr.position;
5513
- _context11.t0.token = op;
5514
- throw _context11.t0;
5515
- case 17:
5516
- _context11.next = 19;
5449
+ case 3:
5450
+ return _context1.a(2, _context1.v);
5451
+ case 4:
5452
+ _context1.p = 4;
5453
+ _t4 = _context1.v;
5454
+ _t4.position = expr.position;
5455
+ _t4.token = op;
5456
+ throw _t4;
5457
+ case 5:
5458
+ _context1.n = 6;
5517
5459
  return evalrhs();
5518
- case 19:
5519
- rhs = _context11.sent;
5520
- _context11.prev = 20;
5521
- _context11.t1 = op;
5522
- _context11.next = _context11.t1 === '+' ? 24 : _context11.t1 === '-' ? 24 : _context11.t1 === '*' ? 24 : _context11.t1 === '/' ? 24 : _context11.t1 === '%' ? 24 : _context11.t1 === '=' ? 26 : _context11.t1 === '!=' ? 26 : _context11.t1 === '<' ? 28 : _context11.t1 === '<=' ? 28 : _context11.t1 === '>' ? 28 : _context11.t1 === '>=' ? 28 : _context11.t1 === '&' ? 30 : _context11.t1 === '..' ? 32 : _context11.t1 === 'in' ? 34 : 36;
5460
+ case 6:
5461
+ rhs = _context1.v;
5462
+ _context1.p = 7;
5463
+ _t5 = op;
5464
+ _context1.n = _t5 === '+' ? 8 : _t5 === '-' ? 8 : _t5 === '*' ? 8 : _t5 === '/' ? 8 : _t5 === '%' ? 8 : _t5 === '=' ? 9 : _t5 === '!=' ? 9 : _t5 === '<' ? 10 : _t5 === '<=' ? 10 : _t5 === '>' ? 10 : _t5 === '>=' ? 10 : _t5 === '&' ? 11 : _t5 === '..' ? 12 : _t5 === 'in' ? 13 : 14;
5523
5465
  break;
5524
- case 24:
5466
+ case 8:
5525
5467
  result = evaluateNumericExpression(lhs, rhs, op);
5526
- return _context11.abrupt("break", 36);
5527
- case 26:
5468
+ return _context1.a(3, 14);
5469
+ case 9:
5528
5470
  result = evaluateEqualityExpression(lhs, rhs, op);
5529
- return _context11.abrupt("break", 36);
5530
- case 28:
5471
+ return _context1.a(3, 14);
5472
+ case 10:
5531
5473
  result = evaluateComparisonExpression(lhs, rhs, op);
5532
- return _context11.abrupt("break", 36);
5533
- case 30:
5474
+ return _context1.a(3, 14);
5475
+ case 11:
5534
5476
  result = evaluateStringConcat(lhs, rhs);
5535
- return _context11.abrupt("break", 36);
5536
- case 32:
5477
+ return _context1.a(3, 14);
5478
+ case 12:
5537
5479
  result = evaluateRangeExpression(lhs, rhs);
5538
- return _context11.abrupt("break", 36);
5539
- case 34:
5480
+ return _context1.a(3, 14);
5481
+ case 13:
5540
5482
  result = evaluateIncludesExpression(lhs, rhs);
5541
- return _context11.abrupt("break", 36);
5542
- case 36:
5543
- _context11.next = 43;
5483
+ return _context1.a(3, 14);
5484
+ case 14:
5485
+ _context1.n = 16;
5544
5486
  break;
5545
- case 38:
5546
- _context11.prev = 38;
5547
- _context11.t2 = _context11["catch"](20);
5548
- _context11.t2.position = expr.position;
5549
- _context11.t2.token = op;
5550
- throw _context11.t2;
5551
- case 43:
5552
- return _context11.abrupt("return", result);
5553
- case 44:
5554
- case "end":
5555
- return _context11.stop();
5556
- }
5557
- }, _callee11, null, [[6, 12], [20, 38]]);
5487
+ case 15:
5488
+ _context1.p = 15;
5489
+ _t6 = _context1.v;
5490
+ _t6.position = expr.position;
5491
+ _t6.token = op;
5492
+ throw _t6;
5493
+ case 16:
5494
+ return _context1.a(2, result);
5495
+ }
5496
+ }, _callee1, null, [[7, 15], [2, 4]]);
5558
5497
  }));
5559
5498
  return _evaluateBinary.apply(this, arguments);
5560
5499
  }
5561
- function evaluateUnary(_x24, _x25, _x26) {
5500
+ function evaluateUnary(_x22, _x23, _x24) {
5562
5501
  return _evaluateUnary.apply(this, arguments);
5563
5502
  }
5564
5503
  /**
@@ -5569,35 +5508,35 @@ var jsonata = function () {
5569
5508
  * @returns {*} Evaluated input data
5570
5509
  */
5571
5510
  function _evaluateUnary() {
5572
- _evaluateUnary = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(expr, input, environment) {
5573
- var result, generators, _iterator, _step, generator, _generator, item, value;
5574
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
5575
- while (1) switch (_context13.prev = _context13.next) {
5511
+ _evaluateUnary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(expr, input, environment) {
5512
+ var result, generators, _iterator, _step, generator, _generator, item, value, _t9;
5513
+ return _regenerator().w(function (_context11) {
5514
+ while (1) switch (_context11.n) {
5576
5515
  case 0:
5577
- _context13.t0 = expr.value;
5578
- _context13.next = _context13.t0 === '-' ? 3 : _context13.t0 === '[' ? 16 : _context13.t0 === '{' ? 24 : 28;
5516
+ _t9 = expr.value;
5517
+ _context11.n = _t9 === '-' ? 1 : _t9 === '[' ? 6 : _t9 === '{' ? 8 : 10;
5579
5518
  break;
5580
- case 3:
5581
- _context13.next = 5;
5519
+ case 1:
5520
+ _context11.n = 2;
5582
5521
  return _evaluate2(expr.expression, input, environment);
5583
- case 5:
5584
- result = _context13.sent;
5522
+ case 2:
5523
+ result = _context11.v;
5585
5524
  if (!(typeof result === 'undefined')) {
5586
- _context13.next = 10;
5525
+ _context11.n = 3;
5587
5526
  break;
5588
5527
  }
5589
5528
  result = undefined;
5590
- _context13.next = 15;
5529
+ _context11.n = 5;
5591
5530
  break;
5592
- case 10:
5531
+ case 3:
5593
5532
  if (!isNumeric(result)) {
5594
- _context13.next = 14;
5533
+ _context11.n = 4;
5595
5534
  break;
5596
5535
  }
5597
5536
  result = -result;
5598
- _context13.next = 15;
5537
+ _context11.n = 5;
5599
5538
  break;
5600
- case 14:
5539
+ case 4:
5601
5540
  throw {
5602
5541
  code: "D1002",
5603
5542
  stack: new Error().stack,
@@ -5605,36 +5544,34 @@ var jsonata = function () {
5605
5544
  token: expr.value,
5606
5545
  value: result
5607
5546
  };
5608
- case 15:
5609
- return _context13.abrupt("break", 28);
5610
- case 16:
5547
+ case 5:
5548
+ return _context11.a(3, 10);
5549
+ case 6:
5611
5550
  // array constructor - evaluate each item
5612
5551
  result = [];
5613
- _context13.next = 19;
5552
+ _context11.n = 7;
5614
5553
  return Promise.all(expr.expressions.map(/*#__PURE__*/function () {
5615
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(item, idx) {
5616
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
5617
- while (1) switch (_context12.prev = _context12.next) {
5554
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(item, idx) {
5555
+ var _t7, _t8;
5556
+ return _regenerator().w(function (_context10) {
5557
+ while (1) switch (_context10.n) {
5618
5558
  case 0:
5619
5559
  environment.isParallelCall = idx > 0;
5620
- _context12.t0 = item;
5621
- _context12.next = 4;
5560
+ _t7 = item;
5561
+ _context10.n = 1;
5622
5562
  return _evaluate2(item, input, environment);
5623
- case 4:
5624
- _context12.t1 = _context12.sent;
5625
- return _context12.abrupt("return", [_context12.t0, _context12.t1]);
5626
- case 6:
5627
- case "end":
5628
- return _context12.stop();
5563
+ case 1:
5564
+ _t8 = _context10.v;
5565
+ return _context10.a(2, [_t7, _t8]);
5629
5566
  }
5630
- }, _callee12);
5567
+ }, _callee10);
5631
5568
  }));
5632
- return function (_x75, _x76) {
5569
+ return function (_x73, _x74) {
5633
5570
  return _ref4.apply(this, arguments);
5634
5571
  };
5635
5572
  }()));
5636
- case 19:
5637
- generators = _context13.sent;
5573
+ case 7:
5574
+ generators = _context11.v;
5638
5575
  _iterator = _createForOfIteratorHelper(generators);
5639
5576
  try {
5640
5577
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -5660,20 +5597,17 @@ var jsonata = function () {
5660
5597
  value: true
5661
5598
  });
5662
5599
  }
5663
- return _context13.abrupt("break", 28);
5664
- case 24:
5665
- _context13.next = 26;
5600
+ return _context11.a(3, 10);
5601
+ case 8:
5602
+ _context11.n = 9;
5666
5603
  return evaluateGroupExpression(expr, input, environment);
5667
- case 26:
5668
- result = _context13.sent;
5669
- return _context13.abrupt("break", 28);
5670
- case 28:
5671
- return _context13.abrupt("return", result);
5672
- case 29:
5673
- case "end":
5674
- return _context13.stop();
5604
+ case 9:
5605
+ result = _context11.v;
5606
+ return _context11.a(3, 10);
5607
+ case 10:
5608
+ return _context11.a(2, result);
5675
5609
  }
5676
- }, _callee13);
5610
+ }, _callee11);
5677
5611
  }));
5678
5612
  return _evaluateUnary.apply(this, arguments);
5679
5613
  }
@@ -5943,56 +5877,53 @@ var jsonata = function () {
5943
5877
  * @param {Object} op - opcode
5944
5878
  * @returns {*} Result
5945
5879
  */
5946
- function evaluateBooleanExpression(_x27, _x28, _x29) {
5880
+ function evaluateBooleanExpression(_x25, _x26, _x27) {
5947
5881
  return _evaluateBooleanExpression.apply(this, arguments);
5948
5882
  }
5949
5883
  function _evaluateBooleanExpression() {
5950
- _evaluateBooleanExpression = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(lhs, evalrhs, op) {
5951
- var result, lBool;
5952
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
5953
- while (1) switch (_context14.prev = _context14.next) {
5884
+ _evaluateBooleanExpression = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(lhs, evalrhs, op) {
5885
+ var result, lBool, _t0, _t1, _t10, _t11, _t12, _t13, _t14;
5886
+ return _regenerator().w(function (_context12) {
5887
+ while (1) switch (_context12.n) {
5954
5888
  case 0:
5955
5889
  lBool = boolize(lhs);
5956
- _context14.t0 = op;
5957
- _context14.next = _context14.t0 === 'and' ? 4 : _context14.t0 === 'or' ? 13 : 22;
5890
+ _t0 = op;
5891
+ _context12.n = _t0 === 'and' ? 1 : _t0 === 'or' ? 4 : 7;
5958
5892
  break;
5959
- case 4:
5960
- _context14.t1 = lBool;
5961
- if (!_context14.t1) {
5962
- _context14.next = 11;
5893
+ case 1:
5894
+ _t1 = lBool;
5895
+ if (!_t1) {
5896
+ _context12.n = 3;
5963
5897
  break;
5964
5898
  }
5965
- _context14.t2 = boolize;
5966
- _context14.next = 9;
5899
+ _t10 = boolize;
5900
+ _context12.n = 2;
5967
5901
  return evalrhs();
5968
- case 9:
5969
- _context14.t3 = _context14.sent;
5970
- _context14.t1 = (0, _context14.t2)(_context14.t3);
5971
- case 11:
5972
- result = _context14.t1;
5973
- return _context14.abrupt("break", 22);
5974
- case 13:
5975
- _context14.t4 = lBool;
5976
- if (_context14.t4) {
5977
- _context14.next = 20;
5902
+ case 2:
5903
+ _t11 = _context12.v;
5904
+ _t1 = _t10(_t11);
5905
+ case 3:
5906
+ result = _t1;
5907
+ return _context12.a(3, 7);
5908
+ case 4:
5909
+ _t12 = lBool;
5910
+ if (_t12) {
5911
+ _context12.n = 6;
5978
5912
  break;
5979
5913
  }
5980
- _context14.t5 = boolize;
5981
- _context14.next = 18;
5914
+ _t13 = boolize;
5915
+ _context12.n = 5;
5982
5916
  return evalrhs();
5983
- case 18:
5984
- _context14.t6 = _context14.sent;
5985
- _context14.t4 = (0, _context14.t5)(_context14.t6);
5986
- case 20:
5987
- result = _context14.t4;
5988
- return _context14.abrupt("break", 22);
5989
- case 22:
5990
- return _context14.abrupt("return", result);
5991
- case 23:
5992
- case "end":
5993
- return _context14.stop();
5917
+ case 5:
5918
+ _t14 = _context12.v;
5919
+ _t12 = _t13(_t14);
5920
+ case 6:
5921
+ result = _t12;
5922
+ return _context12.a(3, 7);
5923
+ case 7:
5924
+ return _context12.a(2, result);
5994
5925
  }
5995
- }, _callee14);
5926
+ }, _callee12);
5996
5927
  }));
5997
5928
  return _evaluateBooleanExpression.apply(this, arguments);
5998
5929
  }
@@ -6028,14 +5959,14 @@ var jsonata = function () {
6028
5959
  * @param {Object} environment - Environment
6029
5960
  * @returns {{}} Evaluated input data
6030
5961
  */
6031
- function evaluateGroupExpression(_x30, _x31, _x32) {
5962
+ function evaluateGroupExpression(_x28, _x29, _x30) {
6032
5963
  return _evaluateGroupExpression.apply(this, arguments);
6033
5964
  }
6034
5965
  function _evaluateGroupExpression() {
6035
- _evaluateGroupExpression = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(expr, input, environment) {
6036
- var result, groups, reduce, itemIndex, item, env, pairIndex, pair, key, entry, generators, _iterator2, _step2, generator, _yield$generator, _yield$generator2, value;
6037
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
6038
- while (1) switch (_context16.prev = _context16.next) {
5966
+ _evaluateGroupExpression = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(expr, input, environment) {
5967
+ var result, groups, reduce, itemIndex, item, env, pairIndex, pair, key, entry, generators, _iterator2, _step2, generator, _yield$generator, _yield$generator2, value, _t17;
5968
+ return _regenerator().w(function (_context14) {
5969
+ while (1) switch (_context14.p = _context14.n) {
6039
5970
  case 0:
6040
5971
  result = {};
6041
5972
  groups = {};
@@ -6048,26 +5979,26 @@ var jsonata = function () {
6048
5979
  input.push(undefined);
6049
5980
  }
6050
5981
  itemIndex = 0;
6051
- case 6:
5982
+ case 1:
6052
5983
  if (!(itemIndex < input.length)) {
6053
- _context16.next = 32;
5984
+ _context14.n = 9;
6054
5985
  break;
6055
5986
  }
6056
5987
  item = input[itemIndex];
6057
5988
  env = reduce ? createFrameFromTuple(environment, item) : environment;
6058
5989
  pairIndex = 0;
6059
- case 10:
5990
+ case 2:
6060
5991
  if (!(pairIndex < expr.lhs.length)) {
6061
- _context16.next = 29;
5992
+ _context14.n = 8;
6062
5993
  break;
6063
5994
  }
6064
5995
  pair = expr.lhs[pairIndex];
6065
- _context16.next = 14;
5996
+ _context14.n = 3;
6066
5997
  return _evaluate2(pair[0], reduce ? item['@'] : item, env);
6067
- case 14:
6068
- key = _context16.sent;
5998
+ case 3:
5999
+ key = _context14.v;
6069
6000
  if (!(typeof key !== 'string' && key !== undefined)) {
6070
- _context16.next = 17;
6001
+ _context14.n = 4;
6071
6002
  break;
6072
6003
  }
6073
6004
  throw {
@@ -6076,9 +6007,9 @@ var jsonata = function () {
6076
6007
  position: expr.position,
6077
6008
  value: key
6078
6009
  };
6079
- case 17:
6010
+ case 4:
6080
6011
  if (!(key !== undefined)) {
6081
- _context16.next = 26;
6012
+ _context14.n = 7;
6082
6013
  break;
6083
6014
  }
6084
6015
  entry = {
@@ -6086,11 +6017,11 @@ var jsonata = function () {
6086
6017
  exprIndex: pairIndex
6087
6018
  };
6088
6019
  if (!groups.hasOwnProperty(key)) {
6089
- _context16.next = 25;
6020
+ _context14.n = 6;
6090
6021
  break;
6091
6022
  }
6092
6023
  if (!(groups[key].exprIndex !== pairIndex)) {
6093
- _context16.next = 22;
6024
+ _context14.n = 5;
6094
6025
  break;
6095
6026
  }
6096
6027
  throw {
@@ -6099,28 +6030,28 @@ var jsonata = function () {
6099
6030
  position: expr.position,
6100
6031
  value: key
6101
6032
  };
6102
- case 22:
6033
+ case 5:
6103
6034
  // append it as an array
6104
6035
  groups[key].data = fn.append(groups[key].data, item);
6105
- _context16.next = 26;
6036
+ _context14.n = 7;
6106
6037
  break;
6107
- case 25:
6038
+ case 6:
6108
6039
  groups[key] = entry;
6109
- case 26:
6040
+ case 7:
6110
6041
  pairIndex++;
6111
- _context16.next = 10;
6042
+ _context14.n = 2;
6112
6043
  break;
6113
- case 29:
6044
+ case 8:
6114
6045
  itemIndex++;
6115
- _context16.next = 6;
6046
+ _context14.n = 1;
6116
6047
  break;
6117
- case 32:
6118
- _context16.next = 34;
6048
+ case 9:
6049
+ _context14.n = 10;
6119
6050
  return Promise.all(Object.keys(groups).map(/*#__PURE__*/function () {
6120
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(key, idx) {
6121
- var entry, context, env, tuple;
6122
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
6123
- while (1) switch (_context15.prev = _context15.next) {
6051
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(key, idx) {
6052
+ var entry, context, env, tuple, _t15, _t16;
6053
+ return _regenerator().w(function (_context13) {
6054
+ while (1) switch (_context13.n) {
6124
6055
  case 0:
6125
6056
  entry = groups[key];
6126
6057
  context = entry.data;
@@ -6132,64 +6063,58 @@ var jsonata = function () {
6132
6063
  env = createFrameFromTuple(environment, tuple);
6133
6064
  }
6134
6065
  environment.isParallelCall = idx > 0;
6135
- _context15.t0 = key;
6136
- _context15.next = 8;
6066
+ _t15 = key;
6067
+ _context13.n = 1;
6137
6068
  return _evaluate2(expr.lhs[entry.exprIndex][1], context, env);
6138
- case 8:
6139
- _context15.t1 = _context15.sent;
6140
- return _context15.abrupt("return", [_context15.t0, _context15.t1]);
6141
- case 10:
6142
- case "end":
6143
- return _context15.stop();
6069
+ case 1:
6070
+ _t16 = _context13.v;
6071
+ return _context13.a(2, [_t15, _t16]);
6144
6072
  }
6145
- }, _callee15);
6073
+ }, _callee13);
6146
6074
  }));
6147
- return function (_x77, _x78) {
6075
+ return function (_x75, _x76) {
6148
6076
  return _ref5.apply(this, arguments);
6149
6077
  };
6150
6078
  }()));
6151
- case 34:
6152
- generators = _context16.sent;
6079
+ case 10:
6080
+ generators = _context14.v;
6153
6081
  _iterator2 = _createForOfIteratorHelper(generators);
6154
- _context16.prev = 36;
6082
+ _context14.p = 11;
6155
6083
  _iterator2.s();
6156
- case 38:
6084
+ case 12:
6157
6085
  if ((_step2 = _iterator2.n()).done) {
6158
- _context16.next = 49;
6086
+ _context14.n = 15;
6159
6087
  break;
6160
6088
  }
6161
6089
  generator = _step2.value;
6162
- _context16.next = 42;
6090
+ _context14.n = 13;
6163
6091
  return generator;
6164
- case 42:
6165
- _yield$generator = _context16.sent;
6092
+ case 13:
6093
+ _yield$generator = _context14.v;
6166
6094
  _yield$generator2 = _slicedToArray(_yield$generator, 2);
6167
6095
  key = _yield$generator2[0];
6168
6096
  value = _yield$generator2[1];
6169
6097
  if (typeof value !== 'undefined') {
6170
6098
  result[key] = value;
6171
6099
  }
6172
- case 47:
6173
- _context16.next = 38;
6100
+ case 14:
6101
+ _context14.n = 12;
6174
6102
  break;
6175
- case 49:
6176
- _context16.next = 54;
6103
+ case 15:
6104
+ _context14.n = 17;
6177
6105
  break;
6178
- case 51:
6179
- _context16.prev = 51;
6180
- _context16.t0 = _context16["catch"](36);
6181
- _iterator2.e(_context16.t0);
6182
- case 54:
6183
- _context16.prev = 54;
6106
+ case 16:
6107
+ _context14.p = 16;
6108
+ _t17 = _context14.v;
6109
+ _iterator2.e(_t17);
6110
+ case 17:
6111
+ _context14.p = 17;
6184
6112
  _iterator2.f();
6185
- return _context16.finish(54);
6186
- case 57:
6187
- return _context16.abrupt("return", result);
6188
- case 58:
6189
- case "end":
6190
- return _context16.stop();
6191
- }
6192
- }, _callee16, null, [[36, 51, 54, 57]]);
6113
+ return _context14.f(17);
6114
+ case 18:
6115
+ return _context14.a(2, result);
6116
+ }
6117
+ }, _callee14, null, [[11, 16, 17, 18]]);
6193
6118
  }));
6194
6119
  return _evaluateGroupExpression.apply(this, arguments);
6195
6120
  }
@@ -6264,7 +6189,7 @@ var jsonata = function () {
6264
6189
  * @param {Object} environment - Environment
6265
6190
  * @returns {*} Evaluated input data
6266
6191
  */
6267
- function evaluateBindExpression(_x33, _x34, _x35) {
6192
+ function evaluateBindExpression(_x31, _x32, _x33) {
6268
6193
  return _evaluateBindExpression.apply(this, arguments);
6269
6194
  }
6270
6195
  /**
@@ -6275,26 +6200,23 @@ var jsonata = function () {
6275
6200
  * @returns {*} Evaluated input data
6276
6201
  */
6277
6202
  function _evaluateBindExpression() {
6278
- _evaluateBindExpression = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(expr, input, environment) {
6203
+ _evaluateBindExpression = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(expr, input, environment) {
6279
6204
  var value;
6280
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
6281
- while (1) switch (_context17.prev = _context17.next) {
6205
+ return _regenerator().w(function (_context15) {
6206
+ while (1) switch (_context15.n) {
6282
6207
  case 0:
6283
- _context17.next = 2;
6208
+ _context15.n = 1;
6284
6209
  return _evaluate2(expr.rhs, input, environment);
6285
- case 2:
6286
- value = _context17.sent;
6210
+ case 1:
6211
+ value = _context15.v;
6287
6212
  environment.bind(expr.lhs.value, value);
6288
- return _context17.abrupt("return", value);
6289
- case 5:
6290
- case "end":
6291
- return _context17.stop();
6213
+ return _context15.a(2, value);
6292
6214
  }
6293
- }, _callee17);
6215
+ }, _callee15);
6294
6216
  }));
6295
6217
  return _evaluateBindExpression.apply(this, arguments);
6296
6218
  }
6297
- function evaluateCondition(_x36, _x37, _x38) {
6219
+ function evaluateCondition(_x34, _x35, _x36) {
6298
6220
  return _evaluateCondition.apply(this, arguments);
6299
6221
  }
6300
6222
  /**
@@ -6305,45 +6227,42 @@ var jsonata = function () {
6305
6227
  * @returns {*} Evaluated input data
6306
6228
  */
6307
6229
  function _evaluateCondition() {
6308
- _evaluateCondition = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(expr, input, environment) {
6230
+ _evaluateCondition = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(expr, input, environment) {
6309
6231
  var result, condition;
6310
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
6311
- while (1) switch (_context18.prev = _context18.next) {
6232
+ return _regenerator().w(function (_context16) {
6233
+ while (1) switch (_context16.n) {
6312
6234
  case 0:
6313
- _context18.next = 2;
6235
+ _context16.n = 1;
6314
6236
  return _evaluate2(expr.condition, input, environment);
6315
- case 2:
6316
- condition = _context18.sent;
6237
+ case 1:
6238
+ condition = _context16.v;
6317
6239
  if (!fn["boolean"](condition)) {
6318
- _context18.next = 9;
6240
+ _context16.n = 3;
6319
6241
  break;
6320
6242
  }
6321
- _context18.next = 6;
6243
+ _context16.n = 2;
6322
6244
  return _evaluate2(expr.then, input, environment);
6323
- case 6:
6324
- result = _context18.sent;
6325
- _context18.next = 13;
6245
+ case 2:
6246
+ result = _context16.v;
6247
+ _context16.n = 5;
6326
6248
  break;
6327
- case 9:
6249
+ case 3:
6328
6250
  if (!(typeof expr["else"] !== 'undefined')) {
6329
- _context18.next = 13;
6251
+ _context16.n = 5;
6330
6252
  break;
6331
6253
  }
6332
- _context18.next = 12;
6254
+ _context16.n = 4;
6333
6255
  return _evaluate2(expr["else"], input, environment);
6334
- case 12:
6335
- result = _context18.sent;
6336
- case 13:
6337
- return _context18.abrupt("return", result);
6338
- case 14:
6339
- case "end":
6340
- return _context18.stop();
6256
+ case 4:
6257
+ result = _context16.v;
6258
+ case 5:
6259
+ return _context16.a(2, result);
6341
6260
  }
6342
- }, _callee18);
6261
+ }, _callee16);
6343
6262
  }));
6344
6263
  return _evaluateCondition.apply(this, arguments);
6345
6264
  }
6346
- function evaluateBlock(_x39, _x40, _x41) {
6265
+ function evaluateBlock(_x37, _x38, _x39) {
6347
6266
  return _evaluateBlock.apply(this, arguments);
6348
6267
  }
6349
6268
  /**
@@ -6352,36 +6271,33 @@ var jsonata = function () {
6352
6271
  * @returns {Function} Higher order function representing prepared regex
6353
6272
  */
6354
6273
  function _evaluateBlock() {
6355
- _evaluateBlock = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(expr, input, environment) {
6274
+ _evaluateBlock = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(expr, input, environment) {
6356
6275
  var result, frame, ii;
6357
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
6358
- while (1) switch (_context19.prev = _context19.next) {
6276
+ return _regenerator().w(function (_context17) {
6277
+ while (1) switch (_context17.n) {
6359
6278
  case 0:
6360
6279
  // create a new frame to limit the scope of variable assignments
6361
6280
  // TODO, only do this if the post-parse stage has flagged this as required
6362
6281
  frame = createFrame(environment); // invoke each expression in turn
6363
6282
  // only return the result of the last one
6364
6283
  ii = 0;
6365
- case 2:
6284
+ case 1:
6366
6285
  if (!(ii < expr.expressions.length)) {
6367
- _context19.next = 9;
6286
+ _context17.n = 4;
6368
6287
  break;
6369
6288
  }
6370
- _context19.next = 5;
6289
+ _context17.n = 2;
6371
6290
  return _evaluate2(expr.expressions[ii], input, frame);
6372
- case 5:
6373
- result = _context19.sent;
6374
- case 6:
6291
+ case 2:
6292
+ result = _context17.v;
6293
+ case 3:
6375
6294
  ii++;
6376
- _context19.next = 2;
6295
+ _context17.n = 1;
6377
6296
  break;
6378
- case 9:
6379
- return _context19.abrupt("return", result);
6380
- case 10:
6381
- case "end":
6382
- return _context19.stop();
6297
+ case 4:
6298
+ return _context17.a(2, result);
6383
6299
  }
6384
- }, _callee19);
6300
+ }, _callee17);
6385
6301
  }));
6386
6302
  return _evaluateBlock.apply(this, arguments);
6387
6303
  }
@@ -6452,7 +6368,7 @@ var jsonata = function () {
6452
6368
  * @param {Object} environment - Environment
6453
6369
  * @returns {*} Ordered sequence
6454
6370
  */
6455
- function evaluateSortExpression(_x42, _x43, _x44) {
6371
+ function evaluateSortExpression(_x40, _x41, _x42) {
6456
6372
  return _evaluateSortExpression.apply(this, arguments);
6457
6373
  }
6458
6374
  /**
@@ -6463,27 +6379,27 @@ var jsonata = function () {
6463
6379
  * @returns {*} tranformer function
6464
6380
  */
6465
6381
  function _evaluateSortExpression() {
6466
- _evaluateSortExpression = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(expr, input, environment) {
6382
+ _evaluateSortExpression = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(expr, input, environment) {
6467
6383
  var result, lhs, isTupleSort, comparator, focus;
6468
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
6469
- while (1) switch (_context21.prev = _context21.next) {
6384
+ return _regenerator().w(function (_context19) {
6385
+ while (1) switch (_context19.n) {
6470
6386
  case 0:
6471
6387
  // evaluate the lhs, then sort the results in order according to rhs expression
6472
6388
  lhs = input;
6473
6389
  isTupleSort = input.tupleStream ? true : false; // sort the lhs array
6474
6390
  // use comparator function
6475
6391
  comparator = /*#__PURE__*/function () {
6476
- var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(a, b) {
6392
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(a, b) {
6477
6393
  var comp, index, term, context, env, aa, bb, atype, btype;
6478
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
6479
- while (1) switch (_context20.prev = _context20.next) {
6394
+ return _regenerator().w(function (_context18) {
6395
+ while (1) switch (_context18.n) {
6480
6396
  case 0:
6481
6397
  // expr.terms is an array of order-by in priority order
6482
6398
  comp = 0;
6483
6399
  index = 0;
6484
- case 2:
6400
+ case 1:
6485
6401
  if (!(comp === 0 && index < expr.terms.length)) {
6486
- _context20.next = 37;
6402
+ _context18.n = 11;
6487
6403
  break;
6488
6404
  }
6489
6405
  term = expr.terms[index]; //evaluate the sort term in the context of a
@@ -6493,10 +6409,10 @@ var jsonata = function () {
6493
6409
  context = a['@'];
6494
6410
  env = createFrameFromTuple(environment, a);
6495
6411
  }
6496
- _context20.next = 9;
6412
+ _context18.n = 2;
6497
6413
  return _evaluate2(term.expression, context, env);
6498
- case 9:
6499
- aa = _context20.sent;
6414
+ case 2:
6415
+ aa = _context18.v;
6500
6416
  //evaluate the sort term in the context of b
6501
6417
  context = b;
6502
6418
  env = environment;
@@ -6504,30 +6420,30 @@ var jsonata = function () {
6504
6420
  context = b['@'];
6505
6421
  env = createFrameFromTuple(environment, b);
6506
6422
  }
6507
- _context20.next = 15;
6423
+ _context18.n = 3;
6508
6424
  return _evaluate2(term.expression, context, env);
6509
- case 15:
6510
- bb = _context20.sent;
6425
+ case 3:
6426
+ bb = _context18.v;
6511
6427
  // type checks
6512
6428
  atype = _typeof(aa);
6513
6429
  btype = _typeof(bb); // undefined should be last in sort order
6514
6430
  if (!(atype === 'undefined')) {
6515
- _context20.next = 21;
6431
+ _context18.n = 4;
6516
6432
  break;
6517
6433
  }
6518
6434
  // swap them, unless btype is also undefined
6519
6435
  comp = btype === 'undefined' ? 0 : 1;
6520
- return _context20.abrupt("continue", 34);
6521
- case 21:
6436
+ return _context18.a(3, 10);
6437
+ case 4:
6522
6438
  if (!(btype === 'undefined')) {
6523
- _context20.next = 24;
6439
+ _context18.n = 5;
6524
6440
  break;
6525
6441
  }
6526
6442
  comp = -1;
6527
- return _context20.abrupt("continue", 34);
6528
- case 24:
6443
+ return _context18.a(3, 10);
6444
+ case 5:
6529
6445
  if (!(!(atype === 'string' || atype === 'number') || !(btype === 'string' || btype === 'number'))) {
6530
- _context20.next = 26;
6446
+ _context18.n = 6;
6531
6447
  break;
6532
6448
  }
6533
6449
  throw {
@@ -6536,9 +6452,9 @@ var jsonata = function () {
6536
6452
  position: expr.position,
6537
6453
  value: !(atype === 'string' || atype === 'number') ? aa : bb
6538
6454
  };
6539
- case 26:
6455
+ case 6:
6540
6456
  if (!(atype !== btype)) {
6541
- _context20.next = 28;
6457
+ _context18.n = 7;
6542
6458
  break;
6543
6459
  }
6544
6460
  throw {
@@ -6548,35 +6464,32 @@ var jsonata = function () {
6548
6464
  value: aa,
6549
6465
  value2: bb
6550
6466
  };
6551
- case 28:
6467
+ case 7:
6552
6468
  if (!(aa === bb)) {
6553
- _context20.next = 32;
6469
+ _context18.n = 8;
6554
6470
  break;
6555
6471
  }
6556
- return _context20.abrupt("continue", 34);
6557
- case 32:
6472
+ return _context18.a(3, 10);
6473
+ case 8:
6558
6474
  if (aa < bb) {
6559
6475
  comp = -1;
6560
6476
  } else {
6561
6477
  comp = 1;
6562
6478
  }
6563
- case 33:
6479
+ case 9:
6564
6480
  if (term.descending === true) {
6565
6481
  comp = -comp;
6566
6482
  }
6567
- case 34:
6483
+ case 10:
6568
6484
  index++;
6569
- _context20.next = 2;
6485
+ _context18.n = 1;
6570
6486
  break;
6571
- case 37:
6572
- return _context20.abrupt("return", comp === 1);
6573
- case 38:
6574
- case "end":
6575
- return _context20.stop();
6487
+ case 11:
6488
+ return _context18.a(2, comp === 1);
6576
6489
  }
6577
- }, _callee20);
6490
+ }, _callee18);
6578
6491
  }));
6579
- return function comparator(_x79, _x80) {
6492
+ return function comparator(_x77, _x78) {
6580
6493
  return _ref6.apply(this, arguments);
6581
6494
  };
6582
6495
  }();
@@ -6584,37 +6497,34 @@ var jsonata = function () {
6584
6497
  environment: environment,
6585
6498
  input: input
6586
6499
  }; // the `focus` is passed in as the `this` for the invoked function
6587
- _context21.next = 6;
6500
+ _context19.n = 1;
6588
6501
  return fn.sort.apply(focus, [lhs, comparator]);
6589
- case 6:
6590
- result = _context21.sent;
6591
- return _context21.abrupt("return", result);
6592
- case 8:
6593
- case "end":
6594
- return _context21.stop();
6502
+ case 1:
6503
+ result = _context19.v;
6504
+ return _context19.a(2, result);
6595
6505
  }
6596
- }, _callee21);
6506
+ }, _callee19);
6597
6507
  }));
6598
6508
  return _evaluateSortExpression.apply(this, arguments);
6599
6509
  }
6600
6510
  function evaluateTransformExpression(expr, input, environment) {
6601
6511
  // create a function to implement the transform definition
6602
6512
  var transformer = /*#__PURE__*/function () {
6603
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(obj) {
6513
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(obj) {
6604
6514
  var cloneFunction, result, matches, ii, match, update, updateType, prop, deletions, val, jj;
6605
- return _regeneratorRuntime().wrap(function _callee$(_context) {
6606
- while (1) switch (_context.prev = _context.next) {
6515
+ return _regenerator().w(function (_context) {
6516
+ while (1) switch (_context.n) {
6607
6517
  case 0:
6608
6518
  if (!(typeof obj === 'undefined')) {
6609
- _context.next = 2;
6519
+ _context.n = 1;
6610
6520
  break;
6611
6521
  }
6612
- return _context.abrupt("return", undefined);
6613
- case 2:
6522
+ return _context.a(2, undefined);
6523
+ case 1:
6614
6524
  // this function returns a copy of obj with changes specified by the pattern/operation
6615
6525
  cloneFunction = environment.lookup('clone');
6616
6526
  if (isFunction(cloneFunction)) {
6617
- _context.next = 5;
6527
+ _context.n = 2;
6618
6528
  break;
6619
6529
  }
6620
6530
  throw {
@@ -6622,31 +6532,31 @@ var jsonata = function () {
6622
6532
  stack: new Error().stack,
6623
6533
  position: expr.position
6624
6534
  };
6625
- case 5:
6626
- _context.next = 7;
6535
+ case 2:
6536
+ _context.n = 3;
6627
6537
  return apply(cloneFunction, [obj], null, environment);
6628
- case 7:
6629
- result = _context.sent;
6630
- _context.next = 10;
6538
+ case 3:
6539
+ result = _context.v;
6540
+ _context.n = 4;
6631
6541
  return _evaluate2(expr.pattern, result, environment);
6632
- case 10:
6633
- matches = _context.sent;
6542
+ case 4:
6543
+ matches = _context.v;
6634
6544
  if (!(typeof matches !== 'undefined')) {
6635
- _context.next = 39;
6545
+ _context.n = 13;
6636
6546
  break;
6637
6547
  }
6638
6548
  if (!Array.isArray(matches)) {
6639
6549
  matches = [matches];
6640
6550
  }
6641
6551
  ii = 0;
6642
- case 14:
6552
+ case 5:
6643
6553
  if (!(ii < matches.length)) {
6644
- _context.next = 39;
6554
+ _context.n = 13;
6645
6555
  break;
6646
6556
  }
6647
6557
  match = matches[ii];
6648
6558
  if (!(match && (match.isPrototypeOf(result) || match instanceof Object.constructor))) {
6649
- _context.next = 18;
6559
+ _context.n = 6;
6650
6560
  break;
6651
6561
  }
6652
6562
  throw {
@@ -6654,19 +6564,19 @@ var jsonata = function () {
6654
6564
  stack: new Error().stack,
6655
6565
  position: expr.position
6656
6566
  };
6657
- case 18:
6658
- _context.next = 20;
6567
+ case 6:
6568
+ _context.n = 7;
6659
6569
  return _evaluate2(expr.update, match, environment);
6660
- case 20:
6661
- update = _context.sent;
6570
+ case 7:
6571
+ update = _context.v;
6662
6572
  // update must be an object
6663
6573
  updateType = _typeof(update);
6664
6574
  if (!(updateType !== 'undefined')) {
6665
- _context.next = 26;
6575
+ _context.n = 9;
6666
6576
  break;
6667
6577
  }
6668
6578
  if (!(updateType !== 'object' || update === null || Array.isArray(update))) {
6669
- _context.next = 25;
6579
+ _context.n = 8;
6670
6580
  break;
6671
6581
  }
6672
6582
  throw {
@@ -6675,22 +6585,22 @@ var jsonata = function () {
6675
6585
  position: expr.update.position,
6676
6586
  value: update
6677
6587
  };
6678
- case 25:
6588
+ case 8:
6679
6589
  // merge the update
6680
6590
  for (prop in update) {
6681
6591
  match[prop] = update[prop];
6682
6592
  }
6683
- case 26:
6593
+ case 9:
6684
6594
  if (!(typeof expr["delete"] !== 'undefined')) {
6685
- _context.next = 36;
6595
+ _context.n = 12;
6686
6596
  break;
6687
6597
  }
6688
- _context.next = 29;
6598
+ _context.n = 10;
6689
6599
  return _evaluate2(expr["delete"], match, environment);
6690
- case 29:
6691
- deletions = _context.sent;
6600
+ case 10:
6601
+ deletions = _context.v;
6692
6602
  if (!(typeof deletions !== 'undefined')) {
6693
- _context.next = 36;
6603
+ _context.n = 12;
6694
6604
  break;
6695
6605
  }
6696
6606
  val = deletions;
@@ -6698,7 +6608,7 @@ var jsonata = function () {
6698
6608
  deletions = [deletions];
6699
6609
  }
6700
6610
  if (isArrayOfStrings(deletions)) {
6701
- _context.next = 35;
6611
+ _context.n = 11;
6702
6612
  break;
6703
6613
  }
6704
6614
  throw {
@@ -6707,25 +6617,22 @@ var jsonata = function () {
6707
6617
  position: expr["delete"].position,
6708
6618
  value: val
6709
6619
  };
6710
- case 35:
6620
+ case 11:
6711
6621
  for (jj = 0; jj < deletions.length; jj++) {
6712
6622
  if (_typeof(match) === 'object' && match !== null) {
6713
6623
  delete match[deletions[jj]];
6714
6624
  }
6715
6625
  }
6716
- case 36:
6626
+ case 12:
6717
6627
  ii++;
6718
- _context.next = 14;
6628
+ _context.n = 5;
6719
6629
  break;
6720
- case 39:
6721
- return _context.abrupt("return", result);
6722
- case 40:
6723
- case "end":
6724
- return _context.stop();
6630
+ case 13:
6631
+ return _context.a(2, result);
6725
6632
  }
6726
6633
  }, _callee);
6727
6634
  }));
6728
- return function transformer(_x45) {
6635
+ return function transformer(_x43) {
6729
6636
  return _ref.apply(this, arguments);
6730
6637
  };
6731
6638
  }();
@@ -6740,7 +6647,7 @@ var jsonata = function () {
6740
6647
  * @param {Object} environment - Environment
6741
6648
  * @returns {*} Evaluated input data
6742
6649
  */
6743
- function evaluateApplyExpression(_x46, _x47, _x48) {
6650
+ function evaluateApplyExpression(_x44, _x45, _x46) {
6744
6651
  return _evaluateApplyExpression.apply(this, arguments);
6745
6652
  }
6746
6653
  /**
@@ -6751,34 +6658,34 @@ var jsonata = function () {
6751
6658
  * @returns {*} Evaluated input data
6752
6659
  */
6753
6660
  function _evaluateApplyExpression() {
6754
- _evaluateApplyExpression = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(expr, input, environment) {
6661
+ _evaluateApplyExpression = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(expr, input, environment) {
6755
6662
  var result, lhs, func, chain;
6756
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
6757
- while (1) switch (_context22.prev = _context22.next) {
6663
+ return _regenerator().w(function (_context20) {
6664
+ while (1) switch (_context20.n) {
6758
6665
  case 0:
6759
- _context22.next = 2;
6666
+ _context20.n = 1;
6760
6667
  return _evaluate2(expr.lhs, input, environment);
6761
- case 2:
6762
- lhs = _context22.sent;
6668
+ case 1:
6669
+ lhs = _context20.v;
6763
6670
  if (!(expr.rhs.type === 'function')) {
6764
- _context22.next = 9;
6671
+ _context20.n = 3;
6765
6672
  break;
6766
6673
  }
6767
- _context22.next = 6;
6674
+ _context20.n = 2;
6768
6675
  return evaluateFunction(expr.rhs, input, environment, {
6769
6676
  context: lhs
6770
6677
  });
6771
- case 6:
6772
- result = _context22.sent;
6773
- _context22.next = 26;
6678
+ case 2:
6679
+ result = _context20.v;
6680
+ _context20.n = 10;
6774
6681
  break;
6775
- case 9:
6776
- _context22.next = 11;
6682
+ case 3:
6683
+ _context20.n = 4;
6777
6684
  return _evaluate2(expr.rhs, input, environment);
6778
- case 11:
6779
- func = _context22.sent;
6685
+ case 4:
6686
+ func = _context20.v;
6780
6687
  if (isFunction(func)) {
6781
- _context22.next = 14;
6688
+ _context20.n = 5;
6782
6689
  break;
6783
6690
  }
6784
6691
  throw {
@@ -6787,37 +6694,34 @@ var jsonata = function () {
6787
6694
  position: expr.position,
6788
6695
  value: func
6789
6696
  };
6790
- case 14:
6697
+ case 5:
6791
6698
  if (!isFunction(lhs)) {
6792
- _context22.next = 23;
6699
+ _context20.n = 8;
6793
6700
  break;
6794
6701
  }
6795
- _context22.next = 17;
6702
+ _context20.n = 6;
6796
6703
  return _evaluate2(chainAST, null, environment);
6797
- case 17:
6798
- chain = _context22.sent;
6799
- _context22.next = 20;
6704
+ case 6:
6705
+ chain = _context20.v;
6706
+ _context20.n = 7;
6800
6707
  return apply(chain, [lhs, func], null, environment);
6801
- case 20:
6802
- result = _context22.sent;
6803
- _context22.next = 26;
6708
+ case 7:
6709
+ result = _context20.v;
6710
+ _context20.n = 10;
6804
6711
  break;
6805
- case 23:
6806
- _context22.next = 25;
6712
+ case 8:
6713
+ _context20.n = 9;
6807
6714
  return apply(func, [lhs], null, environment);
6808
- case 25:
6809
- result = _context22.sent;
6810
- case 26:
6811
- return _context22.abrupt("return", result);
6812
- case 27:
6813
- case "end":
6814
- return _context22.stop();
6715
+ case 9:
6716
+ result = _context20.v;
6717
+ case 10:
6718
+ return _context20.a(2, result);
6815
6719
  }
6816
- }, _callee22);
6720
+ }, _callee20);
6817
6721
  }));
6818
6722
  return _evaluateApplyExpression.apply(this, arguments);
6819
6723
  }
6820
- function evaluateFunction(_x49, _x50, _x51, _x52) {
6724
+ function evaluateFunction(_x47, _x48, _x49, _x50) {
6821
6725
  return _evaluateFunction.apply(this, arguments);
6822
6726
  }
6823
6727
  /**
@@ -6829,17 +6733,17 @@ var jsonata = function () {
6829
6733
  * @returns {*} Result of procedure
6830
6734
  */
6831
6735
  function _evaluateFunction() {
6832
- _evaluateFunction = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(expr, input, environment, applyto) {
6833
- var result, proc, evaluatedArgs, _loop, jj, procName;
6834
- return _regeneratorRuntime().wrap(function _callee24$(_context25) {
6835
- while (1) switch (_context25.prev = _context25.next) {
6736
+ _evaluateFunction = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(expr, input, environment, applyto) {
6737
+ var result, proc, evaluatedArgs, _loop, jj, procName, _t18;
6738
+ return _regenerator().w(function (_context23) {
6739
+ while (1) switch (_context23.p = _context23.n) {
6836
6740
  case 0:
6837
- _context25.next = 2;
6741
+ _context23.n = 1;
6838
6742
  return _evaluate2(expr.procedure, input, environment);
6839
- case 2:
6840
- proc = _context25.sent;
6743
+ case 1:
6744
+ proc = _context23.v;
6841
6745
  if (!(typeof proc === 'undefined' && expr.procedure.type === 'path' && environment.lookup(expr.procedure.steps[0].value))) {
6842
- _context25.next = 5;
6746
+ _context23.n = 2;
6843
6747
  break;
6844
6748
  }
6845
6749
  throw {
@@ -6848,44 +6752,41 @@ var jsonata = function () {
6848
6752
  position: expr.position,
6849
6753
  token: expr.procedure.steps[0].value
6850
6754
  };
6851
- case 5:
6755
+ case 2:
6852
6756
  evaluatedArgs = [];
6853
6757
  if (typeof applyto !== 'undefined') {
6854
6758
  evaluatedArgs.push(applyto.context);
6855
6759
  }
6856
6760
  // eager evaluation - evaluate the arguments
6857
- _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
6761
+ _loop = /*#__PURE__*/_regenerator().m(function _loop() {
6858
6762
  var arg, closure;
6859
- return _regeneratorRuntime().wrap(function _loop$(_context24) {
6860
- while (1) switch (_context24.prev = _context24.next) {
6763
+ return _regenerator().w(function (_context22) {
6764
+ while (1) switch (_context22.n) {
6861
6765
  case 0:
6862
- _context24.next = 2;
6766
+ _context22.n = 1;
6863
6767
  return _evaluate2(expr.arguments[jj], input, environment);
6864
- case 2:
6865
- arg = _context24.sent;
6768
+ case 1:
6769
+ arg = _context22.v;
6866
6770
  if (isFunction(arg)) {
6867
6771
  // wrap this in a closure
6868
6772
  closure = /*#__PURE__*/function () {
6869
- var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
6773
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21() {
6870
6774
  var _len,
6871
6775
  params,
6872
6776
  _key,
6873
- _args23 = arguments;
6874
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
6875
- while (1) switch (_context23.prev = _context23.next) {
6777
+ _args21 = arguments;
6778
+ return _regenerator().w(function (_context21) {
6779
+ while (1) switch (_context21.n) {
6876
6780
  case 0:
6877
- for (_len = _args23.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
6878
- params[_key] = _args23[_key];
6781
+ for (_len = _args21.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
6782
+ params[_key] = _args21[_key];
6879
6783
  }
6880
- _context23.next = 3;
6784
+ _context21.n = 1;
6881
6785
  return apply(arg, params, null, environment);
6882
- case 3:
6883
- return _context23.abrupt("return", _context23.sent);
6884
- case 4:
6885
- case "end":
6886
- return _context23.stop();
6786
+ case 1:
6787
+ return _context21.a(2, _context21.v);
6887
6788
  }
6888
- }, _callee23);
6789
+ }, _callee21);
6889
6790
  }));
6890
6791
  return function closure() {
6891
6792
  return _ref7.apply(this, arguments);
@@ -6896,60 +6797,56 @@ var jsonata = function () {
6896
6797
  } else {
6897
6798
  evaluatedArgs.push(arg);
6898
6799
  }
6899
- case 4:
6900
- case "end":
6901
- return _context24.stop();
6800
+ case 2:
6801
+ return _context22.a(2);
6902
6802
  }
6903
6803
  }, _loop);
6904
6804
  });
6905
6805
  jj = 0;
6906
- case 9:
6806
+ case 3:
6907
6807
  if (!(jj < expr.arguments.length)) {
6908
- _context25.next = 14;
6808
+ _context23.n = 5;
6909
6809
  break;
6910
6810
  }
6911
- return _context25.delegateYield(_loop(), "t0", 11);
6912
- case 11:
6811
+ return _context23.d(_regeneratorValues(_loop()), 4);
6812
+ case 4:
6913
6813
  jj++;
6914
- _context25.next = 9;
6814
+ _context23.n = 3;
6915
6815
  break;
6916
- case 14:
6816
+ case 5:
6917
6817
  // apply the procedure
6918
6818
  procName = expr.procedure.type === 'path' ? expr.procedure.steps[0].value : expr.procedure.value;
6919
- _context25.prev = 15;
6819
+ _context23.p = 6;
6920
6820
  if (_typeof(proc) === 'object') {
6921
6821
  proc.token = procName;
6922
6822
  proc.position = expr.position;
6923
6823
  }
6924
- _context25.next = 19;
6824
+ _context23.n = 7;
6925
6825
  return apply(proc, evaluatedArgs, input, environment);
6926
- case 19:
6927
- result = _context25.sent;
6928
- _context25.next = 27;
6826
+ case 7:
6827
+ result = _context23.v;
6828
+ _context23.n = 9;
6929
6829
  break;
6930
- case 22:
6931
- _context25.prev = 22;
6932
- _context25.t1 = _context25["catch"](15);
6933
- if (!_context25.t1.position) {
6830
+ case 8:
6831
+ _context23.p = 8;
6832
+ _t18 = _context23.v;
6833
+ if (!_t18.position) {
6934
6834
  // add the position field to the error
6935
- _context25.t1.position = expr.position;
6835
+ _t18.position = expr.position;
6936
6836
  }
6937
- if (!_context25.t1.token) {
6837
+ if (!_t18.token) {
6938
6838
  // and the function identifier
6939
- _context25.t1.token = procName;
6839
+ _t18.token = procName;
6940
6840
  }
6941
- throw _context25.t1;
6942
- case 27:
6943
- return _context25.abrupt("return", result);
6944
- case 28:
6945
- case "end":
6946
- return _context25.stop();
6841
+ throw _t18;
6842
+ case 9:
6843
+ return _context23.a(2, result);
6947
6844
  }
6948
- }, _callee24, null, [[15, 22]]);
6845
+ }, _callee22, null, [[6, 8]]);
6949
6846
  }));
6950
6847
  return _evaluateFunction.apply(this, arguments);
6951
6848
  }
6952
- function apply(_x53, _x54, _x55, _x56) {
6849
+ function apply(_x51, _x52, _x53, _x54) {
6953
6850
  return _apply.apply(this, arguments);
6954
6851
  }
6955
6852
  /**
@@ -6961,63 +6858,60 @@ var jsonata = function () {
6961
6858
  * @returns {*} Result of procedure
6962
6859
  */
6963
6860
  function _apply() {
6964
- _apply = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25(proc, args, input, environment) {
6965
- var result, next, evaluatedArgs, ii;
6966
- return _regeneratorRuntime().wrap(function _callee25$(_context26) {
6967
- while (1) switch (_context26.prev = _context26.next) {
6861
+ _apply = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(proc, args, input, environment) {
6862
+ var result, next, evaluatedArgs, ii, _t19, _t20;
6863
+ return _regenerator().w(function (_context24) {
6864
+ while (1) switch (_context24.n) {
6968
6865
  case 0:
6969
- _context26.next = 2;
6866
+ _context24.n = 1;
6970
6867
  return applyInner(proc, args, input, environment);
6868
+ case 1:
6869
+ result = _context24.v;
6971
6870
  case 2:
6972
- result = _context26.sent;
6973
- case 3:
6974
6871
  if (!(isLambda(result) && result.thunk === true)) {
6975
- _context26.next = 25;
6872
+ _context24.n = 9;
6976
6873
  break;
6977
6874
  }
6978
- _context26.next = 6;
6875
+ _context24.n = 3;
6979
6876
  return _evaluate2(result.body.procedure, result.input, result.environment);
6980
- case 6:
6981
- next = _context26.sent;
6877
+ case 3:
6878
+ next = _context24.v;
6982
6879
  if (result.body.procedure.type === 'variable') {
6983
6880
  next.token = result.body.procedure.value;
6984
6881
  }
6985
6882
  next.position = result.body.procedure.position;
6986
6883
  evaluatedArgs = [];
6987
6884
  ii = 0;
6988
- case 11:
6885
+ case 4:
6989
6886
  if (!(ii < result.body.arguments.length)) {
6990
- _context26.next = 20;
6887
+ _context24.n = 7;
6991
6888
  break;
6992
6889
  }
6993
- _context26.t0 = evaluatedArgs;
6994
- _context26.next = 15;
6890
+ _t19 = evaluatedArgs;
6891
+ _context24.n = 5;
6995
6892
  return _evaluate2(result.body.arguments[ii], result.input, result.environment);
6996
- case 15:
6997
- _context26.t1 = _context26.sent;
6998
- _context26.t0.push.call(_context26.t0, _context26.t1);
6999
- case 17:
6893
+ case 5:
6894
+ _t20 = _context24.v;
6895
+ _t19.push.call(_t19, _t20);
6896
+ case 6:
7000
6897
  ii++;
7001
- _context26.next = 11;
6898
+ _context24.n = 4;
7002
6899
  break;
7003
- case 20:
7004
- _context26.next = 22;
6900
+ case 7:
6901
+ _context24.n = 8;
7005
6902
  return applyInner(next, evaluatedArgs, input, environment);
7006
- case 22:
7007
- result = _context26.sent;
7008
- _context26.next = 3;
6903
+ case 8:
6904
+ result = _context24.v;
6905
+ _context24.n = 2;
7009
6906
  break;
7010
- case 25:
7011
- return _context26.abrupt("return", result);
7012
- case 26:
7013
- case "end":
7014
- return _context26.stop();
6907
+ case 9:
6908
+ return _context24.a(2, result);
7015
6909
  }
7016
- }, _callee25);
6910
+ }, _callee23);
7017
6911
  }));
7018
6912
  return _apply.apply(this, arguments);
7019
6913
  }
7020
- function applyInner(_x57, _x58, _x59, _x60) {
6914
+ function applyInner(_x55, _x56, _x57, _x58) {
7021
6915
  return _applyInner.apply(this, arguments);
7022
6916
  }
7023
6917
  /**
@@ -7028,29 +6922,29 @@ var jsonata = function () {
7028
6922
  * @returns {{lambda: boolean, input: *, environment: *, arguments: *, body: *}} Evaluated input data
7029
6923
  */
7030
6924
  function _applyInner() {
7031
- _applyInner = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26(proc, args, input, environment) {
7032
- var result, validatedArgs, focus;
7033
- return _regeneratorRuntime().wrap(function _callee26$(_context27) {
7034
- while (1) switch (_context27.prev = _context27.next) {
6925
+ _applyInner = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24(proc, args, input, environment) {
6926
+ var result, validatedArgs, focus, _t21;
6927
+ return _regenerator().w(function (_context25) {
6928
+ while (1) switch (_context25.p = _context25.n) {
7035
6929
  case 0:
7036
- _context27.prev = 0;
6930
+ _context25.p = 0;
7037
6931
  validatedArgs = args;
7038
6932
  if (proc) {
7039
6933
  validatedArgs = validateArguments(proc.signature, args, input);
7040
6934
  }
7041
6935
  if (!isLambda(proc)) {
7042
- _context27.next = 9;
6936
+ _context25.n = 2;
7043
6937
  break;
7044
6938
  }
7045
- _context27.next = 6;
6939
+ _context25.n = 1;
7046
6940
  return applyProcedure(proc, validatedArgs);
7047
- case 6:
7048
- result = _context27.sent;
7049
- _context27.next = 28;
6941
+ case 1:
6942
+ result = _context25.v;
6943
+ _context25.n = 9;
7050
6944
  break;
7051
- case 9:
6945
+ case 2:
7052
6946
  if (!(proc && proc._jsonata_function === true)) {
7053
- _context27.next = 19;
6947
+ _context25.n = 5;
7054
6948
  break;
7055
6949
  }
7056
6950
  focus = {
@@ -7064,19 +6958,19 @@ var jsonata = function () {
7064
6958
  result = result.next().value;
7065
6959
  }
7066
6960
  if (!isPromise(result)) {
7067
- _context27.next = 17;
6961
+ _context25.n = 4;
7068
6962
  break;
7069
6963
  }
7070
- _context27.next = 16;
6964
+ _context25.n = 3;
7071
6965
  return result;
7072
- case 16:
7073
- result = _context27.sent;
7074
- case 17:
7075
- _context27.next = 28;
6966
+ case 3:
6967
+ result = _context25.v;
6968
+ case 4:
6969
+ _context25.n = 9;
7076
6970
  break;
7077
- case 19:
6971
+ case 5:
7078
6972
  if (!(typeof proc === 'function')) {
7079
- _context27.next = 27;
6973
+ _context25.n = 8;
7080
6974
  break;
7081
6975
  }
7082
6976
  // typically these are functions that are returned by the invocation of plugin functions
@@ -7085,41 +6979,38 @@ var jsonata = function () {
7085
6979
  // e.g. await (await $func())
7086
6980
  result = proc.apply(input, validatedArgs);
7087
6981
  if (!isPromise(result)) {
7088
- _context27.next = 25;
6982
+ _context25.n = 7;
7089
6983
  break;
7090
6984
  }
7091
- _context27.next = 24;
6985
+ _context25.n = 6;
7092
6986
  return result;
7093
- case 24:
7094
- result = _context27.sent;
7095
- case 25:
7096
- _context27.next = 28;
6987
+ case 6:
6988
+ result = _context25.v;
6989
+ case 7:
6990
+ _context25.n = 9;
7097
6991
  break;
7098
- case 27:
6992
+ case 8:
7099
6993
  throw {
7100
6994
  code: "T1006",
7101
6995
  stack: new Error().stack
7102
6996
  };
7103
- case 28:
7104
- _context27.next = 34;
6997
+ case 9:
6998
+ _context25.n = 11;
7105
6999
  break;
7106
- case 30:
7107
- _context27.prev = 30;
7108
- _context27.t0 = _context27["catch"](0);
7000
+ case 10:
7001
+ _context25.p = 10;
7002
+ _t21 = _context25.v;
7109
7003
  if (proc) {
7110
- if (typeof _context27.t0.token == 'undefined' && typeof proc.token !== 'undefined') {
7111
- _context27.t0.token = proc.token;
7004
+ if (typeof _t21.token == 'undefined' && typeof proc.token !== 'undefined') {
7005
+ _t21.token = proc.token;
7112
7006
  }
7113
- _context27.t0.position = proc.position || _context27.t0.position;
7007
+ _t21.position = proc.position || _t21.position;
7114
7008
  }
7115
- throw _context27.t0;
7116
- case 34:
7117
- return _context27.abrupt("return", result);
7118
- case 35:
7119
- case "end":
7120
- return _context27.stop();
7009
+ throw _t21;
7010
+ case 11:
7011
+ return _context25.a(2, result);
7121
7012
  }
7122
- }, _callee26, null, [[0, 30]]);
7013
+ }, _callee24, null, [[0, 10]]);
7123
7014
  }));
7124
7015
  return _applyInner.apply(this, arguments);
7125
7016
  }
@@ -7137,21 +7028,18 @@ var jsonata = function () {
7137
7028
  procedure.thunk = true;
7138
7029
  }
7139
7030
  procedure.apply = /*#__PURE__*/function () {
7140
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(self, args) {
7141
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
7142
- while (1) switch (_context2.prev = _context2.next) {
7031
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(self, args) {
7032
+ return _regenerator().w(function (_context2) {
7033
+ while (1) switch (_context2.n) {
7143
7034
  case 0:
7144
- _context2.next = 2;
7035
+ _context2.n = 1;
7145
7036
  return apply(procedure, args, input, !!self ? self.environment : environment);
7146
- case 2:
7147
- return _context2.abrupt("return", _context2.sent);
7148
- case 3:
7149
- case "end":
7150
- return _context2.stop();
7037
+ case 1:
7038
+ return _context2.a(2, _context2.v);
7151
7039
  }
7152
7040
  }, _callee2);
7153
7041
  }));
7154
- return function (_x61, _x62) {
7042
+ return function (_x59, _x60) {
7155
7043
  return _ref2.apply(this, arguments);
7156
7044
  };
7157
7045
  }();
@@ -7165,7 +7053,7 @@ var jsonata = function () {
7165
7053
  * @param {Object} environment - Environment
7166
7054
  * @returns {*} Evaluated input data
7167
7055
  */
7168
- function evaluatePartialApplication(_x63, _x64, _x65) {
7056
+ function evaluatePartialApplication(_x61, _x62, _x63) {
7169
7057
  return _evaluatePartialApplication.apply(this, arguments);
7170
7058
  }
7171
7059
  /**
@@ -7176,46 +7064,46 @@ var jsonata = function () {
7176
7064
  * @returns {Array} - validated arguments
7177
7065
  */
7178
7066
  function _evaluatePartialApplication() {
7179
- _evaluatePartialApplication = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27(expr, input, environment) {
7180
- var result, evaluatedArgs, ii, arg, proc;
7181
- return _regeneratorRuntime().wrap(function _callee27$(_context28) {
7182
- while (1) switch (_context28.prev = _context28.next) {
7067
+ _evaluatePartialApplication = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25(expr, input, environment) {
7068
+ var result, evaluatedArgs, ii, arg, proc, _t22, _t23;
7069
+ return _regenerator().w(function (_context26) {
7070
+ while (1) switch (_context26.n) {
7183
7071
  case 0:
7184
7072
  // partially apply a function
7185
7073
  // evaluate the arguments
7186
7074
  evaluatedArgs = [];
7187
7075
  ii = 0;
7188
- case 2:
7076
+ case 1:
7189
7077
  if (!(ii < expr.arguments.length)) {
7190
- _context28.next = 16;
7078
+ _context26.n = 5;
7191
7079
  break;
7192
7080
  }
7193
7081
  arg = expr.arguments[ii];
7194
7082
  if (!(arg.type === 'operator' && arg.value === '?')) {
7195
- _context28.next = 8;
7083
+ _context26.n = 2;
7196
7084
  break;
7197
7085
  }
7198
7086
  evaluatedArgs.push(arg);
7199
- _context28.next = 13;
7087
+ _context26.n = 4;
7200
7088
  break;
7201
- case 8:
7202
- _context28.t0 = evaluatedArgs;
7203
- _context28.next = 11;
7089
+ case 2:
7090
+ _t22 = evaluatedArgs;
7091
+ _context26.n = 3;
7204
7092
  return _evaluate2(arg, input, environment);
7205
- case 11:
7206
- _context28.t1 = _context28.sent;
7207
- _context28.t0.push.call(_context28.t0, _context28.t1);
7208
- case 13:
7093
+ case 3:
7094
+ _t23 = _context26.v;
7095
+ _t22.push.call(_t22, _t23);
7096
+ case 4:
7209
7097
  ii++;
7210
- _context28.next = 2;
7098
+ _context26.n = 1;
7211
7099
  break;
7212
- case 16:
7213
- _context28.next = 18;
7100
+ case 5:
7101
+ _context26.n = 6;
7214
7102
  return _evaluate2(expr.procedure, input, environment);
7215
- case 18:
7216
- proc = _context28.sent;
7103
+ case 6:
7104
+ proc = _context26.v;
7217
7105
  if (!(typeof proc === 'undefined' && expr.procedure.type === 'path' && environment.lookup(expr.procedure.steps[0].value))) {
7218
- _context28.next = 21;
7106
+ _context26.n = 7;
7219
7107
  break;
7220
7108
  }
7221
7109
  throw {
@@ -7224,44 +7112,41 @@ var jsonata = function () {
7224
7112
  position: expr.position,
7225
7113
  token: expr.procedure.steps[0].value
7226
7114
  };
7227
- case 21:
7115
+ case 7:
7228
7116
  if (!isLambda(proc)) {
7229
- _context28.next = 25;
7117
+ _context26.n = 8;
7230
7118
  break;
7231
7119
  }
7232
7120
  result = partialApplyProcedure(proc, evaluatedArgs);
7233
- _context28.next = 34;
7121
+ _context26.n = 11;
7234
7122
  break;
7235
- case 25:
7123
+ case 8:
7236
7124
  if (!(proc && proc._jsonata_function === true)) {
7237
- _context28.next = 29;
7125
+ _context26.n = 9;
7238
7126
  break;
7239
7127
  }
7240
7128
  result = partialApplyNativeFunction(proc.implementation, evaluatedArgs);
7241
- _context28.next = 34;
7129
+ _context26.n = 11;
7242
7130
  break;
7243
- case 29:
7131
+ case 9:
7244
7132
  if (!(typeof proc === 'function')) {
7245
- _context28.next = 33;
7133
+ _context26.n = 10;
7246
7134
  break;
7247
7135
  }
7248
7136
  result = partialApplyNativeFunction(proc, evaluatedArgs);
7249
- _context28.next = 34;
7137
+ _context26.n = 11;
7250
7138
  break;
7251
- case 33:
7139
+ case 10:
7252
7140
  throw {
7253
7141
  code: "T1008",
7254
7142
  stack: new Error().stack,
7255
7143
  position: expr.position,
7256
7144
  token: expr.procedure.type === 'path' ? expr.procedure.steps[0].value : expr.procedure.value
7257
7145
  };
7258
- case 34:
7259
- return _context28.abrupt("return", result);
7260
- case 35:
7261
- case "end":
7262
- return _context28.stop();
7146
+ case 11:
7147
+ return _context26.a(2, result);
7263
7148
  }
7264
- }, _callee27);
7149
+ }, _callee25);
7265
7150
  }));
7266
7151
  return _evaluatePartialApplication.apply(this, arguments);
7267
7152
  }
@@ -7280,7 +7165,7 @@ var jsonata = function () {
7280
7165
  * @param {Array} args - Arguments
7281
7166
  * @returns {*} Result of procedure
7282
7167
  */
7283
- function applyProcedure(_x66, _x67) {
7168
+ function applyProcedure(_x64, _x65) {
7284
7169
  return _applyProcedure.apply(this, arguments);
7285
7170
  }
7286
7171
  /**
@@ -7290,37 +7175,34 @@ var jsonata = function () {
7290
7175
  * @returns {{lambda: boolean, input: *, environment: {bind, lookup}, arguments: Array, body: *}} Result of partially applied procedure
7291
7176
  */
7292
7177
  function _applyProcedure() {
7293
- _applyProcedure = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28(proc, args) {
7178
+ _applyProcedure = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(proc, args) {
7294
7179
  var result, env;
7295
- return _regeneratorRuntime().wrap(function _callee28$(_context29) {
7296
- while (1) switch (_context29.prev = _context29.next) {
7180
+ return _regenerator().w(function (_context27) {
7181
+ while (1) switch (_context27.n) {
7297
7182
  case 0:
7298
7183
  env = createFrame(proc.environment);
7299
7184
  proc.arguments.forEach(function (param, index) {
7300
7185
  env.bind(param.value, args[index]);
7301
7186
  });
7302
7187
  if (!(typeof proc.body === 'function')) {
7303
- _context29.next = 8;
7188
+ _context27.n = 2;
7304
7189
  break;
7305
7190
  }
7306
- _context29.next = 5;
7191
+ _context27.n = 1;
7307
7192
  return applyNativeFunction(proc.body, env);
7308
- case 5:
7309
- result = _context29.sent;
7310
- _context29.next = 11;
7193
+ case 1:
7194
+ result = _context27.v;
7195
+ _context27.n = 4;
7311
7196
  break;
7312
- case 8:
7313
- _context29.next = 10;
7197
+ case 2:
7198
+ _context27.n = 3;
7314
7199
  return _evaluate2(proc.body, proc.input, env);
7315
- case 10:
7316
- result = _context29.sent;
7317
- case 11:
7318
- return _context29.abrupt("return", result);
7319
- case 12:
7320
- case "end":
7321
- return _context29.stop();
7200
+ case 3:
7201
+ result = _context27.v;
7202
+ case 4:
7203
+ return _context27.a(2, result);
7322
7204
  }
7323
- }, _callee28);
7205
+ }, _callee26);
7324
7206
  }));
7325
7207
  return _applyProcedure.apply(this, arguments);
7326
7208
  }
@@ -7373,7 +7255,7 @@ var jsonata = function () {
7373
7255
  * @param {Object} env - Environment
7374
7256
  * @returns {*} Result of applying native function
7375
7257
  */
7376
- function applyNativeFunction(_x68, _x69) {
7258
+ function applyNativeFunction(_x66, _x67) {
7377
7259
  return _applyNativeFunction.apply(this, arguments);
7378
7260
  }
7379
7261
  /**
@@ -7382,10 +7264,10 @@ var jsonata = function () {
7382
7264
  * @returns {*|Array} Native function arguments
7383
7265
  */
7384
7266
  function _applyNativeFunction() {
7385
- _applyNativeFunction = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29(proc, env) {
7267
+ _applyNativeFunction = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(proc, env) {
7386
7268
  var sigArgs, args, focus, result;
7387
- return _regeneratorRuntime().wrap(function _callee29$(_context30) {
7388
- while (1) switch (_context30.prev = _context30.next) {
7269
+ return _regenerator().w(function (_context28) {
7270
+ while (1) switch (_context28.n) {
7389
7271
  case 0:
7390
7272
  sigArgs = getNativeFunctionArguments(proc); // generate the array of arguments for invoking the function - look them up in the environment
7391
7273
  args = sigArgs.map(function (sigArg) {
@@ -7396,20 +7278,17 @@ var jsonata = function () {
7396
7278
  };
7397
7279
  result = proc.apply(focus, args);
7398
7280
  if (!isPromise(result)) {
7399
- _context30.next = 8;
7281
+ _context28.n = 2;
7400
7282
  break;
7401
7283
  }
7402
- _context30.next = 7;
7284
+ _context28.n = 1;
7403
7285
  return result;
7404
- case 7:
7405
- result = _context30.sent;
7406
- case 8:
7407
- return _context30.abrupt("return", result);
7408
- case 9:
7409
- case "end":
7410
- return _context30.stop();
7286
+ case 1:
7287
+ result = _context28.v;
7288
+ case 2:
7289
+ return _context28.a(2, result);
7411
7290
  }
7412
- }, _callee29);
7291
+ }, _callee27);
7413
7292
  }));
7414
7293
  return _applyNativeFunction.apply(this, arguments);
7415
7294
  }
@@ -7442,7 +7321,7 @@ var jsonata = function () {
7442
7321
  * @param {string} expr - expression to evaluate
7443
7322
  * @returns {*} - result of evaluating the expression
7444
7323
  */
7445
- function functionEval(_x70, _x71) {
7324
+ function functionEval(_x68, _x69) {
7446
7325
  return _functionEval.apply(this, arguments);
7447
7326
  }
7448
7327
  /**
@@ -7451,17 +7330,17 @@ var jsonata = function () {
7451
7330
  * @returns {*} - the cloned object
7452
7331
  */
7453
7332
  function _functionEval() {
7454
- _functionEval = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30(expr, focus) {
7455
- var input, ast, result;
7456
- return _regeneratorRuntime().wrap(function _callee30$(_context31) {
7457
- while (1) switch (_context31.prev = _context31.next) {
7333
+ _functionEval = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(expr, focus) {
7334
+ var input, ast, result, _t24, _t25;
7335
+ return _regenerator().w(function (_context29) {
7336
+ while (1) switch (_context29.p = _context29.n) {
7458
7337
  case 0:
7459
7338
  if (!(typeof expr === 'undefined')) {
7460
- _context31.next = 2;
7339
+ _context29.n = 1;
7461
7340
  break;
7462
7341
  }
7463
- return _context31.abrupt("return", undefined);
7464
- case 2:
7342
+ return _context29.a(2, undefined);
7343
+ case 1:
7465
7344
  input = this.input;
7466
7345
  if (typeof focus !== 'undefined') {
7467
7346
  input = focus;
@@ -7471,47 +7350,44 @@ var jsonata = function () {
7471
7350
  input.outerWrapper = true;
7472
7351
  }
7473
7352
  }
7474
- _context31.prev = 4;
7353
+ _context29.p = 2;
7475
7354
  ast = parser(expr, false);
7476
- _context31.next = 12;
7355
+ _context29.n = 4;
7477
7356
  break;
7478
- case 8:
7479
- _context31.prev = 8;
7480
- _context31.t0 = _context31["catch"](4);
7357
+ case 3:
7358
+ _context29.p = 3;
7359
+ _t24 = _context29.v;
7481
7360
  // error parsing the expression passed to $eval
7482
- populateMessage(_context31.t0);
7361
+ populateMessage(_t24);
7483
7362
  throw {
7484
7363
  stack: new Error().stack,
7485
7364
  code: "D3120",
7486
- value: _context31.t0.message,
7487
- error: _context31.t0
7365
+ value: _t24.message,
7366
+ error: _t24
7488
7367
  };
7489
- case 12:
7490
- _context31.prev = 12;
7491
- _context31.next = 15;
7368
+ case 4:
7369
+ _context29.p = 4;
7370
+ _context29.n = 5;
7492
7371
  return _evaluate2(ast, input, this.environment);
7493
- case 15:
7494
- result = _context31.sent;
7495
- _context31.next = 22;
7372
+ case 5:
7373
+ result = _context29.v;
7374
+ _context29.n = 7;
7496
7375
  break;
7497
- case 18:
7498
- _context31.prev = 18;
7499
- _context31.t1 = _context31["catch"](12);
7376
+ case 6:
7377
+ _context29.p = 6;
7378
+ _t25 = _context29.v;
7500
7379
  // error evaluating the expression passed to $eval
7501
- populateMessage(_context31.t1);
7380
+ populateMessage(_t25);
7502
7381
  throw {
7503
7382
  stack: new Error().stack,
7504
7383
  code: "D3121",
7505
- value: _context31.t1.message,
7506
- error: _context31.t1
7384
+ value: _t25.message,
7385
+ error: _t25
7507
7386
  };
7508
- case 22:
7509
- return _context31.abrupt("return", result);
7510
- case 23:
7511
- case "end":
7512
- return _context31.stop();
7387
+ case 7:
7388
+ return _context29.a(2, result);
7513
7389
  }
7514
- }, _callee30, this, [[4, 8], [12, 18]]);
7390
+ }, _callee28, this, [[4, 6], [2, 3]]);
7515
7391
  }));
7516
7392
  return _functionEval.apply(this, arguments);
7517
7393
  }
@@ -7799,13 +7675,13 @@ var jsonata = function () {
7799
7675
  }
7800
7676
  return {
7801
7677
  evaluate: function () {
7802
- var _evaluate3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(input, bindings, callback) {
7803
- var err, exec_env, v, it;
7804
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
7805
- while (1) switch (_context3.prev = _context3.next) {
7678
+ var _evaluate3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(input, bindings, callback) {
7679
+ var err, exec_env, v, it, _t;
7680
+ return _regenerator().w(function (_context3) {
7681
+ while (1) switch (_context3.p = _context3.n) {
7806
7682
  case 0:
7807
7683
  if (!(typeof _errors !== 'undefined')) {
7808
- _context3.next = 4;
7684
+ _context3.n = 1;
7809
7685
  break;
7810
7686
  }
7811
7687
  err = {
@@ -7814,7 +7690,7 @@ var jsonata = function () {
7814
7690
  };
7815
7691
  populateMessage(err); // possible side-effects on `err`
7816
7692
  throw err;
7817
- case 4:
7693
+ case 1:
7818
7694
  if (typeof bindings !== 'undefined') {
7819
7695
  // the variable bindings have been passed in - create a frame to hold these
7820
7696
  exec_env = createFrame(environment);
@@ -7837,28 +7713,27 @@ var jsonata = function () {
7837
7713
  input = createSequence(input);
7838
7714
  input.outerWrapper = true;
7839
7715
  }
7840
- _context3.prev = 9;
7841
- _context3.next = 12;
7716
+ _context3.p = 2;
7717
+ _context3.n = 3;
7842
7718
  return _evaluate2(_ast, input, exec_env);
7843
- case 12:
7844
- it = _context3.sent;
7719
+ case 3:
7720
+ it = _context3.v;
7845
7721
  if (typeof callback === "function") {
7846
7722
  callback(null, it);
7847
7723
  }
7848
- return _context3.abrupt("return", it);
7849
- case 17:
7850
- _context3.prev = 17;
7851
- _context3.t0 = _context3["catch"](9);
7724
+ return _context3.a(2, it);
7725
+ case 4:
7726
+ _context3.p = 4;
7727
+ _t = _context3.v;
7852
7728
  // insert error message into structure
7853
- populateMessage(_context3.t0); // possible side-effects on `err`
7854
- throw _context3.t0;
7855
- case 21:
7856
- case "end":
7857
- return _context3.stop();
7729
+ populateMessage(_t); // possible side-effects on `err`
7730
+ throw _t;
7731
+ case 5:
7732
+ return _context3.a(2);
7858
7733
  }
7859
- }, _callee3, null, [[9, 17]]);
7734
+ }, _callee3, null, [[2, 4]]);
7860
7735
  }));
7861
- function evaluate(_x72, _x73, _x74) {
7736
+ function evaluate(_x70, _x71, _x72) {
7862
7737
  return _evaluate3.apply(this, arguments);
7863
7738
  }
7864
7739
  return evaluate;
@@ -7927,6 +7802,8 @@ var parser = function () {
7927
7802
  '<=': 40,
7928
7803
  '>=': 40,
7929
7804
  '~>': 40,
7805
+ '?:': 40,
7806
+ '??': 40,
7930
7807
  'and': 30,
7931
7808
  'or': 25,
7932
7809
  'in': 40,
@@ -8084,6 +7961,16 @@ var parser = function () {
8084
7961
  position += 2;
8085
7962
  return create('operator', '~>');
8086
7963
  }
7964
+ if (currentChar === '?' && path.charAt(position + 1) === ':') {
7965
+ // ?: default / elvis operator
7966
+ position += 2;
7967
+ return create('operator', '?:');
7968
+ }
7969
+ if (currentChar === '?' && path.charAt(position + 1) === '?') {
7970
+ // ?? coalescing operator
7971
+ position += 2;
7972
+ return create('operator', '??');
7973
+ }
8087
7974
  // test for single char operators
8088
7975
  if (Object.prototype.hasOwnProperty.call(operators, currentChar)) {
8089
7976
  position++;
@@ -8445,6 +8332,22 @@ var parser = function () {
8445
8332
  prefix("-"); // unary numeric negation
8446
8333
  infix("~>"); // function application
8447
8334
 
8335
+ // coalescing operator
8336
+ infix("??", operators['??'], function (left) {
8337
+ this.type = 'condition';
8338
+ this.condition = {
8339
+ type: 'function',
8340
+ value: '(',
8341
+ procedure: {
8342
+ type: 'variable',
8343
+ value: 'exists'
8344
+ },
8345
+ arguments: [left]
8346
+ };
8347
+ this.then = left;
8348
+ this["else"] = expression(0);
8349
+ return this;
8350
+ });
8448
8351
  infixr("(error)", 10, function (left) {
8449
8352
  this.lhs = left;
8450
8353
  this.error = node.error;
@@ -8731,6 +8634,15 @@ var parser = function () {
8731
8634
  return this;
8732
8635
  });
8733
8636
 
8637
+ // elvis/default operator
8638
+ infix("?:", operators['?:'], function (left) {
8639
+ this.type = 'condition';
8640
+ this.condition = left;
8641
+ this.then = left;
8642
+ this["else"] = expression(0);
8643
+ return this;
8644
+ });
8645
+
8734
8646
  // object transformer
8735
8647
  prefix("|", function () {
8736
8648
  this.type = 'transform';