@almadar/evaluator 2.40.0 → 2.41.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 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1181,6 +1181,11 @@ function evalArrayMap(args, evaluate2, ctx) {
|
|
|
1181
1181
|
return (arr ?? []).map((item, i) => evalWithItem(mapExpr, evaluate2, ctx, item, i));
|
|
1182
1182
|
}
|
|
1183
1183
|
function evalArrayReduce(args, evaluate2, ctx) {
|
|
1184
|
+
if (isSExpr(args[1]) && getOperator(args[1]) === "fn" && !(isSExpr(args[2]) && getOperator(args[2]) === "fn")) {
|
|
1185
|
+
throw new Error(
|
|
1186
|
+
"(array/reduce \u2026): the reducer lambda goes at argument 3 \u2014 (array/reduce arr init (fn (acc x) \u2026)) \u2014 same order the compiled path enforces (SEXPR_LAMBDA_ARG_POSITION)"
|
|
1187
|
+
);
|
|
1188
|
+
}
|
|
1184
1189
|
const arr = evaluate2(args[0], ctx);
|
|
1185
1190
|
const init = evaluate2(args[1], ctx);
|
|
1186
1191
|
const reducerExpr = args[2];
|