@almadar/evaluator 2.14.0 → 2.16.0
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/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -997,17 +997,17 @@ function evalArrayEmpty(args, evaluate2, ctx) {
|
|
|
997
997
|
}
|
|
998
998
|
function evalArrayFirst(args, evaluate2, ctx) {
|
|
999
999
|
const arr = evaluate2(args[0], ctx);
|
|
1000
|
-
return arr?.[0];
|
|
1000
|
+
return arr?.[0] ?? null;
|
|
1001
1001
|
}
|
|
1002
1002
|
function evalArrayLast(args, evaluate2, ctx) {
|
|
1003
1003
|
const arr = evaluate2(args[0], ctx);
|
|
1004
|
-
if (!Array.isArray(arr) || arr.length === 0) return
|
|
1004
|
+
if (!Array.isArray(arr) || arr.length === 0) return null;
|
|
1005
1005
|
return arr[arr.length - 1];
|
|
1006
1006
|
}
|
|
1007
1007
|
function evalArrayNth(args, evaluate2, ctx) {
|
|
1008
1008
|
const arr = evaluate2(args[0], ctx);
|
|
1009
1009
|
const index = evaluate2(args[1], ctx);
|
|
1010
|
-
return arr?.[index];
|
|
1010
|
+
return arr?.[index] ?? null;
|
|
1011
1011
|
}
|
|
1012
1012
|
function evalArraySlice(args, evaluate2, ctx) {
|
|
1013
1013
|
const arr = evaluate2(args[0], ctx);
|
|
@@ -1121,7 +1121,7 @@ function evalArrayIndexOf(args, evaluate2, ctx) {
|
|
|
1121
1121
|
function evalArrayFind(args, evaluate2, ctx) {
|
|
1122
1122
|
const arr = evaluate2(args[0], ctx);
|
|
1123
1123
|
const predExpr = args[1];
|
|
1124
|
-
return (arr ?? []).find((item, i) => evalWithItem(predExpr, evaluate2, ctx, item, i));
|
|
1124
|
+
return (arr ?? []).find((item, i) => evalWithItem(predExpr, evaluate2, ctx, item, i)) ?? null;
|
|
1125
1125
|
}
|
|
1126
1126
|
function evalArrayFindIndex(args, evaluate2, ctx) {
|
|
1127
1127
|
const arr = evaluate2(args[0], ctx);
|
|
@@ -3686,6 +3686,7 @@ var SExpressionEvaluator = class {
|
|
|
3686
3686
|
return evalClamp(args, evaluate2, ctx);
|
|
3687
3687
|
// Comparison
|
|
3688
3688
|
case "=":
|
|
3689
|
+
case "==":
|
|
3689
3690
|
return evalEqual(args, evaluate2, ctx);
|
|
3690
3691
|
case "!=":
|
|
3691
3692
|
return evalNotEqual(args, evaluate2, ctx);
|