bare-script 3.8.20 → 3.8.21
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/lib/library.js +5 -4
- package/package.json +2 -2
package/lib/library.js
CHANGED
|
@@ -398,18 +398,19 @@ const arraySortArgs = valueArgsModel([
|
|
|
398
398
|
// $doc: Evaluate a [BareScript expression model](../model/#var.vName='Expression')
|
|
399
399
|
// $arg expr: The [BareScript expression model](../model/#var.vName='Expression')
|
|
400
400
|
// $arg locals: Optional (default is null). The local variables object.
|
|
401
|
-
// $arg
|
|
401
|
+
// $arg globals: Optional (default is null). The global variables object.
|
|
402
402
|
// $return: The expression result
|
|
403
403
|
function barescriptEvaluateExpression(args, options) {
|
|
404
|
-
const [expr, locals_,
|
|
404
|
+
const [expr, locals_, globals] = valueArgsValidate(barescriptEvaluateExpressionArgs, args);
|
|
405
405
|
validateExpression(expr);
|
|
406
|
-
|
|
406
|
+
const evaluateOptions = (globals === null ? options : {...options, 'globals': globals});
|
|
407
|
+
return evaluateExpression(expr, evaluateOptions, locals_, false);
|
|
407
408
|
}
|
|
408
409
|
|
|
409
410
|
const barescriptEvaluateExpressionArgs = valueArgsModel([
|
|
410
411
|
{'name': 'expr', 'type': 'object'},
|
|
411
412
|
{'name': 'locals', 'type': 'object', 'nullable': true},
|
|
412
|
-
{'name': '
|
|
413
|
+
{'name': 'globals', 'type': 'object', 'nullable': true}
|
|
413
414
|
]);
|
|
414
415
|
|
|
415
416
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "bare-script",
|
|
4
|
-
"version": "3.8.
|
|
4
|
+
"version": "3.8.21",
|
|
5
5
|
"description": "BareScript; a lightweight scripting and expression language",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"expression",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@eslint/js": "~10.0",
|
|
35
35
|
"c8": "~11.0",
|
|
36
|
-
"eslint": "~10.
|
|
36
|
+
"eslint": "~10.1",
|
|
37
37
|
"globals": "~17.4",
|
|
38
38
|
"jsdoc": "~4.0"
|
|
39
39
|
}
|