@almadar/evaluator 2.45.0 → 2.47.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 +30 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1564,6 +1564,26 @@ function evalPath(args, evaluate2, ctx) {
|
|
|
1564
1564
|
return segments.join(".");
|
|
1565
1565
|
}
|
|
1566
1566
|
|
|
1567
|
+
// std/json.ts
|
|
1568
|
+
function evalJsonParse(args, evaluate2, ctx) {
|
|
1569
|
+
const val = evaluate2(args[0], ctx);
|
|
1570
|
+
if (typeof val !== "string") return null;
|
|
1571
|
+
try {
|
|
1572
|
+
return JSON.parse(val);
|
|
1573
|
+
} catch {
|
|
1574
|
+
return null;
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
function evalJsonStringify(args, evaluate2, ctx) {
|
|
1578
|
+
const val = evaluate2(args[0], ctx);
|
|
1579
|
+
try {
|
|
1580
|
+
const out = JSON.stringify(val);
|
|
1581
|
+
return out === void 0 ? null : out;
|
|
1582
|
+
} catch {
|
|
1583
|
+
return null;
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1567
1587
|
// std/validate.ts
|
|
1568
1588
|
function evalValidateRequired(args, evaluate2, ctx) {
|
|
1569
1589
|
const value = evaluate2(args[0], ctx);
|
|
@@ -4204,6 +4224,14 @@ var OPERATOR_TABLE = {
|
|
|
4204
4224
|
"last": evalLast,
|
|
4205
4225
|
"nth": evalNth,
|
|
4206
4226
|
"includes": evalIncludes,
|
|
4227
|
+
// Legacy bare alias for 'str/join' — orbital-core's evaluator already
|
|
4228
|
+
// dispatches both spellings to the same op (`"join" | "str/join" =>
|
|
4229
|
+
// K::JoinOp`, evaluator/operators/mod.rs:121); this interpreter had no
|
|
4230
|
+
// entry at all for the bare form, so `(join arr sep)` fell through to the
|
|
4231
|
+
// generic "unknown operator, treat as literal data" path instead of
|
|
4232
|
+
// erroring OR joining — confirmed live via project-friday's Global Search
|
|
4233
|
+
// (L-26, `Almadar_LOLO_Gaps.md`).
|
|
4234
|
+
"join": evalStrJoin,
|
|
4207
4235
|
"empty": evalEmpty,
|
|
4208
4236
|
"list": evalList,
|
|
4209
4237
|
"set": (args, evaluate2, ctx) => {
|
|
@@ -4418,6 +4446,8 @@ var OPERATOR_TABLE = {
|
|
|
4418
4446
|
"object/clone": evalObjectClone,
|
|
4419
4447
|
"object/deepClone": evalObjectDeepClone,
|
|
4420
4448
|
"path": evalPath,
|
|
4449
|
+
"json/parse": evalJsonParse,
|
|
4450
|
+
"json/stringify": evalJsonStringify,
|
|
4421
4451
|
"validate/required": evalValidateRequired,
|
|
4422
4452
|
"validate/string": evalValidateString,
|
|
4423
4453
|
"validate/number": evalValidateNumber,
|