ecma-evaluator 2.0.10 → 2.1.1
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/README.md +4 -4
- package/README.zh-CN.md +4 -4
- package/dist/cjs/Evaluator.d.cts +6 -4
- package/dist/cjs/index.cjs +1024 -194
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/Evaluator.d.mts +6 -4
- package/dist/esm/index.mjs +1024 -194
- package/dist/esm/index.mjs.map +1 -1
- package/package.json +16 -7
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://996.icu/#/en_US)
|
|
4
4
|
[](https://github.com/996icu/996.ICU/blob/master/LICENSE)
|
|
5
|
-

|
|
6
6
|
[](https://badge.fury.io/js/ecma-evaluator)
|
|
7
7
|
|
|
8
8
|
A tiny, fast, and **secure** JavaScript expression evaluator for safely evaluating expressions and template strings in a sandboxed environment.
|
|
@@ -32,8 +32,8 @@ evalTemplate("Hello {{ name }}!", { name: "World" }); // "Hello World!"
|
|
|
32
32
|
|
|
33
33
|
## Documentation
|
|
34
34
|
|
|
35
|
-
- [Getting started](/guide/getting-started)
|
|
36
|
-
- [API, supported features, security, and usage reference](/guide/reference)
|
|
37
|
-
- [Online playground](/#playground)
|
|
35
|
+
- [Getting started](https://axetroy.github.io/ecma-evaluator/guide/getting-started)
|
|
36
|
+
- [API, supported features, security, and usage reference](https://axetroy.github.io/ecma-evaluator/guide/reference)
|
|
37
|
+
- [Online playground](https://axetroy.github.io/ecma-evaluator/#playground)
|
|
38
38
|
|
|
39
39
|
See the [documentation site](https://axetroy.github.io/ecma-evaluator/).
|
package/README.zh-CN.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://996.icu/#/zh_CN)
|
|
4
4
|
[](https://github.com/996icu/996.ICU/blob/master/LICENSE)
|
|
5
|
-

|
|
6
6
|
[](https://badge.fury.io/js/ecma-evaluator)
|
|
7
7
|
|
|
8
8
|
一个小巧、快速且**安全**的 JavaScript 表达式求值器,用于在沙箱环境中安全地执行表达式和模板字符串。
|
|
@@ -32,8 +32,8 @@ evalTemplate("你好,{{ name }}!", { name: "世界" }); // "你好,世界
|
|
|
32
32
|
|
|
33
33
|
## 文档
|
|
34
34
|
|
|
35
|
-
- [快速开始](/zh-CN/guide/getting-started)
|
|
36
|
-
- [API、支持的特性、安全性和使用说明](/zh-CN/guide/reference)
|
|
37
|
-
- [在线体验](/zh-CN/#playground)
|
|
35
|
+
- [快速开始](https://axetroy.github.io/ecma-evaluator/zh-CN/guide/getting-started)
|
|
36
|
+
- [API、支持的特性、安全性和使用说明](https://axetroy.github.io/ecma-evaluator/zh-CN/guide/reference)
|
|
37
|
+
- [在线体验](https://axetroy.github.io/ecma-evaluator/zh-CN/#playground)
|
|
38
38
|
|
|
39
39
|
也可以访问[文档网站](https://axetroy.github.io/ecma-evaluator/zh-CN/)。
|
package/dist/cjs/Evaluator.d.cts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Node } from "acorn";
|
|
2
|
-
|
|
3
1
|
export interface EvaluatorOptions {
|
|
4
2
|
/**
|
|
5
3
|
* Maximum expression length in UTF-16 code units (hard maximum: 100000).
|
|
@@ -11,6 +9,12 @@ export interface EvaluatorOptions {
|
|
|
11
9
|
* @default 10000
|
|
12
10
|
*/
|
|
13
11
|
maxEvaluationSteps?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Maximum interpreter recursion depth (hard maximum: 2000). Bounds nested
|
|
14
|
+
* expressions so a deeply nested input cannot exhaust the host call stack.
|
|
15
|
+
* @default 1000
|
|
16
|
+
*/
|
|
17
|
+
maxDepth?: number;
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
export declare class Evaluator {
|
|
@@ -20,5 +24,3 @@ export declare class Evaluator {
|
|
|
20
24
|
|
|
21
25
|
evaluate<T = unknown>(expression: string): T;
|
|
22
26
|
}
|
|
23
|
-
|
|
24
|
-
export declare function getNodeString(node: Node): string;
|