@nocobase/plugin-workflow-json-query 1.9.8 → 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.
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +4 -4
- package/dist/node_modules/jmespath/package.json +1 -1
- package/dist/node_modules/jsonata/jsonata-es5.js +1178 -1266
- package/dist/node_modules/jsonata/jsonata-es5.min.js +1 -1
- package/dist/node_modules/jsonata/jsonata.js +1 -1
- package/dist/node_modules/jsonata/jsonata.min.js +1 -1
- package/dist/node_modules/jsonata/package.json +1 -1
- package/dist/node_modules/jsonpath-plus/package.json +1 -1
- package/package.json +3 -3
|
@@ -1520,7 +1520,7 @@ var dateTime = function () {
|
|
|
1520
1520
|
def.integerFormat.mandatoryDigits = def.width.min;
|
|
1521
1521
|
}
|
|
1522
1522
|
}
|
|
1523
|
-
if (
|
|
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 =
|
|
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
|
|
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__*/
|
|
2595
|
+
_evaluateMatcher = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(matcher, str) {
|
|
2594
2596
|
var result;
|
|
2595
|
-
return
|
|
2596
|
-
while (1) switch (_context.
|
|
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.
|
|
2602
|
+
_context.n = 2;
|
|
2601
2603
|
break;
|
|
2602
2604
|
}
|
|
2603
|
-
_context.
|
|
2605
|
+
_context.n = 1;
|
|
2604
2606
|
return result;
|
|
2605
|
-
case
|
|
2606
|
-
result = _context.
|
|
2607
|
-
case
|
|
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.
|
|
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
|
|
2617
|
-
return _context.
|
|
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__*/
|
|
2636
|
+
_contains = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(str, token) {
|
|
2638
2637
|
var result, matches;
|
|
2639
|
-
return
|
|
2640
|
-
while (1) switch (_context2.
|
|
2638
|
+
return _regenerator().w(function (_context2) {
|
|
2639
|
+
while (1) switch (_context2.n) {
|
|
2641
2640
|
case 0:
|
|
2642
2641
|
if (!(typeof str === 'undefined')) {
|
|
2643
|
-
_context2.
|
|
2642
|
+
_context2.n = 1;
|
|
2644
2643
|
break;
|
|
2645
2644
|
}
|
|
2646
|
-
return _context2.
|
|
2647
|
-
case
|
|
2645
|
+
return _context2.a(2, undefined);
|
|
2646
|
+
case 1:
|
|
2648
2647
|
if (!(typeof token === 'string')) {
|
|
2649
|
-
_context2.
|
|
2648
|
+
_context2.n = 2;
|
|
2650
2649
|
break;
|
|
2651
2650
|
}
|
|
2652
2651
|
result = str.indexOf(token) !== -1;
|
|
2653
|
-
_context2.
|
|
2652
|
+
_context2.n = 4;
|
|
2654
2653
|
break;
|
|
2655
|
-
case
|
|
2656
|
-
_context2.
|
|
2654
|
+
case 2:
|
|
2655
|
+
_context2.n = 3;
|
|
2657
2656
|
return evaluateMatcher(token, str);
|
|
2658
|
-
case
|
|
2659
|
-
matches = _context2.
|
|
2657
|
+
case 3:
|
|
2658
|
+
matches = _context2.v;
|
|
2660
2659
|
result = typeof matches !== 'undefined';
|
|
2661
|
-
case
|
|
2662
|
-
return _context2.
|
|
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__*/
|
|
2679
|
+
_match = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(str, regex, limit) {
|
|
2684
2680
|
var result, count, matches;
|
|
2685
|
-
return
|
|
2686
|
-
while (1) switch (_context3.
|
|
2681
|
+
return _regenerator().w(function (_context3) {
|
|
2682
|
+
while (1) switch (_context3.n) {
|
|
2687
2683
|
case 0:
|
|
2688
2684
|
if (!(typeof str === 'undefined')) {
|
|
2689
|
-
_context3.
|
|
2685
|
+
_context3.n = 1;
|
|
2690
2686
|
break;
|
|
2691
2687
|
}
|
|
2692
|
-
return _context3.
|
|
2693
|
-
case
|
|
2688
|
+
return _context3.a(2, undefined);
|
|
2689
|
+
case 1:
|
|
2694
2690
|
if (!(limit < 0)) {
|
|
2695
|
-
_context3.
|
|
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
|
|
2700
|
+
case 2:
|
|
2705
2701
|
result = createSequence();
|
|
2706
2702
|
if (!(typeof limit === 'undefined' || limit > 0)) {
|
|
2707
|
-
_context3.
|
|
2703
|
+
_context3.n = 6;
|
|
2708
2704
|
break;
|
|
2709
2705
|
}
|
|
2710
2706
|
count = 0;
|
|
2711
|
-
_context3.
|
|
2707
|
+
_context3.n = 3;
|
|
2712
2708
|
return evaluateMatcher(regex, str);
|
|
2713
|
-
case
|
|
2714
|
-
matches = _context3.
|
|
2709
|
+
case 3:
|
|
2710
|
+
matches = _context3.v;
|
|
2715
2711
|
if (!(typeof matches !== 'undefined')) {
|
|
2716
|
-
_context3.
|
|
2712
|
+
_context3.n = 6;
|
|
2717
2713
|
break;
|
|
2718
2714
|
}
|
|
2719
|
-
case
|
|
2715
|
+
case 4:
|
|
2720
2716
|
if (!(typeof matches !== 'undefined' && (typeof limit === 'undefined' || count < limit))) {
|
|
2721
|
-
_context3.
|
|
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.
|
|
2725
|
+
_context3.n = 5;
|
|
2730
2726
|
return evaluateMatcher(matches.next);
|
|
2731
|
-
case
|
|
2732
|
-
matches = _context3.
|
|
2727
|
+
case 5:
|
|
2728
|
+
matches = _context3.v;
|
|
2733
2729
|
count++;
|
|
2734
|
-
_context3.
|
|
2730
|
+
_context3.n = 4;
|
|
2735
2731
|
break;
|
|
2736
|
-
case
|
|
2737
|
-
return _context3.
|
|
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,
|
|
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__*/
|
|
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
|
|
2758
|
-
while (1) switch (_context4.
|
|
2750
|
+
return _regenerator().w(function (_context4) {
|
|
2751
|
+
while (1) switch (_context4.n) {
|
|
2759
2752
|
case 0:
|
|
2760
2753
|
if (!(typeof str === 'undefined')) {
|
|
2761
|
-
_context4.
|
|
2754
|
+
_context4.n = 1;
|
|
2762
2755
|
break;
|
|
2763
2756
|
}
|
|
2764
|
-
return _context4.
|
|
2765
|
-
case
|
|
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.
|
|
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
|
|
2770
|
+
case 2:
|
|
2778
2771
|
if (!(limit < 0)) {
|
|
2779
|
-
_context4.
|
|
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
|
|
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.
|
|
2837
|
+
_context4.n = 15;
|
|
2845
2838
|
break;
|
|
2846
2839
|
}
|
|
2847
2840
|
count = 0;
|
|
2848
2841
|
if (!(typeof pattern === 'string')) {
|
|
2849
|
-
_context4.
|
|
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.
|
|
2854
|
+
_context4.n = 14;
|
|
2862
2855
|
break;
|
|
2863
|
-
case
|
|
2864
|
-
_context4.
|
|
2856
|
+
case 4:
|
|
2857
|
+
_context4.n = 5;
|
|
2865
2858
|
return evaluateMatcher(pattern, str);
|
|
2866
|
-
case
|
|
2867
|
-
matches = _context4.
|
|
2859
|
+
case 5:
|
|
2860
|
+
matches = _context4.v;
|
|
2868
2861
|
if (!(typeof matches !== 'undefined')) {
|
|
2869
|
-
_context4.
|
|
2862
|
+
_context4.n = 13;
|
|
2870
2863
|
break;
|
|
2871
2864
|
}
|
|
2872
|
-
case
|
|
2865
|
+
case 6:
|
|
2873
2866
|
if (!(typeof matches !== 'undefined' && (typeof limit === 'undefined' || count < limit))) {
|
|
2874
|
-
_context4.
|
|
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.
|
|
2873
|
+
_context4.n = 8;
|
|
2881
2874
|
break;
|
|
2882
2875
|
}
|
|
2883
|
-
_context4.
|
|
2876
|
+
_context4.n = 7;
|
|
2884
2877
|
return replacedWith;
|
|
2885
|
-
case
|
|
2886
|
-
replacedWith = _context4.
|
|
2887
|
-
case
|
|
2878
|
+
case 7:
|
|
2879
|
+
replacedWith = _context4.v;
|
|
2880
|
+
case 8:
|
|
2888
2881
|
if (!(typeof replacedWith === 'string')) {
|
|
2889
|
-
_context4.
|
|
2882
|
+
_context4.n = 9;
|
|
2890
2883
|
break;
|
|
2891
2884
|
}
|
|
2892
2885
|
result += replacedWith;
|
|
2893
|
-
_context4.
|
|
2886
|
+
_context4.n = 10;
|
|
2894
2887
|
break;
|
|
2895
|
-
case
|
|
2888
|
+
case 9:
|
|
2896
2889
|
throw {
|
|
2897
2890
|
code: "D3012",
|
|
2898
2891
|
stack: new Error().stack,
|
|
2899
2892
|
value: replacedWith
|
|
2900
2893
|
};
|
|
2901
|
-
case
|
|
2894
|
+
case 10:
|
|
2902
2895
|
position = matches.start + matches.match.length;
|
|
2903
2896
|
count++;
|
|
2904
|
-
_context4.
|
|
2897
|
+
_context4.n = 11;
|
|
2905
2898
|
return evaluateMatcher(matches.next);
|
|
2906
|
-
case
|
|
2907
|
-
matches = _context4.
|
|
2908
|
-
_context4.
|
|
2899
|
+
case 11:
|
|
2900
|
+
matches = _context4.v;
|
|
2901
|
+
_context4.n = 6;
|
|
2909
2902
|
break;
|
|
2910
|
-
case
|
|
2903
|
+
case 12:
|
|
2911
2904
|
result += str.substring(position);
|
|
2912
|
-
_context4.
|
|
2905
|
+
_context4.n = 14;
|
|
2913
2906
|
break;
|
|
2914
|
-
case
|
|
2907
|
+
case 13:
|
|
2915
2908
|
result = str;
|
|
2916
|
-
case
|
|
2917
|
-
_context4.
|
|
2909
|
+
case 14:
|
|
2910
|
+
_context4.n = 16;
|
|
2918
2911
|
break;
|
|
2919
|
-
case
|
|
2912
|
+
case 15:
|
|
2920
2913
|
result = str;
|
|
2921
|
-
case
|
|
2922
|
-
return _context4.
|
|
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(
|
|
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__*/
|
|
3078
|
+
_split = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(str, separator, limit) {
|
|
3089
3079
|
var result, count, matches, start;
|
|
3090
|
-
return
|
|
3091
|
-
while (1) switch (_context5.
|
|
3080
|
+
return _regenerator().w(function (_context5) {
|
|
3081
|
+
while (1) switch (_context5.n) {
|
|
3092
3082
|
case 0:
|
|
3093
3083
|
if (!(typeof str === 'undefined')) {
|
|
3094
|
-
_context5.
|
|
3084
|
+
_context5.n = 1;
|
|
3095
3085
|
break;
|
|
3096
3086
|
}
|
|
3097
|
-
return _context5.
|
|
3098
|
-
case
|
|
3087
|
+
return _context5.a(2, undefined);
|
|
3088
|
+
case 1:
|
|
3099
3089
|
if (!(limit < 0)) {
|
|
3100
|
-
_context5.
|
|
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
|
|
3099
|
+
case 2:
|
|
3110
3100
|
result = [];
|
|
3111
3101
|
if (!(typeof limit === 'undefined' || limit > 0)) {
|
|
3112
|
-
_context5.
|
|
3102
|
+
_context5.n = 9;
|
|
3113
3103
|
break;
|
|
3114
3104
|
}
|
|
3115
3105
|
if (!(typeof separator === 'string')) {
|
|
3116
|
-
_context5.
|
|
3106
|
+
_context5.n = 3;
|
|
3117
3107
|
break;
|
|
3118
3108
|
}
|
|
3119
3109
|
result = str.split(separator, limit);
|
|
3120
|
-
_context5.
|
|
3110
|
+
_context5.n = 9;
|
|
3121
3111
|
break;
|
|
3122
|
-
case
|
|
3112
|
+
case 3:
|
|
3123
3113
|
count = 0;
|
|
3124
|
-
_context5.
|
|
3114
|
+
_context5.n = 4;
|
|
3125
3115
|
return evaluateMatcher(separator, str);
|
|
3126
|
-
case
|
|
3127
|
-
matches = _context5.
|
|
3116
|
+
case 4:
|
|
3117
|
+
matches = _context5.v;
|
|
3128
3118
|
if (!(typeof matches !== 'undefined')) {
|
|
3129
|
-
_context5.
|
|
3119
|
+
_context5.n = 8;
|
|
3130
3120
|
break;
|
|
3131
3121
|
}
|
|
3132
3122
|
start = 0;
|
|
3133
|
-
case
|
|
3123
|
+
case 5:
|
|
3134
3124
|
if (!(typeof matches !== 'undefined' && (typeof limit === 'undefined' || count < limit))) {
|
|
3135
|
-
_context5.
|
|
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.
|
|
3130
|
+
_context5.n = 6;
|
|
3141
3131
|
return evaluateMatcher(matches.next);
|
|
3142
|
-
case
|
|
3143
|
-
matches = _context5.
|
|
3132
|
+
case 6:
|
|
3133
|
+
matches = _context5.v;
|
|
3144
3134
|
count++;
|
|
3145
|
-
_context5.
|
|
3135
|
+
_context5.n = 5;
|
|
3146
3136
|
break;
|
|
3147
|
-
case
|
|
3137
|
+
case 7:
|
|
3148
3138
|
if (typeof limit === 'undefined' || count < limit) {
|
|
3149
3139
|
result.push(str.substring(start));
|
|
3150
3140
|
}
|
|
3151
|
-
_context5.
|
|
3141
|
+
_context5.n = 9;
|
|
3152
3142
|
break;
|
|
3153
|
-
case
|
|
3143
|
+
case 8:
|
|
3154
3144
|
result.push(str);
|
|
3155
|
-
case
|
|
3156
|
-
return _context5.
|
|
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 (
|
|
3411
|
-
return decimalDigitFamily.indexOf(
|
|
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(
|
|
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__*/
|
|
3852
|
+
_map = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(arr, func) {
|
|
3866
3853
|
var result, i, func_args, res;
|
|
3867
|
-
return
|
|
3868
|
-
while (1) switch (_context6.
|
|
3854
|
+
return _regenerator().w(function (_context6) {
|
|
3855
|
+
while (1) switch (_context6.n) {
|
|
3869
3856
|
case 0:
|
|
3870
3857
|
if (!(typeof arr === 'undefined')) {
|
|
3871
|
-
_context6.
|
|
3858
|
+
_context6.n = 1;
|
|
3872
3859
|
break;
|
|
3873
3860
|
}
|
|
3874
|
-
return _context6.
|
|
3875
|
-
case
|
|
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
|
|
3865
|
+
case 2:
|
|
3879
3866
|
if (!(i < arr.length)) {
|
|
3880
|
-
_context6.
|
|
3867
|
+
_context6.n = 5;
|
|
3881
3868
|
break;
|
|
3882
3869
|
}
|
|
3883
3870
|
func_args = hofFuncArgs(func, arr[i], i, arr); // invoke func
|
|
3884
|
-
_context6.
|
|
3871
|
+
_context6.n = 3;
|
|
3885
3872
|
return func.apply(this, func_args);
|
|
3886
|
-
case
|
|
3887
|
-
res = _context6.
|
|
3873
|
+
case 3:
|
|
3874
|
+
res = _context6.v;
|
|
3888
3875
|
if (typeof res !== 'undefined') {
|
|
3889
3876
|
result.push(res);
|
|
3890
3877
|
}
|
|
3891
|
-
case
|
|
3878
|
+
case 4:
|
|
3892
3879
|
i++;
|
|
3893
|
-
_context6.
|
|
3880
|
+
_context6.n = 2;
|
|
3894
3881
|
break;
|
|
3895
|
-
case
|
|
3896
|
-
return _context6.
|
|
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(
|
|
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__*/
|
|
3900
|
+
_filter = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(arr, func) {
|
|
3917
3901
|
var result, i, entry, func_args, res;
|
|
3918
|
-
return
|
|
3919
|
-
while (1) switch (_context7.
|
|
3902
|
+
return _regenerator().w(function (_context7) {
|
|
3903
|
+
while (1) switch (_context7.n) {
|
|
3920
3904
|
case 0:
|
|
3921
3905
|
if (!(typeof arr === 'undefined')) {
|
|
3922
|
-
_context7.
|
|
3906
|
+
_context7.n = 1;
|
|
3923
3907
|
break;
|
|
3924
3908
|
}
|
|
3925
|
-
return _context7.
|
|
3926
|
-
case
|
|
3909
|
+
return _context7.a(2, undefined);
|
|
3910
|
+
case 1:
|
|
3927
3911
|
result = createSequence();
|
|
3928
3912
|
i = 0;
|
|
3929
|
-
case
|
|
3913
|
+
case 2:
|
|
3930
3914
|
if (!(i < arr.length)) {
|
|
3931
|
-
_context7.
|
|
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.
|
|
3920
|
+
_context7.n = 3;
|
|
3937
3921
|
return func.apply(this, func_args);
|
|
3938
|
-
case
|
|
3939
|
-
res = _context7.
|
|
3922
|
+
case 3:
|
|
3923
|
+
res = _context7.v;
|
|
3940
3924
|
if (_boolean(res)) {
|
|
3941
3925
|
result.push(entry);
|
|
3942
3926
|
}
|
|
3943
|
-
case
|
|
3927
|
+
case 4:
|
|
3944
3928
|
i++;
|
|
3945
|
-
_context7.
|
|
3929
|
+
_context7.n = 2;
|
|
3946
3930
|
break;
|
|
3947
|
-
case
|
|
3948
|
-
return _context7.
|
|
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(
|
|
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__*/
|
|
3947
|
+
_single = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(arr, func) {
|
|
3967
3948
|
var hasFoundMatch, result, i, entry, positiveResult, func_args, res;
|
|
3968
|
-
return
|
|
3969
|
-
while (1) switch (_context8.
|
|
3949
|
+
return _regenerator().w(function (_context8) {
|
|
3950
|
+
while (1) switch (_context8.n) {
|
|
3970
3951
|
case 0:
|
|
3971
3952
|
if (!(typeof arr === 'undefined')) {
|
|
3972
|
-
_context8.
|
|
3953
|
+
_context8.n = 1;
|
|
3973
3954
|
break;
|
|
3974
3955
|
}
|
|
3975
|
-
return _context8.
|
|
3976
|
-
case
|
|
3956
|
+
return _context8.a(2, undefined);
|
|
3957
|
+
case 1:
|
|
3977
3958
|
hasFoundMatch = false;
|
|
3978
3959
|
i = 0;
|
|
3979
|
-
case
|
|
3960
|
+
case 2:
|
|
3980
3961
|
if (!(i < arr.length)) {
|
|
3981
|
-
_context8.
|
|
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.
|
|
3968
|
+
_context8.n = 4;
|
|
3988
3969
|
break;
|
|
3989
3970
|
}
|
|
3990
3971
|
func_args = hofFuncArgs(func, entry, i, arr); // invoke func
|
|
3991
|
-
_context8.
|
|
3972
|
+
_context8.n = 3;
|
|
3992
3973
|
return func.apply(this, func_args);
|
|
3993
|
-
case
|
|
3994
|
-
res = _context8.
|
|
3974
|
+
case 3:
|
|
3975
|
+
res = _context8.v;
|
|
3995
3976
|
positiveResult = _boolean(res);
|
|
3996
|
-
case
|
|
3977
|
+
case 4:
|
|
3997
3978
|
if (!positiveResult) {
|
|
3998
|
-
_context8.
|
|
3979
|
+
_context8.n = 6;
|
|
3999
3980
|
break;
|
|
4000
3981
|
}
|
|
4001
3982
|
if (hasFoundMatch) {
|
|
4002
|
-
_context8.
|
|
3983
|
+
_context8.n = 5;
|
|
4003
3984
|
break;
|
|
4004
3985
|
}
|
|
4005
3986
|
result = entry;
|
|
4006
3987
|
hasFoundMatch = true;
|
|
4007
|
-
_context8.
|
|
3988
|
+
_context8.n = 6;
|
|
4008
3989
|
break;
|
|
4009
|
-
case
|
|
3990
|
+
case 5:
|
|
4010
3991
|
throw {
|
|
4011
3992
|
stack: new Error().stack,
|
|
4012
3993
|
code: "D3138",
|
|
4013
3994
|
index: i
|
|
4014
3995
|
};
|
|
4015
|
-
case
|
|
3996
|
+
case 6:
|
|
4016
3997
|
i++;
|
|
4017
|
-
_context8.
|
|
3998
|
+
_context8.n = 2;
|
|
4018
3999
|
break;
|
|
4019
|
-
case
|
|
4000
|
+
case 7:
|
|
4020
4001
|
if (hasFoundMatch) {
|
|
4021
|
-
_context8.
|
|
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
|
|
4029
|
-
return _context8.
|
|
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(
|
|
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__*/
|
|
4052
|
+
_foldLeft = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(sequence, func, init) {
|
|
4075
4053
|
var result, arity, index, args;
|
|
4076
|
-
return
|
|
4077
|
-
while (1) switch (_context9.
|
|
4054
|
+
return _regenerator().w(function (_context9) {
|
|
4055
|
+
while (1) switch (_context9.n) {
|
|
4078
4056
|
case 0:
|
|
4079
4057
|
if (!(typeof sequence === 'undefined')) {
|
|
4080
|
-
_context9.
|
|
4058
|
+
_context9.n = 1;
|
|
4081
4059
|
break;
|
|
4082
4060
|
}
|
|
4083
|
-
return _context9.
|
|
4084
|
-
case
|
|
4061
|
+
return _context9.a(2, undefined);
|
|
4062
|
+
case 1:
|
|
4085
4063
|
arity = getFunctionArity(func);
|
|
4086
4064
|
if (!(arity < 2)) {
|
|
4087
|
-
_context9.
|
|
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
|
|
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
|
|
4081
|
+
case 3:
|
|
4104
4082
|
if (!(index < sequence.length)) {
|
|
4105
|
-
_context9.
|
|
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.
|
|
4093
|
+
_context9.n = 4;
|
|
4116
4094
|
return func.apply(this, args);
|
|
4117
|
-
case
|
|
4118
|
-
result = _context9.
|
|
4095
|
+
case 4:
|
|
4096
|
+
result = _context9.v;
|
|
4119
4097
|
index++;
|
|
4120
|
-
_context9.
|
|
4098
|
+
_context9.n = 3;
|
|
4121
4099
|
break;
|
|
4122
|
-
case
|
|
4123
|
-
return _context9.
|
|
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(
|
|
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__*/
|
|
4299
|
-
var result, key, func_args, val;
|
|
4300
|
-
return
|
|
4301
|
-
while (1) switch (
|
|
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
|
-
|
|
4305
|
-
case
|
|
4306
|
-
if ((
|
|
4307
|
-
|
|
4279
|
+
_t = _regeneratorKeys(obj);
|
|
4280
|
+
case 1:
|
|
4281
|
+
if ((_t2 = _t()).done) {
|
|
4282
|
+
_context0.n = 3;
|
|
4308
4283
|
break;
|
|
4309
4284
|
}
|
|
4310
|
-
key =
|
|
4285
|
+
key = _t2.value;
|
|
4311
4286
|
func_args = hofFuncArgs(func, obj[key], key, obj); // invoke func
|
|
4312
|
-
|
|
4287
|
+
_context0.n = 2;
|
|
4313
4288
|
return func.apply(this, func_args);
|
|
4314
|
-
case
|
|
4315
|
-
val =
|
|
4289
|
+
case 2:
|
|
4290
|
+
val = _context0.v;
|
|
4316
4291
|
if (typeof val !== 'undefined') {
|
|
4317
4292
|
result.push(val);
|
|
4318
4293
|
}
|
|
4319
|
-
|
|
4294
|
+
_context0.n = 1;
|
|
4320
4295
|
break;
|
|
4321
|
-
case
|
|
4322
|
-
return
|
|
4323
|
-
case 12:
|
|
4324
|
-
case "end":
|
|
4325
|
-
return _context10.stop();
|
|
4296
|
+
case 3:
|
|
4297
|
+
return _context0.a(2, result);
|
|
4326
4298
|
}
|
|
4327
|
-
},
|
|
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(
|
|
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__*/
|
|
4375
|
+
_sort = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(arr, comparator) {
|
|
4404
4376
|
var comp, merge, _msort, result;
|
|
4405
|
-
return
|
|
4406
|
-
while (1) switch (
|
|
4377
|
+
return _regenerator().w(function (_context13) {
|
|
4378
|
+
while (1) switch (_context13.n) {
|
|
4407
4379
|
case 0:
|
|
4408
4380
|
if (!(typeof arr === 'undefined')) {
|
|
4409
|
-
|
|
4381
|
+
_context13.n = 1;
|
|
4410
4382
|
break;
|
|
4411
4383
|
}
|
|
4412
|
-
return
|
|
4413
|
-
case
|
|
4384
|
+
return _context13.a(2, undefined);
|
|
4385
|
+
case 1:
|
|
4414
4386
|
if (!(arr.length <= 1)) {
|
|
4415
|
-
|
|
4387
|
+
_context13.n = 2;
|
|
4416
4388
|
break;
|
|
4417
4389
|
}
|
|
4418
|
-
return
|
|
4419
|
-
case
|
|
4390
|
+
return _context13.a(2, arr);
|
|
4391
|
+
case 2:
|
|
4420
4392
|
if (!(typeof comparator === 'undefined')) {
|
|
4421
|
-
|
|
4393
|
+
_context13.n = 4;
|
|
4422
4394
|
break;
|
|
4423
4395
|
}
|
|
4424
4396
|
if (!(!isArrayOfNumbers(arr) && !isArrayOfStrings(arr))) {
|
|
4425
|
-
|
|
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
|
|
4405
|
+
case 3:
|
|
4434
4406
|
comp = /*#__PURE__*/function () {
|
|
4435
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
4436
|
-
return
|
|
4437
|
-
while (1) switch (
|
|
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
|
|
4440
|
-
case 1:
|
|
4441
|
-
case "end":
|
|
4442
|
-
return _context11.stop();
|
|
4411
|
+
return _context1.a(2, a > b);
|
|
4443
4412
|
}
|
|
4444
|
-
},
|
|
4413
|
+
}, _callee1);
|
|
4445
4414
|
}));
|
|
4446
|
-
return function comp(
|
|
4415
|
+
return function comp(_x28, _x29) {
|
|
4447
4416
|
return _ref.apply(this, arguments);
|
|
4448
4417
|
};
|
|
4449
4418
|
}();
|
|
4450
|
-
|
|
4419
|
+
_context13.n = 5;
|
|
4451
4420
|
break;
|
|
4452
|
-
case
|
|
4421
|
+
case 4:
|
|
4453
4422
|
// for internal usage of functionSort (i.e. order-by syntax)
|
|
4454
4423
|
comp = comparator;
|
|
4455
|
-
case
|
|
4424
|
+
case 5:
|
|
4456
4425
|
merge = /*#__PURE__*/function () {
|
|
4457
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/
|
|
4426
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(l, r) {
|
|
4458
4427
|
var _merge_iter, merged;
|
|
4459
|
-
return
|
|
4460
|
-
while (1) switch (
|
|
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__*/
|
|
4464
|
-
return
|
|
4465
|
-
while (1) switch (
|
|
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
|
-
|
|
4437
|
+
_context10.n = 1;
|
|
4469
4438
|
break;
|
|
4470
4439
|
}
|
|
4471
4440
|
Array.prototype.push.apply(result, right);
|
|
4472
|
-
|
|
4441
|
+
_context10.n = 6;
|
|
4473
4442
|
break;
|
|
4474
|
-
case
|
|
4443
|
+
case 1:
|
|
4475
4444
|
if (!(right.length === 0)) {
|
|
4476
|
-
|
|
4445
|
+
_context10.n = 2;
|
|
4477
4446
|
break;
|
|
4478
4447
|
}
|
|
4479
4448
|
Array.prototype.push.apply(result, left);
|
|
4480
|
-
|
|
4449
|
+
_context10.n = 6;
|
|
4481
4450
|
break;
|
|
4482
|
-
case
|
|
4483
|
-
|
|
4451
|
+
case 2:
|
|
4452
|
+
_context10.n = 3;
|
|
4484
4453
|
return comp(left[0], right[0]);
|
|
4485
|
-
case
|
|
4486
|
-
if (!
|
|
4487
|
-
|
|
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
|
-
|
|
4462
|
+
_context10.n = 4;
|
|
4494
4463
|
return _merge_iter(result, left, right.slice(1));
|
|
4495
|
-
case
|
|
4496
|
-
|
|
4464
|
+
case 4:
|
|
4465
|
+
_context10.n = 6;
|
|
4497
4466
|
break;
|
|
4498
|
-
case
|
|
4467
|
+
case 5:
|
|
4499
4468
|
// otherwise keep the same order
|
|
4500
4469
|
result.push(left[0]);
|
|
4501
|
-
|
|
4470
|
+
_context10.n = 6;
|
|
4502
4471
|
return _merge_iter(result, left.slice(1), right);
|
|
4503
|
-
case
|
|
4504
|
-
|
|
4505
|
-
return _context12.stop();
|
|
4472
|
+
case 6:
|
|
4473
|
+
return _context10.a(2);
|
|
4506
4474
|
}
|
|
4507
|
-
},
|
|
4475
|
+
}, _callee10);
|
|
4508
4476
|
}));
|
|
4509
|
-
return function merge_iter(
|
|
4477
|
+
return function merge_iter(_x32, _x33, _x34) {
|
|
4510
4478
|
return _ref3.apply(this, arguments);
|
|
4511
4479
|
};
|
|
4512
4480
|
}();
|
|
4513
4481
|
merged = [];
|
|
4514
|
-
|
|
4482
|
+
_context11.n = 1;
|
|
4515
4483
|
return _merge_iter(merged, l, r);
|
|
4516
|
-
case
|
|
4517
|
-
return
|
|
4518
|
-
case 5:
|
|
4519
|
-
case "end":
|
|
4520
|
-
return _context13.stop();
|
|
4484
|
+
case 1:
|
|
4485
|
+
return _context11.a(2, merged);
|
|
4521
4486
|
}
|
|
4522
|
-
},
|
|
4487
|
+
}, _callee11);
|
|
4523
4488
|
}));
|
|
4524
|
-
return function merge(
|
|
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__*/
|
|
4494
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(array) {
|
|
4530
4495
|
var middle, left, right;
|
|
4531
|
-
return
|
|
4532
|
-
while (1) switch (
|
|
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
|
-
|
|
4500
|
+
_context12.n = 1;
|
|
4536
4501
|
break;
|
|
4537
4502
|
}
|
|
4538
|
-
return
|
|
4539
|
-
case
|
|
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
|
-
|
|
4508
|
+
_context12.n = 2;
|
|
4544
4509
|
return _msort(left);
|
|
4545
|
-
case
|
|
4546
|
-
left =
|
|
4547
|
-
|
|
4510
|
+
case 2:
|
|
4511
|
+
left = _context12.v;
|
|
4512
|
+
_context12.n = 3;
|
|
4548
4513
|
return _msort(right);
|
|
4549
|
-
case
|
|
4550
|
-
right =
|
|
4551
|
-
|
|
4514
|
+
case 3:
|
|
4515
|
+
right = _context12.v;
|
|
4516
|
+
_context12.n = 4;
|
|
4552
4517
|
return merge(left, right);
|
|
4553
|
-
case
|
|
4554
|
-
return
|
|
4555
|
-
case
|
|
4556
|
-
|
|
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
|
-
},
|
|
4523
|
+
}, _callee12);
|
|
4560
4524
|
}));
|
|
4561
|
-
return function msort(
|
|
4525
|
+
return function msort(_x35) {
|
|
4562
4526
|
return _ref4.apply(this, arguments);
|
|
4563
4527
|
};
|
|
4564
4528
|
}();
|
|
4565
|
-
|
|
4529
|
+
_context13.n = 6;
|
|
4566
4530
|
return _msort(arr);
|
|
4567
|
-
case
|
|
4568
|
-
result =
|
|
4569
|
-
return
|
|
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
|
-
},
|
|
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(
|
|
4599
|
+
function sift(_x26, _x27) {
|
|
4639
4600
|
return _sift.apply(this, arguments);
|
|
4640
4601
|
}
|
|
4641
4602
|
function _sift() {
|
|
4642
|
-
_sift = _asyncToGenerator(/*#__PURE__*/
|
|
4643
|
-
var result, item, entry, func_args, res;
|
|
4644
|
-
return
|
|
4645
|
-
while (1) switch (
|
|
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
|
-
|
|
4649
|
-
case
|
|
4650
|
-
if ((
|
|
4651
|
-
|
|
4609
|
+
_t3 = _regeneratorKeys(arg);
|
|
4610
|
+
case 1:
|
|
4611
|
+
if ((_t4 = _t3()).done) {
|
|
4612
|
+
_context14.n = 3;
|
|
4652
4613
|
break;
|
|
4653
4614
|
}
|
|
4654
|
-
item =
|
|
4615
|
+
item = _t4.value;
|
|
4655
4616
|
entry = arg[item];
|
|
4656
4617
|
func_args = hofFuncArgs(func, entry, item, arg); // invoke func
|
|
4657
|
-
|
|
4618
|
+
_context14.n = 2;
|
|
4658
4619
|
return func.apply(this, func_args);
|
|
4659
|
-
case
|
|
4660
|
-
res =
|
|
4620
|
+
case 2:
|
|
4621
|
+
res = _context14.v;
|
|
4661
4622
|
if (_boolean(res)) {
|
|
4662
4623
|
result[item] = entry;
|
|
4663
4624
|
}
|
|
4664
|
-
|
|
4625
|
+
_context14.n = 1;
|
|
4665
4626
|
break;
|
|
4666
|
-
case
|
|
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
|
|
4672
|
-
case 14:
|
|
4673
|
-
case "end":
|
|
4674
|
-
return _context16.stop();
|
|
4632
|
+
return _context14.a(2, result);
|
|
4675
4633
|
}
|
|
4676
|
-
},
|
|
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
|
|
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__*/
|
|
4817
|
-
var result, entryCallback, ii, exitCallback;
|
|
4818
|
-
return
|
|
4819
|
-
while (1) switch (_context4.
|
|
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.
|
|
4783
|
+
_context4.n = 1;
|
|
4824
4784
|
break;
|
|
4825
4785
|
}
|
|
4826
|
-
_context4.
|
|
4786
|
+
_context4.n = 1;
|
|
4827
4787
|
return entryCallback(expr, input, environment);
|
|
4828
|
-
case
|
|
4829
|
-
|
|
4830
|
-
_context4.
|
|
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
|
|
4833
|
-
_context4.
|
|
4792
|
+
case 2:
|
|
4793
|
+
_context4.n = 3;
|
|
4834
4794
|
return evaluatePath(expr, input, environment);
|
|
4835
|
-
case
|
|
4836
|
-
result = _context4.
|
|
4837
|
-
return _context4.
|
|
4838
|
-
case
|
|
4839
|
-
_context4.
|
|
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
|
|
4842
|
-
result = _context4.
|
|
4843
|
-
return _context4.
|
|
4844
|
-
case
|
|
4845
|
-
_context4.
|
|
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
|
|
4848
|
-
result = _context4.
|
|
4849
|
-
return _context4.
|
|
4850
|
-
case
|
|
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.
|
|
4853
|
-
case
|
|
4812
|
+
return _context4.a(3, 29);
|
|
4813
|
+
case 9:
|
|
4854
4814
|
result = evaluateLiteral(expr, input, environment);
|
|
4855
|
-
return _context4.
|
|
4856
|
-
case
|
|
4815
|
+
return _context4.a(3, 29);
|
|
4816
|
+
case 10:
|
|
4857
4817
|
result = evaluateWildcard(expr, input, environment);
|
|
4858
|
-
return _context4.
|
|
4859
|
-
case
|
|
4818
|
+
return _context4.a(3, 29);
|
|
4819
|
+
case 11:
|
|
4860
4820
|
result = evaluateDescendants(expr, input, environment);
|
|
4861
|
-
return _context4.
|
|
4862
|
-
case
|
|
4821
|
+
return _context4.a(3, 29);
|
|
4822
|
+
case 12:
|
|
4863
4823
|
result = environment.lookup(expr.slot.label);
|
|
4864
|
-
return _context4.
|
|
4865
|
-
case
|
|
4866
|
-
_context4.
|
|
4824
|
+
return _context4.a(3, 29);
|
|
4825
|
+
case 13:
|
|
4826
|
+
_context4.n = 14;
|
|
4867
4827
|
return evaluateCondition(expr, input, environment);
|
|
4868
|
-
case
|
|
4869
|
-
result = _context4.
|
|
4870
|
-
return _context4.
|
|
4871
|
-
case
|
|
4872
|
-
_context4.
|
|
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
|
|
4875
|
-
result = _context4.
|
|
4876
|
-
return _context4.
|
|
4877
|
-
case
|
|
4878
|
-
_context4.
|
|
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
|
|
4881
|
-
result = _context4.
|
|
4882
|
-
return _context4.
|
|
4883
|
-
case
|
|
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.
|
|
4886
|
-
case
|
|
4887
|
-
_context4.
|
|
4845
|
+
return _context4.a(3, 29);
|
|
4846
|
+
case 20:
|
|
4847
|
+
_context4.n = 21;
|
|
4888
4848
|
return evaluateFunction(expr, input, environment);
|
|
4889
|
-
case
|
|
4890
|
-
result = _context4.
|
|
4891
|
-
return _context4.
|
|
4892
|
-
case
|
|
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.
|
|
4895
|
-
case
|
|
4854
|
+
return _context4.a(3, 29);
|
|
4855
|
+
case 23:
|
|
4896
4856
|
result = evaluateLambda(expr, input, environment);
|
|
4897
|
-
return _context4.
|
|
4898
|
-
case
|
|
4899
|
-
_context4.
|
|
4857
|
+
return _context4.a(3, 29);
|
|
4858
|
+
case 24:
|
|
4859
|
+
_context4.n = 25;
|
|
4900
4860
|
return evaluatePartialApplication(expr, input, environment);
|
|
4901
|
-
case
|
|
4902
|
-
result = _context4.
|
|
4903
|
-
return _context4.
|
|
4904
|
-
case
|
|
4905
|
-
_context4.
|
|
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
|
|
4908
|
-
result = _context4.
|
|
4909
|
-
return _context4.
|
|
4910
|
-
case
|
|
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.
|
|
4913
|
-
case
|
|
4872
|
+
return _context4.a(3, 29);
|
|
4873
|
+
case 29:
|
|
4914
4874
|
if (!Object.prototype.hasOwnProperty.call(expr, 'predicate')) {
|
|
4915
|
-
_context4.
|
|
4875
|
+
_context4.n = 33;
|
|
4916
4876
|
break;
|
|
4917
4877
|
}
|
|
4918
4878
|
ii = 0;
|
|
4919
|
-
case
|
|
4879
|
+
case 30:
|
|
4920
4880
|
if (!(ii < expr.predicate.length)) {
|
|
4921
|
-
_context4.
|
|
4881
|
+
_context4.n = 33;
|
|
4922
4882
|
break;
|
|
4923
4883
|
}
|
|
4924
|
-
_context4.
|
|
4884
|
+
_context4.n = 31;
|
|
4925
4885
|
return evaluateFilter(expr.predicate[ii].expr, result, environment);
|
|
4926
|
-
case
|
|
4927
|
-
result = _context4.
|
|
4928
|
-
case
|
|
4886
|
+
case 31:
|
|
4887
|
+
result = _context4.v;
|
|
4888
|
+
case 32:
|
|
4929
4889
|
ii++;
|
|
4930
|
-
_context4.
|
|
4890
|
+
_context4.n = 30;
|
|
4931
4891
|
break;
|
|
4932
|
-
case
|
|
4892
|
+
case 33:
|
|
4933
4893
|
if (!(expr.type !== 'path' && Object.prototype.hasOwnProperty.call(expr, 'group'))) {
|
|
4934
|
-
_context4.
|
|
4894
|
+
_context4.n = 35;
|
|
4935
4895
|
break;
|
|
4936
4896
|
}
|
|
4937
|
-
_context4.
|
|
4897
|
+
_context4.n = 34;
|
|
4938
4898
|
return evaluateGroupExpression(expr.group, result, environment);
|
|
4939
|
-
case
|
|
4940
|
-
result = _context4.
|
|
4941
|
-
case
|
|
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.
|
|
4904
|
+
_context4.n = 36;
|
|
4945
4905
|
break;
|
|
4946
4906
|
}
|
|
4947
|
-
_context4.
|
|
4907
|
+
_context4.n = 36;
|
|
4948
4908
|
return exitCallback(expr, input, environment, result);
|
|
4949
|
-
case
|
|
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.
|
|
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__*/
|
|
4930
|
+
_evaluatePath = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(expr, input, environment) {
|
|
4974
4931
|
var inputSequence, resultSequence, isTupleStream, tupleBindings, ii, step;
|
|
4975
|
-
return
|
|
4976
|
-
while (1) switch (_context5.
|
|
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
|
|
4947
|
+
case 1:
|
|
4991
4948
|
if (!(ii < expr.steps.length)) {
|
|
4992
|
-
_context5.
|
|
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.
|
|
4959
|
+
_context5.n = 3;
|
|
5003
4960
|
break;
|
|
5004
4961
|
}
|
|
5005
|
-
_context5.
|
|
4962
|
+
_context5.n = 2;
|
|
5006
4963
|
return _evaluate2(step, inputSequence, environment);
|
|
5007
|
-
case
|
|
5008
|
-
resultSequence = _context5.
|
|
5009
|
-
_context5.
|
|
4964
|
+
case 2:
|
|
4965
|
+
resultSequence = _context5.v;
|
|
4966
|
+
_context5.n = 7;
|
|
5010
4967
|
break;
|
|
5011
|
-
case
|
|
4968
|
+
case 3:
|
|
5012
4969
|
if (!isTupleStream) {
|
|
5013
|
-
_context5.
|
|
4970
|
+
_context5.n = 5;
|
|
5014
4971
|
break;
|
|
5015
4972
|
}
|
|
5016
|
-
_context5.
|
|
4973
|
+
_context5.n = 4;
|
|
5017
4974
|
return evaluateTupleStep(step, inputSequence, tupleBindings, environment);
|
|
5018
|
-
case
|
|
5019
|
-
tupleBindings = _context5.
|
|
5020
|
-
_context5.
|
|
4975
|
+
case 4:
|
|
4976
|
+
tupleBindings = _context5.v;
|
|
4977
|
+
_context5.n = 7;
|
|
5021
4978
|
break;
|
|
5022
|
-
case
|
|
5023
|
-
_context5.
|
|
4979
|
+
case 5:
|
|
4980
|
+
_context5.n = 6;
|
|
5024
4981
|
return evaluateStep(step, inputSequence, environment, ii === expr.steps.length - 1);
|
|
5025
|
-
case
|
|
5026
|
-
resultSequence = _context5.
|
|
5027
|
-
case
|
|
4982
|
+
case 6:
|
|
4983
|
+
resultSequence = _context5.v;
|
|
4984
|
+
case 7:
|
|
5028
4985
|
if (!(!isTupleStream && (typeof resultSequence === 'undefined' || resultSequence.length === 0))) {
|
|
5029
|
-
_context5.
|
|
4986
|
+
_context5.n = 8;
|
|
5030
4987
|
break;
|
|
5031
4988
|
}
|
|
5032
|
-
return _context5.
|
|
5033
|
-
case
|
|
4989
|
+
return _context5.a(3, 10);
|
|
4990
|
+
case 8:
|
|
5034
4991
|
if (typeof step.focus === 'undefined') {
|
|
5035
4992
|
inputSequence = resultSequence;
|
|
5036
4993
|
}
|
|
5037
|
-
case
|
|
4994
|
+
case 9:
|
|
5038
4995
|
ii++;
|
|
5039
|
-
_context5.
|
|
4996
|
+
_context5.n = 1;
|
|
5040
4997
|
break;
|
|
5041
|
-
case
|
|
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.
|
|
5018
|
+
_context5.n = 12;
|
|
5062
5019
|
break;
|
|
5063
5020
|
}
|
|
5064
|
-
_context5.
|
|
5021
|
+
_context5.n = 11;
|
|
5065
5022
|
return evaluateGroupExpression(expr.group, isTupleStream ? tupleBindings : resultSequence, environment);
|
|
5066
|
-
case
|
|
5067
|
-
resultSequence = _context5.
|
|
5068
|
-
case
|
|
5069
|
-
return _context5.
|
|
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,
|
|
5048
|
+
function evaluateStep(_x7, _x8, _x9, _x0) {
|
|
5095
5049
|
return _evaluateStep.apply(this, arguments);
|
|
5096
5050
|
}
|
|
5097
5051
|
function _evaluateStep() {
|
|
5098
|
-
_evaluateStep = _asyncToGenerator(/*#__PURE__*/
|
|
5052
|
+
_evaluateStep = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(expr, input, environment, lastStep) {
|
|
5099
5053
|
var result, ii, res, ss, resultSequence;
|
|
5100
|
-
return
|
|
5101
|
-
while (1) switch (_context6.
|
|
5054
|
+
return _regenerator().w(function (_context6) {
|
|
5055
|
+
while (1) switch (_context6.n) {
|
|
5102
5056
|
case 0:
|
|
5103
5057
|
if (!(expr.type === 'sort')) {
|
|
5104
|
-
_context6.
|
|
5058
|
+
_context6.n = 4;
|
|
5105
5059
|
break;
|
|
5106
5060
|
}
|
|
5107
|
-
_context6.
|
|
5061
|
+
_context6.n = 1;
|
|
5108
5062
|
return evaluateSortExpression(expr, input, environment);
|
|
5109
|
-
case
|
|
5110
|
-
result = _context6.
|
|
5063
|
+
case 1:
|
|
5064
|
+
result = _context6.v;
|
|
5111
5065
|
if (!expr.stages) {
|
|
5112
|
-
_context6.
|
|
5066
|
+
_context6.n = 3;
|
|
5113
5067
|
break;
|
|
5114
5068
|
}
|
|
5115
|
-
_context6.
|
|
5069
|
+
_context6.n = 2;
|
|
5116
5070
|
return evaluateStages(expr.stages, result, environment);
|
|
5117
|
-
case
|
|
5118
|
-
result = _context6.
|
|
5119
|
-
case
|
|
5120
|
-
return _context6.
|
|
5121
|
-
case
|
|
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
|
|
5078
|
+
case 5:
|
|
5125
5079
|
if (!(ii < input.length)) {
|
|
5126
|
-
_context6.
|
|
5080
|
+
_context6.n = 12;
|
|
5127
5081
|
break;
|
|
5128
5082
|
}
|
|
5129
|
-
_context6.
|
|
5083
|
+
_context6.n = 6;
|
|
5130
5084
|
return _evaluate2(expr, input[ii], environment);
|
|
5131
|
-
case
|
|
5132
|
-
res = _context6.
|
|
5085
|
+
case 6:
|
|
5086
|
+
res = _context6.v;
|
|
5133
5087
|
if (!expr.stages) {
|
|
5134
|
-
_context6.
|
|
5088
|
+
_context6.n = 10;
|
|
5135
5089
|
break;
|
|
5136
5090
|
}
|
|
5137
5091
|
ss = 0;
|
|
5138
|
-
case
|
|
5092
|
+
case 7:
|
|
5139
5093
|
if (!(ss < expr.stages.length)) {
|
|
5140
|
-
_context6.
|
|
5094
|
+
_context6.n = 10;
|
|
5141
5095
|
break;
|
|
5142
5096
|
}
|
|
5143
|
-
_context6.
|
|
5097
|
+
_context6.n = 8;
|
|
5144
5098
|
return evaluateFilter(expr.stages[ss].expr, res, environment);
|
|
5145
|
-
case
|
|
5146
|
-
res = _context6.
|
|
5147
|
-
case
|
|
5099
|
+
case 8:
|
|
5100
|
+
res = _context6.v;
|
|
5101
|
+
case 9:
|
|
5148
5102
|
ss++;
|
|
5149
|
-
_context6.
|
|
5103
|
+
_context6.n = 7;
|
|
5150
5104
|
break;
|
|
5151
|
-
case
|
|
5105
|
+
case 10:
|
|
5152
5106
|
if (typeof res !== 'undefined') {
|
|
5153
5107
|
result.push(res);
|
|
5154
5108
|
}
|
|
5155
|
-
case
|
|
5109
|
+
case 11:
|
|
5156
5110
|
ii++;
|
|
5157
|
-
_context6.
|
|
5111
|
+
_context6.n = 5;
|
|
5158
5112
|
break;
|
|
5159
|
-
case
|
|
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.
|
|
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(
|
|
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__*/
|
|
5199
|
-
var result, ss, stage, ee, tuple;
|
|
5200
|
-
return
|
|
5201
|
-
while (1) switch (_context7.
|
|
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
|
|
5156
|
+
case 1:
|
|
5206
5157
|
if (!(ss < stages.length)) {
|
|
5207
|
-
_context7.
|
|
5158
|
+
_context7.n = 6;
|
|
5208
5159
|
break;
|
|
5209
5160
|
}
|
|
5210
5161
|
stage = stages[ss];
|
|
5211
|
-
|
|
5212
|
-
_context7.
|
|
5162
|
+
_t3 = stage.type;
|
|
5163
|
+
_context7.n = _t3 === 'filter' ? 2 : _t3 === 'index' ? 4 : 5;
|
|
5213
5164
|
break;
|
|
5214
|
-
case
|
|
5215
|
-
_context7.
|
|
5165
|
+
case 2:
|
|
5166
|
+
_context7.n = 3;
|
|
5216
5167
|
return evaluateFilter(stage.expr, result, environment);
|
|
5217
|
-
case
|
|
5218
|
-
result = _context7.
|
|
5219
|
-
return _context7.
|
|
5220
|
-
case
|
|
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.
|
|
5226
|
-
case
|
|
5176
|
+
return _context7.a(3, 5);
|
|
5177
|
+
case 5:
|
|
5227
5178
|
ss++;
|
|
5228
|
-
_context7.
|
|
5179
|
+
_context7.n = 1;
|
|
5229
5180
|
break;
|
|
5230
|
-
case
|
|
5231
|
-
return _context7.
|
|
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(
|
|
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__*/
|
|
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
|
|
5254
|
-
while (1) switch (_context8.
|
|
5201
|
+
return _regenerator().w(function (_context8) {
|
|
5202
|
+
while (1) switch (_context8.n) {
|
|
5255
5203
|
case 0:
|
|
5256
5204
|
if (!(expr.type === 'sort')) {
|
|
5257
|
-
_context8.
|
|
5205
|
+
_context8.n = 7;
|
|
5258
5206
|
break;
|
|
5259
5207
|
}
|
|
5260
5208
|
if (!tupleBindings) {
|
|
5261
|
-
_context8.
|
|
5209
|
+
_context8.n = 2;
|
|
5262
5210
|
break;
|
|
5263
5211
|
}
|
|
5264
|
-
_context8.
|
|
5212
|
+
_context8.n = 1;
|
|
5265
5213
|
return evaluateSortExpression(expr, tupleBindings, environment);
|
|
5266
|
-
case
|
|
5267
|
-
result = _context8.
|
|
5268
|
-
_context8.
|
|
5214
|
+
case 1:
|
|
5215
|
+
result = _context8.v;
|
|
5216
|
+
_context8.n = 4;
|
|
5269
5217
|
break;
|
|
5270
|
-
case
|
|
5271
|
-
_context8.
|
|
5218
|
+
case 2:
|
|
5219
|
+
_context8.n = 3;
|
|
5272
5220
|
return evaluateSortExpression(expr, input, environment);
|
|
5273
|
-
case
|
|
5274
|
-
sorted = _context8.
|
|
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
|
|
5232
|
+
case 4:
|
|
5285
5233
|
if (!expr.stages) {
|
|
5286
|
-
_context8.
|
|
5234
|
+
_context8.n = 6;
|
|
5287
5235
|
break;
|
|
5288
5236
|
}
|
|
5289
|
-
_context8.
|
|
5237
|
+
_context8.n = 5;
|
|
5290
5238
|
return evaluateStages(expr.stages, result, environment);
|
|
5291
|
-
case
|
|
5292
|
-
result = _context8.
|
|
5293
|
-
case
|
|
5294
|
-
return _context8.
|
|
5295
|
-
case
|
|
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
|
|
5255
|
+
case 8:
|
|
5308
5256
|
if (!(ee < tupleBindings.length)) {
|
|
5309
|
-
_context8.
|
|
5257
|
+
_context8.n = 11;
|
|
5310
5258
|
break;
|
|
5311
5259
|
}
|
|
5312
5260
|
stepEnv = createFrameFromTuple(environment, tupleBindings[ee]);
|
|
5313
|
-
_context8.
|
|
5261
|
+
_context8.n = 9;
|
|
5314
5262
|
return _evaluate2(expr, tupleBindings[ee]['@'], stepEnv);
|
|
5315
|
-
case
|
|
5316
|
-
res = _context8.
|
|
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
|
|
5292
|
+
case 10:
|
|
5345
5293
|
ee++;
|
|
5346
|
-
_context8.
|
|
5294
|
+
_context8.n = 8;
|
|
5347
5295
|
break;
|
|
5348
|
-
case
|
|
5296
|
+
case 11:
|
|
5349
5297
|
if (!expr.stages) {
|
|
5350
|
-
_context8.
|
|
5298
|
+
_context8.n = 13;
|
|
5351
5299
|
break;
|
|
5352
5300
|
}
|
|
5353
|
-
_context8.
|
|
5301
|
+
_context8.n = 12;
|
|
5354
5302
|
return evaluateStages(expr.stages, result, environment);
|
|
5355
|
-
case
|
|
5356
|
-
result = _context8.
|
|
5357
|
-
case
|
|
5358
|
-
return _context8.
|
|
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(
|
|
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__*/
|
|
5323
|
+
_evaluateFilter = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(predicate, input, environment) {
|
|
5379
5324
|
var results, index, item, context, env, res;
|
|
5380
|
-
return
|
|
5381
|
-
while (1) switch (_context9.
|
|
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.
|
|
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
|
-
|
|
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.
|
|
5355
|
+
_context9.n = 6;
|
|
5408
5356
|
break;
|
|
5409
|
-
case
|
|
5357
|
+
case 2:
|
|
5410
5358
|
index = 0;
|
|
5411
|
-
case
|
|
5359
|
+
case 3:
|
|
5412
5360
|
if (!(index < input.length)) {
|
|
5413
|
-
_context9.
|
|
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.
|
|
5371
|
+
_context9.n = 4;
|
|
5424
5372
|
return _evaluate2(predicate, context, env);
|
|
5425
|
-
case
|
|
5426
|
-
res = _context9.
|
|
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
|
|
5394
|
+
case 5:
|
|
5447
5395
|
index++;
|
|
5448
|
-
_context9.
|
|
5396
|
+
_context9.n = 3;
|
|
5449
5397
|
break;
|
|
5450
|
-
case
|
|
5451
|
-
return _context9.
|
|
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(
|
|
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__*/
|
|
5472
|
-
var result, lhs, op, evalrhs, rhs;
|
|
5473
|
-
return
|
|
5474
|
-
while (1) switch (
|
|
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
|
-
|
|
5421
|
+
_context1.n = 1;
|
|
5477
5422
|
return _evaluate2(expr.lhs, input, environment);
|
|
5478
|
-
case
|
|
5479
|
-
lhs =
|
|
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__*/
|
|
5483
|
-
return
|
|
5484
|
-
while (1) switch (
|
|
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
|
-
|
|
5431
|
+
_context0.n = 1;
|
|
5487
5432
|
return _evaluate2(expr.rhs, input, environment);
|
|
5488
|
-
case
|
|
5489
|
-
return
|
|
5490
|
-
case 3:
|
|
5491
|
-
case "end":
|
|
5492
|
-
return _context10.stop();
|
|
5433
|
+
case 1:
|
|
5434
|
+
return _context0.a(2, _context0.v);
|
|
5493
5435
|
}
|
|
5494
|
-
},
|
|
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
|
-
|
|
5443
|
+
_context1.n = 5;
|
|
5502
5444
|
break;
|
|
5503
5445
|
}
|
|
5504
|
-
|
|
5505
|
-
|
|
5446
|
+
_context1.p = 2;
|
|
5447
|
+
_context1.n = 3;
|
|
5506
5448
|
return evaluateBooleanExpression(lhs, evalrhs, op);
|
|
5507
|
-
case
|
|
5508
|
-
return
|
|
5509
|
-
case
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
throw
|
|
5515
|
-
case
|
|
5516
|
-
|
|
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
|
|
5519
|
-
rhs =
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
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
|
|
5466
|
+
case 8:
|
|
5525
5467
|
result = evaluateNumericExpression(lhs, rhs, op);
|
|
5526
|
-
return
|
|
5527
|
-
case
|
|
5468
|
+
return _context1.a(3, 14);
|
|
5469
|
+
case 9:
|
|
5528
5470
|
result = evaluateEqualityExpression(lhs, rhs, op);
|
|
5529
|
-
return
|
|
5530
|
-
case
|
|
5471
|
+
return _context1.a(3, 14);
|
|
5472
|
+
case 10:
|
|
5531
5473
|
result = evaluateComparisonExpression(lhs, rhs, op);
|
|
5532
|
-
return
|
|
5533
|
-
case
|
|
5474
|
+
return _context1.a(3, 14);
|
|
5475
|
+
case 11:
|
|
5534
5476
|
result = evaluateStringConcat(lhs, rhs);
|
|
5535
|
-
return
|
|
5536
|
-
case
|
|
5477
|
+
return _context1.a(3, 14);
|
|
5478
|
+
case 12:
|
|
5537
5479
|
result = evaluateRangeExpression(lhs, rhs);
|
|
5538
|
-
return
|
|
5539
|
-
case
|
|
5480
|
+
return _context1.a(3, 14);
|
|
5481
|
+
case 13:
|
|
5540
5482
|
result = evaluateIncludesExpression(lhs, rhs);
|
|
5541
|
-
return
|
|
5542
|
-
case
|
|
5543
|
-
|
|
5483
|
+
return _context1.a(3, 14);
|
|
5484
|
+
case 14:
|
|
5485
|
+
_context1.n = 16;
|
|
5544
5486
|
break;
|
|
5545
|
-
case
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
throw
|
|
5551
|
-
case
|
|
5552
|
-
return
|
|
5553
|
-
|
|
5554
|
-
|
|
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(
|
|
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__*/
|
|
5573
|
-
var result, generators, _iterator, _step, generator, _generator, item, value;
|
|
5574
|
-
return
|
|
5575
|
-
while (1) switch (
|
|
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
|
-
|
|
5578
|
-
|
|
5516
|
+
_t9 = expr.value;
|
|
5517
|
+
_context11.n = _t9 === '-' ? 1 : _t9 === '[' ? 6 : _t9 === '{' ? 8 : 10;
|
|
5579
5518
|
break;
|
|
5580
|
-
case
|
|
5581
|
-
|
|
5519
|
+
case 1:
|
|
5520
|
+
_context11.n = 2;
|
|
5582
5521
|
return _evaluate2(expr.expression, input, environment);
|
|
5583
|
-
case
|
|
5584
|
-
result =
|
|
5522
|
+
case 2:
|
|
5523
|
+
result = _context11.v;
|
|
5585
5524
|
if (!(typeof result === 'undefined')) {
|
|
5586
|
-
|
|
5525
|
+
_context11.n = 3;
|
|
5587
5526
|
break;
|
|
5588
5527
|
}
|
|
5589
5528
|
result = undefined;
|
|
5590
|
-
|
|
5529
|
+
_context11.n = 5;
|
|
5591
5530
|
break;
|
|
5592
|
-
case
|
|
5531
|
+
case 3:
|
|
5593
5532
|
if (!isNumeric(result)) {
|
|
5594
|
-
|
|
5533
|
+
_context11.n = 4;
|
|
5595
5534
|
break;
|
|
5596
5535
|
}
|
|
5597
5536
|
result = -result;
|
|
5598
|
-
|
|
5537
|
+
_context11.n = 5;
|
|
5599
5538
|
break;
|
|
5600
|
-
case
|
|
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
|
|
5609
|
-
return
|
|
5610
|
-
case
|
|
5547
|
+
case 5:
|
|
5548
|
+
return _context11.a(3, 10);
|
|
5549
|
+
case 6:
|
|
5611
5550
|
// array constructor - evaluate each item
|
|
5612
5551
|
result = [];
|
|
5613
|
-
|
|
5552
|
+
_context11.n = 7;
|
|
5614
5553
|
return Promise.all(expr.expressions.map(/*#__PURE__*/function () {
|
|
5615
|
-
var _ref4 = _asyncToGenerator(/*#__PURE__*/
|
|
5616
|
-
|
|
5617
|
-
|
|
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
|
-
|
|
5621
|
-
|
|
5560
|
+
_t7 = item;
|
|
5561
|
+
_context10.n = 1;
|
|
5622
5562
|
return _evaluate2(item, input, environment);
|
|
5623
|
-
case
|
|
5624
|
-
|
|
5625
|
-
return
|
|
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
|
-
},
|
|
5567
|
+
}, _callee10);
|
|
5631
5568
|
}));
|
|
5632
|
-
return function (
|
|
5569
|
+
return function (_x73, _x74) {
|
|
5633
5570
|
return _ref4.apply(this, arguments);
|
|
5634
5571
|
};
|
|
5635
5572
|
}()));
|
|
5636
|
-
case
|
|
5637
|
-
generators =
|
|
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
|
|
5664
|
-
case
|
|
5665
|
-
|
|
5600
|
+
return _context11.a(3, 10);
|
|
5601
|
+
case 8:
|
|
5602
|
+
_context11.n = 9;
|
|
5666
5603
|
return evaluateGroupExpression(expr, input, environment);
|
|
5667
|
-
case
|
|
5668
|
-
result =
|
|
5669
|
-
return
|
|
5670
|
-
case
|
|
5671
|
-
return
|
|
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
|
-
},
|
|
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(
|
|
5880
|
+
function evaluateBooleanExpression(_x25, _x26, _x27) {
|
|
5947
5881
|
return _evaluateBooleanExpression.apply(this, arguments);
|
|
5948
5882
|
}
|
|
5949
5883
|
function _evaluateBooleanExpression() {
|
|
5950
|
-
_evaluateBooleanExpression = _asyncToGenerator(/*#__PURE__*/
|
|
5951
|
-
var result, lBool;
|
|
5952
|
-
return
|
|
5953
|
-
while (1) switch (
|
|
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
|
-
|
|
5957
|
-
|
|
5890
|
+
_t0 = op;
|
|
5891
|
+
_context12.n = _t0 === 'and' ? 1 : _t0 === 'or' ? 4 : 7;
|
|
5958
5892
|
break;
|
|
5959
|
-
case
|
|
5960
|
-
|
|
5961
|
-
if (!
|
|
5962
|
-
|
|
5893
|
+
case 1:
|
|
5894
|
+
_t1 = lBool;
|
|
5895
|
+
if (!_t1) {
|
|
5896
|
+
_context12.n = 3;
|
|
5963
5897
|
break;
|
|
5964
5898
|
}
|
|
5965
|
-
|
|
5966
|
-
|
|
5899
|
+
_t10 = boolize;
|
|
5900
|
+
_context12.n = 2;
|
|
5967
5901
|
return evalrhs();
|
|
5968
|
-
case
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
case
|
|
5972
|
-
result =
|
|
5973
|
-
return
|
|
5974
|
-
case
|
|
5975
|
-
|
|
5976
|
-
if (
|
|
5977
|
-
|
|
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
|
-
|
|
5981
|
-
|
|
5914
|
+
_t13 = boolize;
|
|
5915
|
+
_context12.n = 5;
|
|
5982
5916
|
return evalrhs();
|
|
5983
|
-
case
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
case
|
|
5987
|
-
result =
|
|
5988
|
-
return
|
|
5989
|
-
case
|
|
5990
|
-
return
|
|
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
|
-
},
|
|
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(
|
|
5962
|
+
function evaluateGroupExpression(_x28, _x29, _x30) {
|
|
6032
5963
|
return _evaluateGroupExpression.apply(this, arguments);
|
|
6033
5964
|
}
|
|
6034
5965
|
function _evaluateGroupExpression() {
|
|
6035
|
-
_evaluateGroupExpression = _asyncToGenerator(/*#__PURE__*/
|
|
6036
|
-
var result, groups, reduce, itemIndex, item, env, pairIndex, pair, key, entry, generators, _iterator2, _step2, generator, _yield$generator, _yield$generator2, value;
|
|
6037
|
-
return
|
|
6038
|
-
while (1) switch (
|
|
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
|
|
5982
|
+
case 1:
|
|
6052
5983
|
if (!(itemIndex < input.length)) {
|
|
6053
|
-
|
|
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
|
|
5990
|
+
case 2:
|
|
6060
5991
|
if (!(pairIndex < expr.lhs.length)) {
|
|
6061
|
-
|
|
5992
|
+
_context14.n = 8;
|
|
6062
5993
|
break;
|
|
6063
5994
|
}
|
|
6064
5995
|
pair = expr.lhs[pairIndex];
|
|
6065
|
-
|
|
5996
|
+
_context14.n = 3;
|
|
6066
5997
|
return _evaluate2(pair[0], reduce ? item['@'] : item, env);
|
|
6067
|
-
case
|
|
6068
|
-
key =
|
|
5998
|
+
case 3:
|
|
5999
|
+
key = _context14.v;
|
|
6069
6000
|
if (!(typeof key !== 'string' && key !== undefined)) {
|
|
6070
|
-
|
|
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
|
|
6010
|
+
case 4:
|
|
6080
6011
|
if (!(key !== undefined)) {
|
|
6081
|
-
|
|
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
|
-
|
|
6020
|
+
_context14.n = 6;
|
|
6090
6021
|
break;
|
|
6091
6022
|
}
|
|
6092
6023
|
if (!(groups[key].exprIndex !== pairIndex)) {
|
|
6093
|
-
|
|
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
|
|
6033
|
+
case 5:
|
|
6103
6034
|
// append it as an array
|
|
6104
6035
|
groups[key].data = fn.append(groups[key].data, item);
|
|
6105
|
-
|
|
6036
|
+
_context14.n = 7;
|
|
6106
6037
|
break;
|
|
6107
|
-
case
|
|
6038
|
+
case 6:
|
|
6108
6039
|
groups[key] = entry;
|
|
6109
|
-
case
|
|
6040
|
+
case 7:
|
|
6110
6041
|
pairIndex++;
|
|
6111
|
-
|
|
6042
|
+
_context14.n = 2;
|
|
6112
6043
|
break;
|
|
6113
|
-
case
|
|
6044
|
+
case 8:
|
|
6114
6045
|
itemIndex++;
|
|
6115
|
-
|
|
6046
|
+
_context14.n = 1;
|
|
6116
6047
|
break;
|
|
6117
|
-
case
|
|
6118
|
-
|
|
6048
|
+
case 9:
|
|
6049
|
+
_context14.n = 10;
|
|
6119
6050
|
return Promise.all(Object.keys(groups).map(/*#__PURE__*/function () {
|
|
6120
|
-
var _ref5 = _asyncToGenerator(/*#__PURE__*/
|
|
6121
|
-
var entry, context, env, tuple;
|
|
6122
|
-
return
|
|
6123
|
-
while (1) switch (
|
|
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
|
-
|
|
6136
|
-
|
|
6066
|
+
_t15 = key;
|
|
6067
|
+
_context13.n = 1;
|
|
6137
6068
|
return _evaluate2(expr.lhs[entry.exprIndex][1], context, env);
|
|
6138
|
-
case
|
|
6139
|
-
|
|
6140
|
-
return
|
|
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
|
-
},
|
|
6073
|
+
}, _callee13);
|
|
6146
6074
|
}));
|
|
6147
|
-
return function (
|
|
6075
|
+
return function (_x75, _x76) {
|
|
6148
6076
|
return _ref5.apply(this, arguments);
|
|
6149
6077
|
};
|
|
6150
6078
|
}()));
|
|
6151
|
-
case
|
|
6152
|
-
generators =
|
|
6079
|
+
case 10:
|
|
6080
|
+
generators = _context14.v;
|
|
6153
6081
|
_iterator2 = _createForOfIteratorHelper(generators);
|
|
6154
|
-
|
|
6082
|
+
_context14.p = 11;
|
|
6155
6083
|
_iterator2.s();
|
|
6156
|
-
case
|
|
6084
|
+
case 12:
|
|
6157
6085
|
if ((_step2 = _iterator2.n()).done) {
|
|
6158
|
-
|
|
6086
|
+
_context14.n = 15;
|
|
6159
6087
|
break;
|
|
6160
6088
|
}
|
|
6161
6089
|
generator = _step2.value;
|
|
6162
|
-
|
|
6090
|
+
_context14.n = 13;
|
|
6163
6091
|
return generator;
|
|
6164
|
-
case
|
|
6165
|
-
_yield$generator =
|
|
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
|
|
6173
|
-
|
|
6100
|
+
case 14:
|
|
6101
|
+
_context14.n = 12;
|
|
6174
6102
|
break;
|
|
6175
|
-
case
|
|
6176
|
-
|
|
6103
|
+
case 15:
|
|
6104
|
+
_context14.n = 17;
|
|
6177
6105
|
break;
|
|
6178
|
-
case
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
_iterator2.e(
|
|
6182
|
-
case
|
|
6183
|
-
|
|
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
|
|
6186
|
-
case
|
|
6187
|
-
return
|
|
6188
|
-
|
|
6189
|
-
|
|
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(
|
|
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__*/
|
|
6203
|
+
_evaluateBindExpression = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(expr, input, environment) {
|
|
6279
6204
|
var value;
|
|
6280
|
-
return
|
|
6281
|
-
while (1) switch (
|
|
6205
|
+
return _regenerator().w(function (_context15) {
|
|
6206
|
+
while (1) switch (_context15.n) {
|
|
6282
6207
|
case 0:
|
|
6283
|
-
|
|
6208
|
+
_context15.n = 1;
|
|
6284
6209
|
return _evaluate2(expr.rhs, input, environment);
|
|
6285
|
-
case
|
|
6286
|
-
value =
|
|
6210
|
+
case 1:
|
|
6211
|
+
value = _context15.v;
|
|
6287
6212
|
environment.bind(expr.lhs.value, value);
|
|
6288
|
-
return
|
|
6289
|
-
case 5:
|
|
6290
|
-
case "end":
|
|
6291
|
-
return _context17.stop();
|
|
6213
|
+
return _context15.a(2, value);
|
|
6292
6214
|
}
|
|
6293
|
-
},
|
|
6215
|
+
}, _callee15);
|
|
6294
6216
|
}));
|
|
6295
6217
|
return _evaluateBindExpression.apply(this, arguments);
|
|
6296
6218
|
}
|
|
6297
|
-
function evaluateCondition(
|
|
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__*/
|
|
6230
|
+
_evaluateCondition = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(expr, input, environment) {
|
|
6309
6231
|
var result, condition;
|
|
6310
|
-
return
|
|
6311
|
-
while (1) switch (
|
|
6232
|
+
return _regenerator().w(function (_context16) {
|
|
6233
|
+
while (1) switch (_context16.n) {
|
|
6312
6234
|
case 0:
|
|
6313
|
-
|
|
6235
|
+
_context16.n = 1;
|
|
6314
6236
|
return _evaluate2(expr.condition, input, environment);
|
|
6315
|
-
case
|
|
6316
|
-
condition =
|
|
6237
|
+
case 1:
|
|
6238
|
+
condition = _context16.v;
|
|
6317
6239
|
if (!fn["boolean"](condition)) {
|
|
6318
|
-
|
|
6240
|
+
_context16.n = 3;
|
|
6319
6241
|
break;
|
|
6320
6242
|
}
|
|
6321
|
-
|
|
6243
|
+
_context16.n = 2;
|
|
6322
6244
|
return _evaluate2(expr.then, input, environment);
|
|
6323
|
-
case
|
|
6324
|
-
result =
|
|
6325
|
-
|
|
6245
|
+
case 2:
|
|
6246
|
+
result = _context16.v;
|
|
6247
|
+
_context16.n = 5;
|
|
6326
6248
|
break;
|
|
6327
|
-
case
|
|
6249
|
+
case 3:
|
|
6328
6250
|
if (!(typeof expr["else"] !== 'undefined')) {
|
|
6329
|
-
|
|
6251
|
+
_context16.n = 5;
|
|
6330
6252
|
break;
|
|
6331
6253
|
}
|
|
6332
|
-
|
|
6254
|
+
_context16.n = 4;
|
|
6333
6255
|
return _evaluate2(expr["else"], input, environment);
|
|
6334
|
-
case
|
|
6335
|
-
result =
|
|
6336
|
-
case
|
|
6337
|
-
return
|
|
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
|
-
},
|
|
6261
|
+
}, _callee16);
|
|
6343
6262
|
}));
|
|
6344
6263
|
return _evaluateCondition.apply(this, arguments);
|
|
6345
6264
|
}
|
|
6346
|
-
function evaluateBlock(
|
|
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__*/
|
|
6274
|
+
_evaluateBlock = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(expr, input, environment) {
|
|
6356
6275
|
var result, frame, ii;
|
|
6357
|
-
return
|
|
6358
|
-
while (1) switch (
|
|
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
|
|
6284
|
+
case 1:
|
|
6366
6285
|
if (!(ii < expr.expressions.length)) {
|
|
6367
|
-
|
|
6286
|
+
_context17.n = 4;
|
|
6368
6287
|
break;
|
|
6369
6288
|
}
|
|
6370
|
-
|
|
6289
|
+
_context17.n = 2;
|
|
6371
6290
|
return _evaluate2(expr.expressions[ii], input, frame);
|
|
6372
|
-
case
|
|
6373
|
-
result =
|
|
6374
|
-
case
|
|
6291
|
+
case 2:
|
|
6292
|
+
result = _context17.v;
|
|
6293
|
+
case 3:
|
|
6375
6294
|
ii++;
|
|
6376
|
-
|
|
6295
|
+
_context17.n = 1;
|
|
6377
6296
|
break;
|
|
6378
|
-
case
|
|
6379
|
-
return
|
|
6380
|
-
case 10:
|
|
6381
|
-
case "end":
|
|
6382
|
-
return _context19.stop();
|
|
6297
|
+
case 4:
|
|
6298
|
+
return _context17.a(2, result);
|
|
6383
6299
|
}
|
|
6384
|
-
},
|
|
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(
|
|
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__*/
|
|
6382
|
+
_evaluateSortExpression = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(expr, input, environment) {
|
|
6467
6383
|
var result, lhs, isTupleSort, comparator, focus;
|
|
6468
|
-
return
|
|
6469
|
-
while (1) switch (
|
|
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__*/
|
|
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
|
|
6479
|
-
while (1) switch (
|
|
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
|
|
6400
|
+
case 1:
|
|
6485
6401
|
if (!(comp === 0 && index < expr.terms.length)) {
|
|
6486
|
-
|
|
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
|
-
|
|
6412
|
+
_context18.n = 2;
|
|
6497
6413
|
return _evaluate2(term.expression, context, env);
|
|
6498
|
-
case
|
|
6499
|
-
aa =
|
|
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
|
-
|
|
6423
|
+
_context18.n = 3;
|
|
6508
6424
|
return _evaluate2(term.expression, context, env);
|
|
6509
|
-
case
|
|
6510
|
-
bb =
|
|
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
|
-
|
|
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
|
|
6521
|
-
case
|
|
6436
|
+
return _context18.a(3, 10);
|
|
6437
|
+
case 4:
|
|
6522
6438
|
if (!(btype === 'undefined')) {
|
|
6523
|
-
|
|
6439
|
+
_context18.n = 5;
|
|
6524
6440
|
break;
|
|
6525
6441
|
}
|
|
6526
6442
|
comp = -1;
|
|
6527
|
-
return
|
|
6528
|
-
case
|
|
6443
|
+
return _context18.a(3, 10);
|
|
6444
|
+
case 5:
|
|
6529
6445
|
if (!(!(atype === 'string' || atype === 'number') || !(btype === 'string' || btype === 'number'))) {
|
|
6530
|
-
|
|
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
|
|
6455
|
+
case 6:
|
|
6540
6456
|
if (!(atype !== btype)) {
|
|
6541
|
-
|
|
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
|
|
6467
|
+
case 7:
|
|
6552
6468
|
if (!(aa === bb)) {
|
|
6553
|
-
|
|
6469
|
+
_context18.n = 8;
|
|
6554
6470
|
break;
|
|
6555
6471
|
}
|
|
6556
|
-
return
|
|
6557
|
-
case
|
|
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
|
|
6479
|
+
case 9:
|
|
6564
6480
|
if (term.descending === true) {
|
|
6565
6481
|
comp = -comp;
|
|
6566
6482
|
}
|
|
6567
|
-
case
|
|
6483
|
+
case 10:
|
|
6568
6484
|
index++;
|
|
6569
|
-
|
|
6485
|
+
_context18.n = 1;
|
|
6570
6486
|
break;
|
|
6571
|
-
case
|
|
6572
|
-
return
|
|
6573
|
-
case 38:
|
|
6574
|
-
case "end":
|
|
6575
|
-
return _context20.stop();
|
|
6487
|
+
case 11:
|
|
6488
|
+
return _context18.a(2, comp === 1);
|
|
6576
6489
|
}
|
|
6577
|
-
},
|
|
6490
|
+
}, _callee18);
|
|
6578
6491
|
}));
|
|
6579
|
-
return function comparator(
|
|
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
|
-
|
|
6500
|
+
_context19.n = 1;
|
|
6588
6501
|
return fn.sort.apply(focus, [lhs, comparator]);
|
|
6589
|
-
case
|
|
6590
|
-
result =
|
|
6591
|
-
return
|
|
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
|
-
},
|
|
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__*/
|
|
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
|
|
6606
|
-
while (1) switch (_context.
|
|
6515
|
+
return _regenerator().w(function (_context) {
|
|
6516
|
+
while (1) switch (_context.n) {
|
|
6607
6517
|
case 0:
|
|
6608
6518
|
if (!(typeof obj === 'undefined')) {
|
|
6609
|
-
_context.
|
|
6519
|
+
_context.n = 1;
|
|
6610
6520
|
break;
|
|
6611
6521
|
}
|
|
6612
|
-
return _context.
|
|
6613
|
-
case
|
|
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.
|
|
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
|
|
6626
|
-
_context.
|
|
6535
|
+
case 2:
|
|
6536
|
+
_context.n = 3;
|
|
6627
6537
|
return apply(cloneFunction, [obj], null, environment);
|
|
6628
|
-
case
|
|
6629
|
-
result = _context.
|
|
6630
|
-
_context.
|
|
6538
|
+
case 3:
|
|
6539
|
+
result = _context.v;
|
|
6540
|
+
_context.n = 4;
|
|
6631
6541
|
return _evaluate2(expr.pattern, result, environment);
|
|
6632
|
-
case
|
|
6633
|
-
matches = _context.
|
|
6542
|
+
case 4:
|
|
6543
|
+
matches = _context.v;
|
|
6634
6544
|
if (!(typeof matches !== 'undefined')) {
|
|
6635
|
-
_context.
|
|
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
|
|
6552
|
+
case 5:
|
|
6643
6553
|
if (!(ii < matches.length)) {
|
|
6644
|
-
_context.
|
|
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.
|
|
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
|
|
6658
|
-
_context.
|
|
6567
|
+
case 6:
|
|
6568
|
+
_context.n = 7;
|
|
6659
6569
|
return _evaluate2(expr.update, match, environment);
|
|
6660
|
-
case
|
|
6661
|
-
update = _context.
|
|
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.
|
|
6575
|
+
_context.n = 9;
|
|
6666
6576
|
break;
|
|
6667
6577
|
}
|
|
6668
6578
|
if (!(updateType !== 'object' || update === null || Array.isArray(update))) {
|
|
6669
|
-
_context.
|
|
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
|
|
6588
|
+
case 8:
|
|
6679
6589
|
// merge the update
|
|
6680
6590
|
for (prop in update) {
|
|
6681
6591
|
match[prop] = update[prop];
|
|
6682
6592
|
}
|
|
6683
|
-
case
|
|
6593
|
+
case 9:
|
|
6684
6594
|
if (!(typeof expr["delete"] !== 'undefined')) {
|
|
6685
|
-
_context.
|
|
6595
|
+
_context.n = 12;
|
|
6686
6596
|
break;
|
|
6687
6597
|
}
|
|
6688
|
-
_context.
|
|
6598
|
+
_context.n = 10;
|
|
6689
6599
|
return _evaluate2(expr["delete"], match, environment);
|
|
6690
|
-
case
|
|
6691
|
-
deletions = _context.
|
|
6600
|
+
case 10:
|
|
6601
|
+
deletions = _context.v;
|
|
6692
6602
|
if (!(typeof deletions !== 'undefined')) {
|
|
6693
|
-
_context.
|
|
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.
|
|
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
|
|
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
|
|
6626
|
+
case 12:
|
|
6717
6627
|
ii++;
|
|
6718
|
-
_context.
|
|
6628
|
+
_context.n = 5;
|
|
6719
6629
|
break;
|
|
6720
|
-
case
|
|
6721
|
-
return _context.
|
|
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(
|
|
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(
|
|
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__*/
|
|
6661
|
+
_evaluateApplyExpression = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(expr, input, environment) {
|
|
6755
6662
|
var result, lhs, func, chain;
|
|
6756
|
-
return
|
|
6757
|
-
while (1) switch (
|
|
6663
|
+
return _regenerator().w(function (_context20) {
|
|
6664
|
+
while (1) switch (_context20.n) {
|
|
6758
6665
|
case 0:
|
|
6759
|
-
|
|
6666
|
+
_context20.n = 1;
|
|
6760
6667
|
return _evaluate2(expr.lhs, input, environment);
|
|
6761
|
-
case
|
|
6762
|
-
lhs =
|
|
6668
|
+
case 1:
|
|
6669
|
+
lhs = _context20.v;
|
|
6763
6670
|
if (!(expr.rhs.type === 'function')) {
|
|
6764
|
-
|
|
6671
|
+
_context20.n = 3;
|
|
6765
6672
|
break;
|
|
6766
6673
|
}
|
|
6767
|
-
|
|
6674
|
+
_context20.n = 2;
|
|
6768
6675
|
return evaluateFunction(expr.rhs, input, environment, {
|
|
6769
6676
|
context: lhs
|
|
6770
6677
|
});
|
|
6771
|
-
case
|
|
6772
|
-
result =
|
|
6773
|
-
|
|
6678
|
+
case 2:
|
|
6679
|
+
result = _context20.v;
|
|
6680
|
+
_context20.n = 10;
|
|
6774
6681
|
break;
|
|
6775
|
-
case
|
|
6776
|
-
|
|
6682
|
+
case 3:
|
|
6683
|
+
_context20.n = 4;
|
|
6777
6684
|
return _evaluate2(expr.rhs, input, environment);
|
|
6778
|
-
case
|
|
6779
|
-
func =
|
|
6685
|
+
case 4:
|
|
6686
|
+
func = _context20.v;
|
|
6780
6687
|
if (isFunction(func)) {
|
|
6781
|
-
|
|
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
|
|
6697
|
+
case 5:
|
|
6791
6698
|
if (!isFunction(lhs)) {
|
|
6792
|
-
|
|
6699
|
+
_context20.n = 8;
|
|
6793
6700
|
break;
|
|
6794
6701
|
}
|
|
6795
|
-
|
|
6702
|
+
_context20.n = 6;
|
|
6796
6703
|
return _evaluate2(chainAST, null, environment);
|
|
6797
|
-
case
|
|
6798
|
-
chain =
|
|
6799
|
-
|
|
6704
|
+
case 6:
|
|
6705
|
+
chain = _context20.v;
|
|
6706
|
+
_context20.n = 7;
|
|
6800
6707
|
return apply(chain, [lhs, func], null, environment);
|
|
6801
|
-
case
|
|
6802
|
-
result =
|
|
6803
|
-
|
|
6708
|
+
case 7:
|
|
6709
|
+
result = _context20.v;
|
|
6710
|
+
_context20.n = 10;
|
|
6804
6711
|
break;
|
|
6805
|
-
case
|
|
6806
|
-
|
|
6712
|
+
case 8:
|
|
6713
|
+
_context20.n = 9;
|
|
6807
6714
|
return apply(func, [lhs], null, environment);
|
|
6808
|
-
case
|
|
6809
|
-
result =
|
|
6810
|
-
case
|
|
6811
|
-
return
|
|
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
|
-
},
|
|
6720
|
+
}, _callee20);
|
|
6817
6721
|
}));
|
|
6818
6722
|
return _evaluateApplyExpression.apply(this, arguments);
|
|
6819
6723
|
}
|
|
6820
|
-
function evaluateFunction(
|
|
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__*/
|
|
6833
|
-
var result, proc, evaluatedArgs, _loop, jj, procName;
|
|
6834
|
-
return
|
|
6835
|
-
while (1) switch (
|
|
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
|
-
|
|
6741
|
+
_context23.n = 1;
|
|
6838
6742
|
return _evaluate2(expr.procedure, input, environment);
|
|
6839
|
-
case
|
|
6840
|
-
proc =
|
|
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
|
-
|
|
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
|
|
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__*/
|
|
6761
|
+
_loop = /*#__PURE__*/_regenerator().m(function _loop() {
|
|
6858
6762
|
var arg, closure;
|
|
6859
|
-
return
|
|
6860
|
-
while (1) switch (
|
|
6763
|
+
return _regenerator().w(function (_context22) {
|
|
6764
|
+
while (1) switch (_context22.n) {
|
|
6861
6765
|
case 0:
|
|
6862
|
-
|
|
6766
|
+
_context22.n = 1;
|
|
6863
6767
|
return _evaluate2(expr.arguments[jj], input, environment);
|
|
6864
|
-
case
|
|
6865
|
-
arg =
|
|
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__*/
|
|
6773
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21() {
|
|
6870
6774
|
var _len,
|
|
6871
6775
|
params,
|
|
6872
6776
|
_key,
|
|
6873
|
-
|
|
6874
|
-
return
|
|
6875
|
-
while (1) switch (
|
|
6777
|
+
_args21 = arguments;
|
|
6778
|
+
return _regenerator().w(function (_context21) {
|
|
6779
|
+
while (1) switch (_context21.n) {
|
|
6876
6780
|
case 0:
|
|
6877
|
-
for (_len =
|
|
6878
|
-
params[_key] =
|
|
6781
|
+
for (_len = _args21.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
6782
|
+
params[_key] = _args21[_key];
|
|
6879
6783
|
}
|
|
6880
|
-
|
|
6784
|
+
_context21.n = 1;
|
|
6881
6785
|
return apply(arg, params, null, environment);
|
|
6882
|
-
case
|
|
6883
|
-
return
|
|
6884
|
-
case 4:
|
|
6885
|
-
case "end":
|
|
6886
|
-
return _context23.stop();
|
|
6786
|
+
case 1:
|
|
6787
|
+
return _context21.a(2, _context21.v);
|
|
6887
6788
|
}
|
|
6888
|
-
},
|
|
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
|
|
6900
|
-
|
|
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
|
|
6806
|
+
case 3:
|
|
6907
6807
|
if (!(jj < expr.arguments.length)) {
|
|
6908
|
-
|
|
6808
|
+
_context23.n = 5;
|
|
6909
6809
|
break;
|
|
6910
6810
|
}
|
|
6911
|
-
return
|
|
6912
|
-
case
|
|
6811
|
+
return _context23.d(_regeneratorValues(_loop()), 4);
|
|
6812
|
+
case 4:
|
|
6913
6813
|
jj++;
|
|
6914
|
-
|
|
6814
|
+
_context23.n = 3;
|
|
6915
6815
|
break;
|
|
6916
|
-
case
|
|
6816
|
+
case 5:
|
|
6917
6817
|
// apply the procedure
|
|
6918
6818
|
procName = expr.procedure.type === 'path' ? expr.procedure.steps[0].value : expr.procedure.value;
|
|
6919
|
-
|
|
6819
|
+
_context23.p = 6;
|
|
6920
6820
|
if (_typeof(proc) === 'object') {
|
|
6921
6821
|
proc.token = procName;
|
|
6922
6822
|
proc.position = expr.position;
|
|
6923
6823
|
}
|
|
6924
|
-
|
|
6824
|
+
_context23.n = 7;
|
|
6925
6825
|
return apply(proc, evaluatedArgs, input, environment);
|
|
6926
|
-
case
|
|
6927
|
-
result =
|
|
6928
|
-
|
|
6826
|
+
case 7:
|
|
6827
|
+
result = _context23.v;
|
|
6828
|
+
_context23.n = 9;
|
|
6929
6829
|
break;
|
|
6930
|
-
case
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
if (!
|
|
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
|
-
|
|
6835
|
+
_t18.position = expr.position;
|
|
6936
6836
|
}
|
|
6937
|
-
if (!
|
|
6837
|
+
if (!_t18.token) {
|
|
6938
6838
|
// and the function identifier
|
|
6939
|
-
|
|
6839
|
+
_t18.token = procName;
|
|
6940
6840
|
}
|
|
6941
|
-
throw
|
|
6942
|
-
case
|
|
6943
|
-
return
|
|
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
|
-
},
|
|
6845
|
+
}, _callee22, null, [[6, 8]]);
|
|
6949
6846
|
}));
|
|
6950
6847
|
return _evaluateFunction.apply(this, arguments);
|
|
6951
6848
|
}
|
|
6952
|
-
function apply(
|
|
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__*/
|
|
6965
|
-
var result, next, evaluatedArgs, ii;
|
|
6966
|
-
return
|
|
6967
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
-
|
|
6872
|
+
_context24.n = 9;
|
|
6976
6873
|
break;
|
|
6977
6874
|
}
|
|
6978
|
-
|
|
6875
|
+
_context24.n = 3;
|
|
6979
6876
|
return _evaluate2(result.body.procedure, result.input, result.environment);
|
|
6980
|
-
case
|
|
6981
|
-
next =
|
|
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
|
|
6885
|
+
case 4:
|
|
6989
6886
|
if (!(ii < result.body.arguments.length)) {
|
|
6990
|
-
|
|
6887
|
+
_context24.n = 7;
|
|
6991
6888
|
break;
|
|
6992
6889
|
}
|
|
6993
|
-
|
|
6994
|
-
|
|
6890
|
+
_t19 = evaluatedArgs;
|
|
6891
|
+
_context24.n = 5;
|
|
6995
6892
|
return _evaluate2(result.body.arguments[ii], result.input, result.environment);
|
|
6996
|
-
case
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
case
|
|
6893
|
+
case 5:
|
|
6894
|
+
_t20 = _context24.v;
|
|
6895
|
+
_t19.push.call(_t19, _t20);
|
|
6896
|
+
case 6:
|
|
7000
6897
|
ii++;
|
|
7001
|
-
|
|
6898
|
+
_context24.n = 4;
|
|
7002
6899
|
break;
|
|
7003
|
-
case
|
|
7004
|
-
|
|
6900
|
+
case 7:
|
|
6901
|
+
_context24.n = 8;
|
|
7005
6902
|
return applyInner(next, evaluatedArgs, input, environment);
|
|
7006
|
-
case
|
|
7007
|
-
result =
|
|
7008
|
-
|
|
6903
|
+
case 8:
|
|
6904
|
+
result = _context24.v;
|
|
6905
|
+
_context24.n = 2;
|
|
7009
6906
|
break;
|
|
7010
|
-
case
|
|
7011
|
-
return
|
|
7012
|
-
case 26:
|
|
7013
|
-
case "end":
|
|
7014
|
-
return _context26.stop();
|
|
6907
|
+
case 9:
|
|
6908
|
+
return _context24.a(2, result);
|
|
7015
6909
|
}
|
|
7016
|
-
},
|
|
6910
|
+
}, _callee23);
|
|
7017
6911
|
}));
|
|
7018
6912
|
return _apply.apply(this, arguments);
|
|
7019
6913
|
}
|
|
7020
|
-
function applyInner(
|
|
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__*/
|
|
7032
|
-
var result, validatedArgs, focus;
|
|
7033
|
-
return
|
|
7034
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
-
|
|
6936
|
+
_context25.n = 2;
|
|
7043
6937
|
break;
|
|
7044
6938
|
}
|
|
7045
|
-
|
|
6939
|
+
_context25.n = 1;
|
|
7046
6940
|
return applyProcedure(proc, validatedArgs);
|
|
7047
|
-
case
|
|
7048
|
-
result =
|
|
7049
|
-
|
|
6941
|
+
case 1:
|
|
6942
|
+
result = _context25.v;
|
|
6943
|
+
_context25.n = 9;
|
|
7050
6944
|
break;
|
|
7051
|
-
case
|
|
6945
|
+
case 2:
|
|
7052
6946
|
if (!(proc && proc._jsonata_function === true)) {
|
|
7053
|
-
|
|
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
|
-
|
|
6961
|
+
_context25.n = 4;
|
|
7068
6962
|
break;
|
|
7069
6963
|
}
|
|
7070
|
-
|
|
6964
|
+
_context25.n = 3;
|
|
7071
6965
|
return result;
|
|
7072
|
-
case
|
|
7073
|
-
result =
|
|
7074
|
-
case
|
|
7075
|
-
|
|
6966
|
+
case 3:
|
|
6967
|
+
result = _context25.v;
|
|
6968
|
+
case 4:
|
|
6969
|
+
_context25.n = 9;
|
|
7076
6970
|
break;
|
|
7077
|
-
case
|
|
6971
|
+
case 5:
|
|
7078
6972
|
if (!(typeof proc === 'function')) {
|
|
7079
|
-
|
|
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
|
-
|
|
6982
|
+
_context25.n = 7;
|
|
7089
6983
|
break;
|
|
7090
6984
|
}
|
|
7091
|
-
|
|
6985
|
+
_context25.n = 6;
|
|
7092
6986
|
return result;
|
|
7093
|
-
case
|
|
7094
|
-
result =
|
|
7095
|
-
case
|
|
7096
|
-
|
|
6987
|
+
case 6:
|
|
6988
|
+
result = _context25.v;
|
|
6989
|
+
case 7:
|
|
6990
|
+
_context25.n = 9;
|
|
7097
6991
|
break;
|
|
7098
|
-
case
|
|
6992
|
+
case 8:
|
|
7099
6993
|
throw {
|
|
7100
6994
|
code: "T1006",
|
|
7101
6995
|
stack: new Error().stack
|
|
7102
6996
|
};
|
|
7103
|
-
case
|
|
7104
|
-
|
|
6997
|
+
case 9:
|
|
6998
|
+
_context25.n = 11;
|
|
7105
6999
|
break;
|
|
7106
|
-
case
|
|
7107
|
-
|
|
7108
|
-
|
|
7000
|
+
case 10:
|
|
7001
|
+
_context25.p = 10;
|
|
7002
|
+
_t21 = _context25.v;
|
|
7109
7003
|
if (proc) {
|
|
7110
|
-
if (typeof
|
|
7111
|
-
|
|
7004
|
+
if (typeof _t21.token == 'undefined' && typeof proc.token !== 'undefined') {
|
|
7005
|
+
_t21.token = proc.token;
|
|
7112
7006
|
}
|
|
7113
|
-
|
|
7007
|
+
_t21.position = proc.position || _t21.position;
|
|
7114
7008
|
}
|
|
7115
|
-
throw
|
|
7116
|
-
case
|
|
7117
|
-
return
|
|
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
|
-
},
|
|
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__*/
|
|
7141
|
-
return
|
|
7142
|
-
while (1) switch (_context2.
|
|
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.
|
|
7035
|
+
_context2.n = 1;
|
|
7145
7036
|
return apply(procedure, args, input, !!self ? self.environment : environment);
|
|
7146
|
-
case
|
|
7147
|
-
return _context2.
|
|
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 (
|
|
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(
|
|
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__*/
|
|
7180
|
-
var result, evaluatedArgs, ii, arg, proc;
|
|
7181
|
-
return
|
|
7182
|
-
while (1) switch (
|
|
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
|
|
7076
|
+
case 1:
|
|
7189
7077
|
if (!(ii < expr.arguments.length)) {
|
|
7190
|
-
|
|
7078
|
+
_context26.n = 5;
|
|
7191
7079
|
break;
|
|
7192
7080
|
}
|
|
7193
7081
|
arg = expr.arguments[ii];
|
|
7194
7082
|
if (!(arg.type === 'operator' && arg.value === '?')) {
|
|
7195
|
-
|
|
7083
|
+
_context26.n = 2;
|
|
7196
7084
|
break;
|
|
7197
7085
|
}
|
|
7198
7086
|
evaluatedArgs.push(arg);
|
|
7199
|
-
|
|
7087
|
+
_context26.n = 4;
|
|
7200
7088
|
break;
|
|
7201
|
-
case
|
|
7202
|
-
|
|
7203
|
-
|
|
7089
|
+
case 2:
|
|
7090
|
+
_t22 = evaluatedArgs;
|
|
7091
|
+
_context26.n = 3;
|
|
7204
7092
|
return _evaluate2(arg, input, environment);
|
|
7205
|
-
case
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
case
|
|
7093
|
+
case 3:
|
|
7094
|
+
_t23 = _context26.v;
|
|
7095
|
+
_t22.push.call(_t22, _t23);
|
|
7096
|
+
case 4:
|
|
7209
7097
|
ii++;
|
|
7210
|
-
|
|
7098
|
+
_context26.n = 1;
|
|
7211
7099
|
break;
|
|
7212
|
-
case
|
|
7213
|
-
|
|
7100
|
+
case 5:
|
|
7101
|
+
_context26.n = 6;
|
|
7214
7102
|
return _evaluate2(expr.procedure, input, environment);
|
|
7215
|
-
case
|
|
7216
|
-
proc =
|
|
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
|
-
|
|
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
|
|
7115
|
+
case 7:
|
|
7228
7116
|
if (!isLambda(proc)) {
|
|
7229
|
-
|
|
7117
|
+
_context26.n = 8;
|
|
7230
7118
|
break;
|
|
7231
7119
|
}
|
|
7232
7120
|
result = partialApplyProcedure(proc, evaluatedArgs);
|
|
7233
|
-
|
|
7121
|
+
_context26.n = 11;
|
|
7234
7122
|
break;
|
|
7235
|
-
case
|
|
7123
|
+
case 8:
|
|
7236
7124
|
if (!(proc && proc._jsonata_function === true)) {
|
|
7237
|
-
|
|
7125
|
+
_context26.n = 9;
|
|
7238
7126
|
break;
|
|
7239
7127
|
}
|
|
7240
7128
|
result = partialApplyNativeFunction(proc.implementation, evaluatedArgs);
|
|
7241
|
-
|
|
7129
|
+
_context26.n = 11;
|
|
7242
7130
|
break;
|
|
7243
|
-
case
|
|
7131
|
+
case 9:
|
|
7244
7132
|
if (!(typeof proc === 'function')) {
|
|
7245
|
-
|
|
7133
|
+
_context26.n = 10;
|
|
7246
7134
|
break;
|
|
7247
7135
|
}
|
|
7248
7136
|
result = partialApplyNativeFunction(proc, evaluatedArgs);
|
|
7249
|
-
|
|
7137
|
+
_context26.n = 11;
|
|
7250
7138
|
break;
|
|
7251
|
-
case
|
|
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
|
|
7259
|
-
return
|
|
7260
|
-
case 35:
|
|
7261
|
-
case "end":
|
|
7262
|
-
return _context28.stop();
|
|
7146
|
+
case 11:
|
|
7147
|
+
return _context26.a(2, result);
|
|
7263
7148
|
}
|
|
7264
|
-
},
|
|
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(
|
|
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__*/
|
|
7178
|
+
_applyProcedure = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(proc, args) {
|
|
7294
7179
|
var result, env;
|
|
7295
|
-
return
|
|
7296
|
-
while (1) switch (
|
|
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
|
-
|
|
7188
|
+
_context27.n = 2;
|
|
7304
7189
|
break;
|
|
7305
7190
|
}
|
|
7306
|
-
|
|
7191
|
+
_context27.n = 1;
|
|
7307
7192
|
return applyNativeFunction(proc.body, env);
|
|
7308
|
-
case
|
|
7309
|
-
result =
|
|
7310
|
-
|
|
7193
|
+
case 1:
|
|
7194
|
+
result = _context27.v;
|
|
7195
|
+
_context27.n = 4;
|
|
7311
7196
|
break;
|
|
7312
|
-
case
|
|
7313
|
-
|
|
7197
|
+
case 2:
|
|
7198
|
+
_context27.n = 3;
|
|
7314
7199
|
return _evaluate2(proc.body, proc.input, env);
|
|
7315
|
-
case
|
|
7316
|
-
result =
|
|
7317
|
-
case
|
|
7318
|
-
return
|
|
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
|
-
},
|
|
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(
|
|
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__*/
|
|
7267
|
+
_applyNativeFunction = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(proc, env) {
|
|
7386
7268
|
var sigArgs, args, focus, result;
|
|
7387
|
-
return
|
|
7388
|
-
while (1) switch (
|
|
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
|
-
|
|
7281
|
+
_context28.n = 2;
|
|
7400
7282
|
break;
|
|
7401
7283
|
}
|
|
7402
|
-
|
|
7284
|
+
_context28.n = 1;
|
|
7403
7285
|
return result;
|
|
7404
|
-
case
|
|
7405
|
-
result =
|
|
7406
|
-
case
|
|
7407
|
-
return
|
|
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
|
-
},
|
|
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(
|
|
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__*/
|
|
7455
|
-
var input, ast, result;
|
|
7456
|
-
return
|
|
7457
|
-
while (1) switch (
|
|
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
|
-
|
|
7339
|
+
_context29.n = 1;
|
|
7461
7340
|
break;
|
|
7462
7341
|
}
|
|
7463
|
-
return
|
|
7464
|
-
case
|
|
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
|
-
|
|
7353
|
+
_context29.p = 2;
|
|
7475
7354
|
ast = parser(expr, false);
|
|
7476
|
-
|
|
7355
|
+
_context29.n = 4;
|
|
7477
7356
|
break;
|
|
7478
|
-
case
|
|
7479
|
-
|
|
7480
|
-
|
|
7357
|
+
case 3:
|
|
7358
|
+
_context29.p = 3;
|
|
7359
|
+
_t24 = _context29.v;
|
|
7481
7360
|
// error parsing the expression passed to $eval
|
|
7482
|
-
populateMessage(
|
|
7361
|
+
populateMessage(_t24);
|
|
7483
7362
|
throw {
|
|
7484
7363
|
stack: new Error().stack,
|
|
7485
7364
|
code: "D3120",
|
|
7486
|
-
value:
|
|
7487
|
-
error:
|
|
7365
|
+
value: _t24.message,
|
|
7366
|
+
error: _t24
|
|
7488
7367
|
};
|
|
7489
|
-
case
|
|
7490
|
-
|
|
7491
|
-
|
|
7368
|
+
case 4:
|
|
7369
|
+
_context29.p = 4;
|
|
7370
|
+
_context29.n = 5;
|
|
7492
7371
|
return _evaluate2(ast, input, this.environment);
|
|
7493
|
-
case
|
|
7494
|
-
result =
|
|
7495
|
-
|
|
7372
|
+
case 5:
|
|
7373
|
+
result = _context29.v;
|
|
7374
|
+
_context29.n = 7;
|
|
7496
7375
|
break;
|
|
7497
|
-
case
|
|
7498
|
-
|
|
7499
|
-
|
|
7376
|
+
case 6:
|
|
7377
|
+
_context29.p = 6;
|
|
7378
|
+
_t25 = _context29.v;
|
|
7500
7379
|
// error evaluating the expression passed to $eval
|
|
7501
|
-
populateMessage(
|
|
7380
|
+
populateMessage(_t25);
|
|
7502
7381
|
throw {
|
|
7503
7382
|
stack: new Error().stack,
|
|
7504
7383
|
code: "D3121",
|
|
7505
|
-
value:
|
|
7506
|
-
error:
|
|
7384
|
+
value: _t25.message,
|
|
7385
|
+
error: _t25
|
|
7507
7386
|
};
|
|
7508
|
-
case
|
|
7509
|
-
return
|
|
7510
|
-
case 23:
|
|
7511
|
-
case "end":
|
|
7512
|
-
return _context31.stop();
|
|
7387
|
+
case 7:
|
|
7388
|
+
return _context29.a(2, result);
|
|
7513
7389
|
}
|
|
7514
|
-
},
|
|
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__*/
|
|
7803
|
-
var err, exec_env, v, it;
|
|
7804
|
-
return
|
|
7805
|
-
while (1) switch (_context3.
|
|
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.
|
|
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
|
|
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.
|
|
7841
|
-
_context3.
|
|
7716
|
+
_context3.p = 2;
|
|
7717
|
+
_context3.n = 3;
|
|
7842
7718
|
return _evaluate2(_ast, input, exec_env);
|
|
7843
|
-
case
|
|
7844
|
-
it = _context3.
|
|
7719
|
+
case 3:
|
|
7720
|
+
it = _context3.v;
|
|
7845
7721
|
if (typeof callback === "function") {
|
|
7846
7722
|
callback(null, it);
|
|
7847
7723
|
}
|
|
7848
|
-
return _context3.
|
|
7849
|
-
case
|
|
7850
|
-
_context3.
|
|
7851
|
-
|
|
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(
|
|
7854
|
-
throw
|
|
7855
|
-
case
|
|
7856
|
-
|
|
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, [[
|
|
7734
|
+
}, _callee3, null, [[2, 4]]);
|
|
7860
7735
|
}));
|
|
7861
|
-
function evaluate(
|
|
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';
|