@danielsimonjr/mathts-expression 0.8.0 → 0.8.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.
Files changed (51) hide show
  1. package/README.md +42 -42
  2. package/dist/index.js +261 -333
  3. package/dist/node/AccessorNode.d.ts +121 -132
  4. package/dist/node/AccessorNode.d.ts.map +1 -1
  5. package/dist/node/ArrayNode.d.ts +25 -30
  6. package/dist/node/ArrayNode.d.ts.map +1 -1
  7. package/dist/node/AssignmentNode.d.ts +19 -32
  8. package/dist/node/AssignmentNode.d.ts.map +1 -1
  9. package/dist/node/BlockNode.d.ts +121 -126
  10. package/dist/node/BlockNode.d.ts.map +1 -1
  11. package/dist/node/ConditionalNode.d.ts +25 -30
  12. package/dist/node/ConditionalNode.d.ts.map +1 -1
  13. package/dist/node/ConstantNode.d.ts +93 -100
  14. package/dist/node/ConstantNode.d.ts.map +1 -1
  15. package/dist/node/FunctionAssignmentNode.d.ts +25 -30
  16. package/dist/node/FunctionAssignmentNode.d.ts.map +1 -1
  17. package/dist/node/FunctionNode.d.ts +32 -43
  18. package/dist/node/FunctionNode.d.ts.map +1 -1
  19. package/dist/node/IndexNode.d.ts +25 -34
  20. package/dist/node/IndexNode.d.ts.map +1 -1
  21. package/dist/node/Node.d.ts +41 -38
  22. package/dist/node/Node.d.ts.map +1 -1
  23. package/dist/node/ObjectNode.d.ts +25 -30
  24. package/dist/node/ObjectNode.d.ts.map +1 -1
  25. package/dist/node/OperatorNode.d.ts +29 -42
  26. package/dist/node/OperatorNode.d.ts.map +1 -1
  27. package/dist/node/ParenthesisNode.d.ts +27 -34
  28. package/dist/node/ParenthesisNode.d.ts.map +1 -1
  29. package/dist/node/RangeNode.d.ts +23 -30
  30. package/dist/node/RangeNode.d.ts.map +1 -1
  31. package/dist/node/RelationalNode.d.ts +25 -32
  32. package/dist/node/RelationalNode.d.ts.map +1 -1
  33. package/dist/node/SymbolNode.d.ts +26 -33
  34. package/dist/node/SymbolNode.d.ts.map +1 -1
  35. package/dist/node/utils/access.d.ts +7 -0
  36. package/dist/node/utils/access.d.ts.map +1 -1
  37. package/dist/node/utils/assign.d.ts +8 -0
  38. package/dist/node/utils/assign.d.ts.map +1 -1
  39. package/dist/node/utils/stringSubset.d.ts +8 -8
  40. package/dist/operators.d.ts +12 -15
  41. package/dist/operators.d.ts.map +1 -1
  42. package/dist/parse.d.ts.map +1 -1
  43. package/dist/transform/utils/dimToZeroBase.d.ts +4 -0
  44. package/dist/transform/utils/dimToZeroBase.d.ts.map +1 -1
  45. package/dist/types.d.ts +8 -0
  46. package/dist/types.d.ts.map +1 -1
  47. package/dist/utils/is.d.ts +273 -3
  48. package/dist/utils/is.d.ts.map +1 -1
  49. package/dist/utils/latex.d.ts +12 -0
  50. package/dist/utils/latex.d.ts.map +1 -1
  51. package/package.json +59 -59
@@ -460,31 +460,30 @@ export declare const createFunctionNode: import("../utils/factory.js").FactoryFu
460
460
  * Compile a node into a JavaScript function.
461
461
  * This basically pre-calculates as much as possible and only leaves open
462
462
  * calculations which depend on a dynamic scope with variables.
463
- * @param {Object} math Math.js namespace with functions and constants.
464
- * @param {Object} argNames An object with argument names as key and `true`
463
+ * @param math - Math.js namespace with functions and constants.
464
+ * @param argNames - An object with argument names as key and `true`
465
465
  * as value. Used in the SymbolNode to optimize
466
466
  * for arguments from user assigned functions
467
467
  * (see FunctionAssignmentNode) or special symbols
468
468
  * like `end` (see IndexNode).
469
- * @return {function} Returns a function which can be called like:
469
+ * @returns Returns a function which can be called like:
470
470
  * evalNode(scope: Object, args: Object, context: *)
471
471
  */
472
472
  _compile(math: Record<string, unknown>, argNames: Record<string, boolean>): (scope: Map<string, unknown>, args: Record<string, unknown>, context: unknown) => unknown;
473
473
  /**
474
474
  * Execute a callback for each of the child nodes of this node
475
- * @param {function(child: Node, path: string, parent: Node)} callback
475
+ * @param callback
476
476
  */
477
477
  forEach(callback: (child: MathNode, path: string, parent: MathNode) => void): void;
478
478
  /**
479
479
  * Create a new FunctionNode whose children are the results of calling
480
480
  * the provided callback function for each child of the original node.
481
- * @param {function(child: Node, path: string, parent: Node): Node} callback
482
- * @returns {FunctionNode} Returns a transformed copy of the node
481
+ * @param callback
482
+ * @returns Returns a transformed copy of the node
483
483
  */
484
484
  map(callback: (child: MathNode, path: string, parent: MathNode) => MathNode): /*elided*/ any;
485
485
  /**
486
486
  * Create a clone of this node, a shallow copy
487
- * @return {FunctionNode}
488
487
  */
489
488
  clone(): /*elided*/ any;
490
489
  /**
@@ -495,20 +494,19 @@ export declare const createFunctionNode: import("../utils/factory.js").FactoryFu
495
494
  * otherwise it falls back to calling Node's toString
496
495
  * function.
497
496
  *
498
- * @param {Object} options
499
- * @return {string} str
497
+ * @param options
498
+ * @returns str
500
499
  * @override
501
500
  */
502
501
  toString(options?: StringOptions): string;
503
502
  /**
504
503
  * Get string representation
505
- * @param {Object} options
506
- * @return {string} str
504
+ * @param options
505
+ * @returns str
507
506
  */
508
507
  _toString(options?: StringOptions): string;
509
508
  /**
510
509
  * Get a JSON representation of the node
511
- * @returns {Object}
512
510
  */
513
511
  toJSON(): {
514
512
  mathjs: string;
@@ -517,8 +515,8 @@ export declare const createFunctionNode: import("../utils/factory.js").FactoryFu
517
515
  };
518
516
  /**
519
517
  * Get HTML representation
520
- * @param {Object} options
521
- * @return {string} str
518
+ * @param options
519
+ * @returns str
522
520
  */
523
521
  _toHTML(options?: StringOptions): string;
524
522
  /**
@@ -529,20 +527,17 @@ export declare const createFunctionNode: import("../utils/factory.js").FactoryFu
529
527
  * otherwise it falls back to calling Node's toTex
530
528
  * function.
531
529
  *
532
- * @param {Object} options
533
- * @return {string}
530
+ * @param options
534
531
  */
535
532
  toTex(options?: StringOptions): string;
536
533
  /**
537
- * Get LaTeX representation
538
- * @param {Object} options
539
- * @return {string} str
534
+ * Get the MathML representation of this node.
535
+ * @returns str
540
536
  */
541
537
  _toMathML(): string;
542
538
  _toTex(options?: StringOptions): string;
543
539
  /**
544
540
  * Get identifier.
545
- * @return {string}
546
541
  */
547
542
  getIdentifier(): string;
548
543
  get isNode(): boolean;
@@ -552,15 +547,14 @@ export declare const createFunctionNode: import("../utils/factory.js").FactoryFu
552
547
  name: string;
553
548
  /**
554
549
  * Throws an error 'Undefined function {name}'
555
- * @param {string} name
550
+ * @param name
556
551
  */
557
552
  onUndefinedFunction: (name: string) => never;
558
553
  /**
559
554
  * Instantiate an AssignmentNode from its JSON representation
560
- * @param {Object} json An object structured like
555
+ * @param json - An object structured like
561
556
  * `{"mathjs": "FunctionNode", fn: ..., args: ...}`,
562
557
  * where mathjs is optional
563
- * @returns {FunctionNode}
564
558
  */
565
559
  fromJSON: (json: {
566
560
  fn: MathNode;
@@ -1021,31 +1015,30 @@ export declare const createFunctionNode: import("../utils/factory.js").FactoryFu
1021
1015
  * Compile a node into a JavaScript function.
1022
1016
  * This basically pre-calculates as much as possible and only leaves open
1023
1017
  * calculations which depend on a dynamic scope with variables.
1024
- * @param {Object} math Math.js namespace with functions and constants.
1025
- * @param {Object} argNames An object with argument names as key and `true`
1018
+ * @param math - Math.js namespace with functions and constants.
1019
+ * @param argNames - An object with argument names as key and `true`
1026
1020
  * as value. Used in the SymbolNode to optimize
1027
1021
  * for arguments from user assigned functions
1028
1022
  * (see FunctionAssignmentNode) or special symbols
1029
1023
  * like `end` (see IndexNode).
1030
- * @return {function} Returns a function which can be called like:
1024
+ * @returns Returns a function which can be called like:
1031
1025
  * evalNode(scope: Object, args: Object, context: *)
1032
1026
  */
1033
1027
  _compile(math: Record<string, unknown>, argNames: Record<string, boolean>): (scope: Map<string, unknown>, args: Record<string, unknown>, context: unknown) => unknown;
1034
1028
  /**
1035
1029
  * Execute a callback for each of the child nodes of this node
1036
- * @param {function(child: Node, path: string, parent: Node)} callback
1030
+ * @param callback
1037
1031
  */
1038
1032
  forEach(callback: (child: MathNode, path: string, parent: MathNode) => void): void;
1039
1033
  /**
1040
1034
  * Create a new FunctionNode whose children are the results of calling
1041
1035
  * the provided callback function for each child of the original node.
1042
- * @param {function(child: Node, path: string, parent: Node): Node} callback
1043
- * @returns {FunctionNode} Returns a transformed copy of the node
1036
+ * @param callback
1037
+ * @returns Returns a transformed copy of the node
1044
1038
  */
1045
1039
  map(callback: (child: MathNode, path: string, parent: MathNode) => MathNode): /*elided*/ any;
1046
1040
  /**
1047
1041
  * Create a clone of this node, a shallow copy
1048
- * @return {FunctionNode}
1049
1042
  */
1050
1043
  clone(): /*elided*/ any;
1051
1044
  /**
@@ -1056,20 +1049,19 @@ export declare const createFunctionNode: import("../utils/factory.js").FactoryFu
1056
1049
  * otherwise it falls back to calling Node's toString
1057
1050
  * function.
1058
1051
  *
1059
- * @param {Object} options
1060
- * @return {string} str
1052
+ * @param options
1053
+ * @returns str
1061
1054
  * @override
1062
1055
  */
1063
1056
  toString(options?: StringOptions): string;
1064
1057
  /**
1065
1058
  * Get string representation
1066
- * @param {Object} options
1067
- * @return {string} str
1059
+ * @param options
1060
+ * @returns str
1068
1061
  */
1069
1062
  _toString(options?: StringOptions): string;
1070
1063
  /**
1071
1064
  * Get a JSON representation of the node
1072
- * @returns {Object}
1073
1065
  */
1074
1066
  toJSON(): {
1075
1067
  mathjs: string;
@@ -1078,8 +1070,8 @@ export declare const createFunctionNode: import("../utils/factory.js").FactoryFu
1078
1070
  };
1079
1071
  /**
1080
1072
  * Get HTML representation
1081
- * @param {Object} options
1082
- * @return {string} str
1073
+ * @param options
1074
+ * @returns str
1083
1075
  */
1084
1076
  _toHTML(options?: StringOptions): string;
1085
1077
  /**
@@ -1090,20 +1082,17 @@ export declare const createFunctionNode: import("../utils/factory.js").FactoryFu
1090
1082
  * otherwise it falls back to calling Node's toTex
1091
1083
  * function.
1092
1084
  *
1093
- * @param {Object} options
1094
- * @return {string}
1085
+ * @param options
1095
1086
  */
1096
1087
  toTex(options?: StringOptions): string;
1097
1088
  /**
1098
- * Get LaTeX representation
1099
- * @param {Object} options
1100
- * @return {string} str
1089
+ * Get the MathML representation of this node.
1090
+ * @returns str
1101
1091
  */
1102
1092
  _toMathML(): string;
1103
1093
  _toTex(options?: StringOptions): string;
1104
1094
  /**
1105
1095
  * Get identifier.
1106
- * @return {string}
1107
1096
  */
1108
1097
  getIdentifier(): string;
1109
1098
  get isNode(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"FunctionNode.d.ts","sourceRoot":"","sources":["../../src/node/FunctionNode.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAKzD,eAAO,MAAM,kBAAkB;UAQrB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;UACvB,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,QAAQ;gBAC9B,KAAK,IAAI,EAAE,MAAM,KAAK,QAAQ;;aAmIxB,QAAQ,GAAG,MAAM,QAAQ,QAAQ,EAAE,aAAa,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAbnE,QAAQ;cACN,QAAQ,EAAE;kBACN,OAAO;oBAiCL,MAAM;oBAIN,MAAM;8BAGI,OAAO;QAI7B;;;;;;;;;;;;WAYG;uBACY,MAAM,CAAC,MAAM,EAAE,OAAO,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA5WhE,QAAQ;cACN,QAAQ,EAAE;kBACN,OAAO;oBAiCL,MAAM;oBAIN,MAAM;8BAGI,OAAO;QAI7B;;;;;;;;;;;;WAYG;uBACY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WA9KlE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,QACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WACpB,OAAO,KACb,OAAO;QA+WV;;;WAGG;0BACe,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,KAAK,IAAI,GAAG,IAAI;QAQlF;;;;;WAKG;sBACW,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,KAAK,QAAQ;QAS3E;;WAEG;;QAaH;;;;;;;;;;;WAWG;2BACgB,aAAa,GAAG,MAAM;QAoBzC;;;;WAIG;4BACiB,aAAa,GAAG,MAAM;QAa1C;;WAEG;kBACO;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,QAAQ,CAAC;YAAC,IAAI,EAAE,QAAQ,EAAE,CAAA;SAAE;QAkB5D;;;;WAIG;0BACe,aAAa,GAAG,MAAM;QAexC;;;;;;;;;WASG;wBACa,aAAa,GAAG,MAAM;QAmBtC;;;WAGG;qBACU,MAAM;yBAkBF,aAAa,GAAG,MAAM;QAuDvC;;WAEG;yBACc,MAAM;;;;;EAQ5B,CAAC"}
@@ -27,65 +27,61 @@ export declare const createIndexNode: import("../utils/factory.js").FactoryFunct
27
27
  * Compile a node into a JavaScript function.
28
28
  * This basically pre-calculates as much as possible and only leaves open
29
29
  * calculations which depend on a dynamic scope with variables.
30
- * @param {Object} math Math.js namespace with functions and constants.
31
- * @param {Object} argNames An object with argument names as key and `true`
30
+ * @param math - Math.js namespace with functions and constants.
31
+ * @param argNames - An object with argument names as key and `true`
32
32
  * as value. Used in the SymbolNode to optimize
33
33
  * for arguments from user assigned functions
34
34
  * (see FunctionAssignmentNode) or special symbols
35
35
  * like `end` (see IndexNode).
36
- * @return {function} Returns a function which can be called like:
36
+ * @returns Returns a function which can be called like:
37
37
  * evalNode(scope: Object, args: Object, context: *)
38
38
  */
39
39
  _compile(math: Record<string, unknown>, argNames: Record<string, boolean>): CompileFunction;
40
40
  /**
41
41
  * Execute a callback for each of the child nodes of this node
42
- * @param {function(child: Node, path: string, parent: Node)} callback
42
+ * @param callback
43
43
  */
44
44
  forEach(callback: (child: Node, path: string, parent: /*elided*/ any) => void): void;
45
45
  /**
46
46
  * Create a new IndexNode whose children are the results of calling
47
47
  * the provided callback function for each child of the original node.
48
- * @param {function(child: Node, path: string, parent: Node): Node} callback
49
- * @returns {IndexNode} Returns a transformed copy of the node
48
+ * @param callback
49
+ * @returns Returns a transformed copy of the node
50
50
  */
51
51
  map(callback: (child: Node, path: string, parent: /*elided*/ any) => Node): /*elided*/ any;
52
52
  /**
53
53
  * Create a clone of this node, a shallow copy
54
- * @return {IndexNode}
55
54
  */
56
55
  clone(): /*elided*/ any;
57
56
  /**
58
57
  * Test whether this IndexNode contains a single property name
59
- * @return {boolean}
60
58
  */
61
59
  isObjectProperty(): boolean;
62
60
  /**
63
61
  * Returns the property name if IndexNode contains a property.
64
62
  * If not, returns null.
65
- * @return {string | null}
66
63
  */
67
64
  getObjectProperty(): string | null;
68
65
  /**
69
66
  * Get string representation
70
- * @param {Object} options
71
- * @return {string} str
67
+ * @param _options
68
+ * @returns str
72
69
  */
73
70
  _toString(_options?: StringOptions): string;
74
71
  /**
75
72
  * Get a JSON representation of the node
76
- * @returns {Object}
77
73
  */
78
74
  toJSON(): Record<string, unknown>;
79
75
  /**
80
76
  * Get HTML representation
81
- * @param {Object} options
82
- * @return {string} str
77
+ * @param _options
78
+ * @returns str
83
79
  */
84
80
  _toHTML(_options?: StringOptions): string;
85
81
  /**
86
82
  * Get LaTeX representation
87
- * @param {Object} options
88
- * @return {string} str
83
+ * @param options
84
+ * @returns str
89
85
  */
90
86
  _toTex(options?: StringOptions): string;
91
87
  _ifNode: (node: unknown) => Node;
@@ -100,11 +96,10 @@ export declare const createIndexNode: import("../utils/factory.js").FactoryFunct
100
96
  name: string;
101
97
  /**
102
98
  * Instantiate an IndexNode from its JSON representation
103
- * @param {Object} json
99
+ * @param json
104
100
  * An object structured like
105
101
  * `{"mathjs": "IndexNode", dimensions: [...], dotNotation: false}`,
106
102
  * where mathjs is optional
107
- * @returns {IndexNode}
108
103
  */
109
104
  fromJSON(json: {
110
105
  dimensions: Node[];
@@ -118,65 +113,61 @@ export declare const createIndexNode: import("../utils/factory.js").FactoryFunct
118
113
  * Compile a node into a JavaScript function.
119
114
  * This basically pre-calculates as much as possible and only leaves open
120
115
  * calculations which depend on a dynamic scope with variables.
121
- * @param {Object} math Math.js namespace with functions and constants.
122
- * @param {Object} argNames An object with argument names as key and `true`
116
+ * @param math - Math.js namespace with functions and constants.
117
+ * @param argNames - An object with argument names as key and `true`
123
118
  * as value. Used in the SymbolNode to optimize
124
119
  * for arguments from user assigned functions
125
120
  * (see FunctionAssignmentNode) or special symbols
126
121
  * like `end` (see IndexNode).
127
- * @return {function} Returns a function which can be called like:
122
+ * @returns Returns a function which can be called like:
128
123
  * evalNode(scope: Object, args: Object, context: *)
129
124
  */
130
125
  _compile(math: Record<string, unknown>, argNames: Record<string, boolean>): CompileFunction;
131
126
  /**
132
127
  * Execute a callback for each of the child nodes of this node
133
- * @param {function(child: Node, path: string, parent: Node)} callback
128
+ * @param callback
134
129
  */
135
130
  forEach(callback: (child: Node, path: string, parent: /*elided*/ any) => void): void;
136
131
  /**
137
132
  * Create a new IndexNode whose children are the results of calling
138
133
  * the provided callback function for each child of the original node.
139
- * @param {function(child: Node, path: string, parent: Node): Node} callback
140
- * @returns {IndexNode} Returns a transformed copy of the node
134
+ * @param callback
135
+ * @returns Returns a transformed copy of the node
141
136
  */
142
137
  map(callback: (child: Node, path: string, parent: /*elided*/ any) => Node): /*elided*/ any;
143
138
  /**
144
139
  * Create a clone of this node, a shallow copy
145
- * @return {IndexNode}
146
140
  */
147
141
  clone(): /*elided*/ any;
148
142
  /**
149
143
  * Test whether this IndexNode contains a single property name
150
- * @return {boolean}
151
144
  */
152
145
  isObjectProperty(): boolean;
153
146
  /**
154
147
  * Returns the property name if IndexNode contains a property.
155
148
  * If not, returns null.
156
- * @return {string | null}
157
149
  */
158
150
  getObjectProperty(): string | null;
159
151
  /**
160
152
  * Get string representation
161
- * @param {Object} options
162
- * @return {string} str
153
+ * @param _options
154
+ * @returns str
163
155
  */
164
156
  _toString(_options?: StringOptions): string;
165
157
  /**
166
158
  * Get a JSON representation of the node
167
- * @returns {Object}
168
159
  */
169
160
  toJSON(): Record<string, unknown>;
170
161
  /**
171
162
  * Get HTML representation
172
- * @param {Object} options
173
- * @return {string} str
163
+ * @param _options
164
+ * @returns str
174
165
  */
175
166
  _toHTML(_options?: StringOptions): string;
176
167
  /**
177
168
  * Get LaTeX representation
178
- * @param {Object} options
179
- * @return {string} str
169
+ * @param options
170
+ * @returns str
180
171
  */
181
172
  _toTex(options?: StringOptions): string;
182
173
  _ifNode: (node: unknown) => Node;
@@ -1 +1 @@
1
- {"version":3,"file":"IndexNode.d.ts","sourceRoot":"","sources":["../../src/node/IndexNode.ts"],"names":[],"mappings":"AAOA,UAAU,IAAI;IACZ,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,eAAe,CAAC;IAChG,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,KAAK,IAAI,EAAE,CA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type Scope = Map<string, unknown>;
2
+ /**
3
+ * The object that `Node.compile` returns.
4
+ * Call `evaluate` to get the value of the compiled node.
5
+ */
2
6
  export interface CompiledExpression {
3
7
  evaluate: (scope?: Record<string, unknown>) => unknown;
4
8
  }
5
9
  type CompileFunction = (scope: Scope, args: Record<string, unknown>, context: unknown) => unknown;
10
+ /**
11
+ * Options for `toString`, `toTex` and `toHTML` of a node.
12
+ * `handler` is a custom function, or a map from node type to a custom function.
13
+ * `parenthesis` sets the parenthesis rule. `implicit` sets how implicit multiplication shows.
14
+ * The index signature allows other keys.
15
+ */
6
16
  export interface StringOptions {
7
17
  handler?: ((node: MathNode, options?: StringOptions) => string) | Record<string, (node: MathNode, options?: StringOptions) => string>;
8
18
  parenthesis?: 'keep' | 'auto' | 'all';
@@ -18,13 +28,13 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
18
28
  get isNode(): boolean;
19
29
  /**
20
30
  * Evaluate the node
21
- * @param {Object} [scope] Scope to read/write variables
22
- * @return {*} Returns the result
31
+ * @param scope - Optional. Scope to read/write variables
32
+ * @returns Returns the result
23
33
  */
24
34
  evaluate(scope?: Record<string, unknown>): unknown;
25
35
  /**
26
36
  * Compile the node into an optimized, evauatable JavaScript function
27
- * @return {{evaluate: function([Object])}} object
37
+ * @returns object
28
38
  * Returns an object with a function 'evaluate',
29
39
  * which can be invoked as expr.evaluate([scope: Object]),
30
40
  * where scope is an optional object with
@@ -35,39 +45,39 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
35
45
  * Compile a node into a JavaScript function.
36
46
  * This basically pre-calculates as much as possible and only leaves open
37
47
  * calculations which depend on a dynamic scope with variables.
38
- * @param {Object} math Math.js namespace with functions and constants.
39
- * @param {Object} argNames An object with argument names as key and `true`
48
+ * @param _math - Math.js namespace with functions and constants.
49
+ * @param _argNames - An object with argument names as key and `true`
40
50
  * as value. Used in the SymbolNode to optimize
41
51
  * for arguments from user assigned functions
42
52
  * (see FunctionAssignmentNode) or special symbols
43
53
  * like `end` (see IndexNode).
44
- * @return {function} Returns a function which can be called like:
54
+ * @returns Returns a function which can be called like:
45
55
  * evalNode(scope: Object, args: Object, context: *)
46
56
  */
47
57
  _compile(_math: Record<string, unknown>, _argNames: Record<string, boolean>): CompileFunction;
48
58
  /**
49
59
  * Execute a callback for each of the child nodes of this node
50
- * @param {function(child: Node, path: string, parent: Node)} callback
60
+ * @param _callback
51
61
  */
52
62
  forEach(_callback: (child: /*elided*/ any, path: string, parent: /*elided*/ any) => void): void;
53
63
  /**
54
64
  * Create a new Node whose children are the results of calling the
55
65
  * provided callback function for each child of the original node.
56
- * @param {function(child: Node, path: string, parent: Node): Node} callback
57
- * @returns {OperatorNode} Returns a transformed copy of the node
66
+ * @param _callback
67
+ * @returns Returns a transformed copy of the node
58
68
  */
59
69
  map(_callback: (child: /*elided*/ any, path: string, parent: /*elided*/ any) => /*elided*/ any): /*elided*/ any;
60
70
  /**
61
71
  * Validate whether an object is a Node, for use with map
62
- * @param {Node} node
63
- * @returns {Node} Returns the input if it's a node, else throws an Error
72
+ * @param node
73
+ * @returns Returns the input if it's a node, else throws an Error
64
74
  * @protected
65
75
  */
66
76
  _ifNode(node: unknown): /*elided*/ any;
67
77
  /**
68
78
  * Recursively traverse all nodes in a node tree. Executes given callback for
69
79
  * this node and each of its child nodes.
70
- * @param {function(node: Node, path: string, parent: Node)} callback
80
+ * @param callback
71
81
  * A callback called for every node in the node tree.
72
82
  */
73
83
  traverse(callback: (node: /*elided*/ any, path: string | null, parent: /*elided*/ any | null) => void): void;
@@ -86,12 +96,12 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
86
96
  * }
87
97
  * })
88
98
  *
89
- * @param {function(node: Node, path: string, parent: Node) : Node} callback
99
+ * @param callback
90
100
  * A mapping function accepting a node, and returning
91
101
  * a replacement for the node or the original node. The "signature"
92
102
  * of the callback must be:
93
103
  * callback(node: Node, index: string, parent: Node) : Node
94
- * @return {Node} Returns the original node or its replacement
104
+ * @returns Returns the original node or its replacement
95
105
  */
96
106
  transform(callback: (node: /*elided*/ any, path: string | null, parent: /*elided*/ any | null) => /*elided*/ any): /*elided*/ any;
97
107
  /**
@@ -102,28 +112,26 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
102
112
  * return (node && node.isSymbolNode) && (node.name === 'x')
103
113
  * })
104
114
  *
105
- * @param {function(node: Node, path: string, parent: Node) : Node} callback
115
+ * @param callback
106
116
  * A test function returning true when a node matches, and false
107
117
  * otherwise. Function signature:
108
118
  * callback(node: Node, index: string, parent: Node) : boolean
109
- * @return {Node[]} nodes
119
+ * @returns nodes
110
120
  * An array with nodes matching given filter criteria
111
121
  */
112
122
  filter(callback: (node: /*elided*/ any, path: string | null, parent: /*elided*/ any | null) => boolean): /*elided*/ any[];
113
123
  /**
114
124
  * Create a shallow clone of this node
115
- * @return {Node}
116
125
  */
117
126
  clone(): /*elided*/ any;
118
127
  /**
119
128
  * Create a deep clone of this node
120
- * @return {Node}
121
129
  */
122
130
  cloneDeep(): /*elided*/ any;
123
131
  /**
124
132
  * Deep compare this node with another node.
125
- * @param {Node} other
126
- * @return {boolean} Returns true when both nodes are of the same type and
133
+ * @param other
134
+ * @returns Returns true when both nodes are of the same type and
127
135
  * contain the same values (as do their childs)
128
136
  */
129
137
  equals(other: /*elided*/ any | null | undefined): boolean;
@@ -139,22 +147,20 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
139
147
  * parenthesis: "keep" //the parenthesis option (This is optional)
140
148
  * }
141
149
  *
142
- * @param {Object} [options]
143
- * @return {string}
150
+ * @param options - Optional.
144
151
  */
145
152
  toString(options?: StringOptions): string;
146
153
  /**
147
154
  * Internal function to generate the string output.
148
155
  * This has to be implemented by every Node
149
156
  *
150
- * @throws {Error}
157
+ * @throws Error
151
158
  */
152
159
  _toString(_options?: StringOptions): string;
153
160
  /**
154
161
  * Get a JSON representation of the node
155
162
  * Both .toJSON() and the static .fromJSON(json) should be implemented by all
156
163
  * implementations of Node
157
- * @returns {Object}
158
164
  */
159
165
  toJSON(): Record<string, unknown>;
160
166
  /**
@@ -169,15 +175,14 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
169
175
  * parenthesis: "keep" //the parenthesis option (This is optional)
170
176
  * }
171
177
  *
172
- * @param {Object} [options]
173
- * @return {string}
178
+ * @param options - Optional.
174
179
  */
175
180
  toHTML(options?: StringOptions): string;
176
181
  /**
177
182
  * Internal function to generate the HTML output.
178
183
  * This has to be implemented by every Node
179
184
  *
180
- * @throws {Error}
185
+ * @throws Error
181
186
  */
182
187
  _toHTML(_options?: StringOptions): string;
183
188
  /**
@@ -192,16 +197,14 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
192
197
  * parenthesis: "keep" //the parenthesis option (This is optional)
193
198
  * }
194
199
  *
195
- * @param {Object} [options]
196
- * @return {string}
200
+ * @param options - Optional.
197
201
  */
198
202
  toTex(options?: StringOptions): string;
199
203
  /**
200
204
  * Render this node as Markdown-embeddable math. Display (block) math by
201
205
  * default (`$$…$$`), inline (`$…$`) when `options.inline` is true. Thin
202
206
  * wrapper over toTex(); adds no failure mode beyond toTex's own.
203
- * @param {Object} [options]
204
- * @return {string}
207
+ * @param options - Optional.
205
208
  */
206
209
  toMarkdown(options?: {
207
210
  inline?: boolean;
@@ -210,8 +213,7 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
210
213
  * Render the AST subtree rooted at this node as a Graphviz digraph: one
211
214
  * DOT node per AST node (label = node type + a value for leaves), with
212
215
  * parent→child edges. Never throws.
213
- * @param {Object} [options]
214
- * @return {string}
216
+ * @param options - Optional.
215
217
  */
216
218
  toDOT(options?: {
217
219
  name?: string;
@@ -221,7 +223,6 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
221
223
  * Like `toTex`, this returns the body — wrap it in a `<math>` element with
222
224
  * `mathMLDocument(node)` to render. Never throws: a failing node degrades
223
225
  * to an escaped `<merror>` fragment.
224
- * @return {string}
225
226
  */
226
227
  toMathML(): string;
227
228
  /**
@@ -234,8 +235,8 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
234
235
  * Internal function to generate the LaTeX output.
235
236
  * This has to be implemented by every Node
236
237
  *
237
- * @param {Object} [options]
238
- * @throws {Error}
238
+ * @param _options - Optional.
239
+ * @throws Error
239
240
  */
240
241
  _toTex(_options?: StringOptions): string;
241
242
  /**
@@ -244,16 +245,18 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
244
245
  _getCustomString(options?: StringOptions): string | undefined;
245
246
  /**
246
247
  * Get identifier.
247
- * @return {string}
248
248
  */
249
249
  getIdentifier(): string;
250
250
  /**
251
251
  * Get the content of the current Node.
252
- * @return {Node} node
252
+ * @returns node
253
253
  **/
254
254
  getContent(): /*elided*/ any;
255
255
  };
256
256
  }>;
257
+ /**
258
+ * The instance type of the `Node` class that `createNode` makes.
259
+ */
257
260
  export type MathNode = InstanceType<ReturnType<typeof createNode>>;
258
261
  export {};
259
262
  //# sourceMappingURL=Node.d.ts.map