starlight-cli 1.0.43 → 1.0.44
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 +19 -19
- package/package.json +1 -1
- package/src/evaluator.js +19 -19
package/dist/index.js
CHANGED
|
@@ -1370,6 +1370,25 @@ class Environment {
|
|
|
1370
1370
|
if (this.parent) return this.parent.get(name);
|
|
1371
1371
|
throw new Error(`Undefined variable: ${name}`);
|
|
1372
1372
|
}
|
|
1373
|
+
|
|
1374
|
+
set(name, value) {
|
|
1375
|
+
if (name in this.store) { this.store[name] = value; return value; }
|
|
1376
|
+
if (this.parent && this.parent.has(name)) { return this.parent.set(name, value); }
|
|
1377
|
+
this.store[name] = value;
|
|
1378
|
+
return value;
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
define(name, value) {
|
|
1382
|
+
this.store[name] = value;
|
|
1383
|
+
return value;
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
class Evaluator {
|
|
1388
|
+
constructor() {
|
|
1389
|
+
this.global = new Environment();
|
|
1390
|
+
this.setupBuiltins();
|
|
1391
|
+
}
|
|
1373
1392
|
formatValue(value, seen = new Set()) {
|
|
1374
1393
|
if (typeof value === 'object' && value !== null) {
|
|
1375
1394
|
if (seen.has(value)) return '[Circular]';
|
|
@@ -1402,25 +1421,6 @@ formatValue(value, seen = new Set()) {
|
|
|
1402
1421
|
return String(value);
|
|
1403
1422
|
}
|
|
1404
1423
|
|
|
1405
|
-
set(name, value) {
|
|
1406
|
-
if (name in this.store) { this.store[name] = value; return value; }
|
|
1407
|
-
if (this.parent && this.parent.has(name)) { return this.parent.set(name, value); }
|
|
1408
|
-
this.store[name] = value;
|
|
1409
|
-
return value;
|
|
1410
|
-
}
|
|
1411
|
-
|
|
1412
|
-
define(name, value) {
|
|
1413
|
-
this.store[name] = value;
|
|
1414
|
-
return value;
|
|
1415
|
-
}
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1418
|
-
class Evaluator {
|
|
1419
|
-
constructor() {
|
|
1420
|
-
this.global = new Environment();
|
|
1421
|
-
this.setupBuiltins();
|
|
1422
|
-
}
|
|
1423
|
-
|
|
1424
1424
|
setupBuiltins() {
|
|
1425
1425
|
this.global.define('len', arg => {
|
|
1426
1426
|
if (Array.isArray(arg) || typeof arg === 'string') return arg.length;
|
package/package.json
CHANGED
package/src/evaluator.js
CHANGED
|
@@ -27,6 +27,25 @@ class Environment {
|
|
|
27
27
|
if (this.parent) return this.parent.get(name);
|
|
28
28
|
throw new Error(`Undefined variable: ${name}`);
|
|
29
29
|
}
|
|
30
|
+
|
|
31
|
+
set(name, value) {
|
|
32
|
+
if (name in this.store) { this.store[name] = value; return value; }
|
|
33
|
+
if (this.parent && this.parent.has(name)) { return this.parent.set(name, value); }
|
|
34
|
+
this.store[name] = value;
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
define(name, value) {
|
|
39
|
+
this.store[name] = value;
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
class Evaluator {
|
|
45
|
+
constructor() {
|
|
46
|
+
this.global = new Environment();
|
|
47
|
+
this.setupBuiltins();
|
|
48
|
+
}
|
|
30
49
|
formatValue(value, seen = new Set()) {
|
|
31
50
|
if (typeof value === 'object' && value !== null) {
|
|
32
51
|
if (seen.has(value)) return '[Circular]';
|
|
@@ -59,25 +78,6 @@ formatValue(value, seen = new Set()) {
|
|
|
59
78
|
return String(value);
|
|
60
79
|
}
|
|
61
80
|
|
|
62
|
-
set(name, value) {
|
|
63
|
-
if (name in this.store) { this.store[name] = value; return value; }
|
|
64
|
-
if (this.parent && this.parent.has(name)) { return this.parent.set(name, value); }
|
|
65
|
-
this.store[name] = value;
|
|
66
|
-
return value;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
define(name, value) {
|
|
70
|
-
this.store[name] = value;
|
|
71
|
-
return value;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
class Evaluator {
|
|
76
|
-
constructor() {
|
|
77
|
-
this.global = new Environment();
|
|
78
|
-
this.setupBuiltins();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
81
|
setupBuiltins() {
|
|
82
82
|
this.global.define('len', arg => {
|
|
83
83
|
if (Array.isArray(arg) || typeof arg === 'string') return arg.length;
|