@almadar/evaluator 2.27.0 → 2.28.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-CA1FEv6g.d.ts → index-BjtK8dP9.d.ts} +12 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/dist/operators/index.d.ts +1 -1
- package/dist/operators/index.js +10 -6
- package/dist/operators/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -230,14 +230,22 @@ declare function evalMatches(args: SExpr[], evaluate: Evaluator$4, ctx: Evaluati
|
|
|
230
230
|
type Evaluator$3 = (expr: SExpr, ctx: EvaluationContext) => unknown;
|
|
231
231
|
/**
|
|
232
232
|
* Evaluate logical AND: ["and", a, b, ...]
|
|
233
|
-
*
|
|
233
|
+
* Operand semantics (matches JS `&&` and the compiled TS path — Phase 5,
|
|
234
|
+
* R-OR-AND-RETURN-BOOLEAN): returns the first falsy argument's VALUE, or the
|
|
235
|
+
* last argument's value if all are truthy. Short-circuits — does not evaluate
|
|
236
|
+
* past the first falsy. (When every operand is boolean — the case for all
|
|
237
|
+
* shipping behaviors — this is observationally identical to returning a
|
|
238
|
+
* boolean.)
|
|
234
239
|
*/
|
|
235
|
-
declare function evalAnd(args: SExpr[], evaluate: Evaluator$3, ctx: EvaluationContext):
|
|
240
|
+
declare function evalAnd(args: SExpr[], evaluate: Evaluator$3, ctx: EvaluationContext): unknown;
|
|
236
241
|
/**
|
|
237
242
|
* Evaluate logical OR: ["or", a, b, ...]
|
|
238
|
-
*
|
|
243
|
+
* Operand semantics (matches JS `||` and the compiled TS path — Phase 5,
|
|
244
|
+
* R-OR-AND-RETURN-BOOLEAN): returns the first truthy argument's VALUE, or the
|
|
245
|
+
* last argument's value if all are falsy. Short-circuits — does not evaluate
|
|
246
|
+
* past the first truthy.
|
|
239
247
|
*/
|
|
240
|
-
declare function evalOr(args: SExpr[], evaluate: Evaluator$3, ctx: EvaluationContext):
|
|
248
|
+
declare function evalOr(args: SExpr[], evaluate: Evaluator$3, ctx: EvaluationContext): unknown;
|
|
241
249
|
/**
|
|
242
250
|
* Evaluate logical NOT: ["not", a]
|
|
243
251
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SExpr } from '@almadar/core';
|
|
2
2
|
export { CORE_BINDINGS, CoreBinding, Expression, ExpressionSchema, ParsedBinding, SExpr, SExprAtom, SExprSchema, collectBindings, getArgs, getOperator, isBinding, isSExpr, isSExprAtom, isSExprCall, isValidBinding, parseBinding, sexpr, walkSExpr } from '@almadar/core';
|
|
3
|
-
import { E as EvaluationContext } from './index-
|
|
4
|
-
export { U as UserContext, c as createChildContext, a as createEffectContext, b as createMinimalContext, e as evalAbs, d as evalAdd, f as evalAnd, g as evalAtomic, h as evalCallService, i as evalCeil, j as evalClamp, k as evalConcat, l as evalCount, m as evalDecrement, n as evalDeref, o as evalDespawn, p as evalDivide, q as evalDo, r as evalEmit, s as evalEmpty, t as evalEqual, u as evalFilter, v as evalFind, w as evalFirst, x as evalFloor, y as evalFn, z as evalGreaterThan, A as evalGreaterThanOrEqual, B as evalIf, C as evalIncludes, D as evalIncrement, F as evalLast, G as evalLessThan, H as evalLessThanOrEqual, I as evalLet, J as evalList, K as evalMap, L as evalMatches, M as evalMax, N as evalMin, O as evalModulo, P as evalMultiply, Q as evalNavigate, R as evalNot, S as evalNotEqual, T as evalNotify, V as evalNth, W as evalOr, X as evalPersist, Y as evalRef, Z as evalRenderUI, _ as evalRound, $ as evalSet, a0 as evalSetDynamic, a1 as evalSpawn, a2 as evalSubtract, a3 as evalSum, a4 as evalSwap, a5 as evalWatch, a6 as evalWhen, a7 as resolveBinding } from './index-
|
|
3
|
+
import { E as EvaluationContext } from './index-BjtK8dP9.js';
|
|
4
|
+
export { U as UserContext, c as createChildContext, a as createEffectContext, b as createMinimalContext, e as evalAbs, d as evalAdd, f as evalAnd, g as evalAtomic, h as evalCallService, i as evalCeil, j as evalClamp, k as evalConcat, l as evalCount, m as evalDecrement, n as evalDeref, o as evalDespawn, p as evalDivide, q as evalDo, r as evalEmit, s as evalEmpty, t as evalEqual, u as evalFilter, v as evalFind, w as evalFirst, x as evalFloor, y as evalFn, z as evalGreaterThan, A as evalGreaterThanOrEqual, B as evalIf, C as evalIncludes, D as evalIncrement, F as evalLast, G as evalLessThan, H as evalLessThanOrEqual, I as evalLet, J as evalList, K as evalMap, L as evalMatches, M as evalMax, N as evalMin, O as evalModulo, P as evalMultiply, Q as evalNavigate, R as evalNot, S as evalNotEqual, T as evalNotify, V as evalNth, W as evalOr, X as evalPersist, Y as evalRef, Z as evalRenderUI, _ as evalRound, $ as evalSet, a0 as evalSetDynamic, a1 as evalSpawn, a2 as evalSubtract, a3 as evalSum, a4 as evalSwap, a5 as evalWatch, a6 as evalWhen, a7 as resolveBinding } from './index-BjtK8dP9.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* S-Expression Evaluator
|
package/dist/index.js
CHANGED
|
@@ -237,20 +237,24 @@ function toComparable(value) {
|
|
|
237
237
|
|
|
238
238
|
// operators/logic.ts
|
|
239
239
|
function evalAnd(args, evaluate2, ctx) {
|
|
240
|
+
let last = true;
|
|
240
241
|
for (const arg of args) {
|
|
241
|
-
|
|
242
|
-
|
|
242
|
+
last = evaluate2(arg, ctx);
|
|
243
|
+
if (!toBoolean(last)) {
|
|
244
|
+
return last;
|
|
243
245
|
}
|
|
244
246
|
}
|
|
245
|
-
return
|
|
247
|
+
return last;
|
|
246
248
|
}
|
|
247
249
|
function evalOr(args, evaluate2, ctx) {
|
|
250
|
+
let last = false;
|
|
248
251
|
for (const arg of args) {
|
|
249
|
-
|
|
250
|
-
|
|
252
|
+
last = evaluate2(arg, ctx);
|
|
253
|
+
if (toBoolean(last)) {
|
|
254
|
+
return last;
|
|
251
255
|
}
|
|
252
256
|
}
|
|
253
|
-
return
|
|
257
|
+
return last;
|
|
254
258
|
}
|
|
255
259
|
function evalNot(args, evaluate2, ctx) {
|
|
256
260
|
return !toBoolean(evaluate2(args[0], ctx));
|