@danielsimonjr/mathts-expression 0.8.0 → 0.8.2

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 (52) hide show
  1. package/README.md +42 -42
  2. package/dist/index.js +276 -347
  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 +93 -98
  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 +949 -72
  20. package/dist/node/IndexNode.d.ts.map +1 -1
  21. package/dist/node/Node.d.ts +43 -39
  22. package/dist/node/Node.d.ts.map +1 -1
  23. package/dist/node/ObjectNode.d.ts +947 -56
  24. package/dist/node/ObjectNode.d.ts.map +1 -1
  25. package/dist/node/OperatorNode.d.ts +955 -79
  26. package/dist/node/OperatorNode.d.ts.map +1 -1
  27. package/dist/node/ParenthesisNode.d.ts +881 -63
  28. package/dist/node/ParenthesisNode.d.ts.map +1 -1
  29. package/dist/node/RangeNode.d.ts +955 -71
  30. package/dist/node/RangeNode.d.ts.map +1 -1
  31. package/dist/node/RelationalNode.d.ts +947 -61
  32. package/dist/node/RelationalNode.d.ts.map +1 -1
  33. package/dist/node/SymbolNode.d.ts +942 -43
  34. package/dist/node/SymbolNode.d.ts.map +1 -1
  35. package/dist/node/utils/access.d.ts +8 -1
  36. package/dist/node/utils/access.d.ts.map +1 -1
  37. package/dist/node/utils/assign.d.ts +9 -1
  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 +2 -0
  43. package/dist/parse.d.ts.map +1 -1
  44. package/dist/transform/utils/dimToZeroBase.d.ts +4 -0
  45. package/dist/transform/utils/dimToZeroBase.d.ts.map +1 -1
  46. package/dist/types.d.ts +8 -0
  47. package/dist/types.d.ts.map +1 -1
  48. package/dist/utils/is.d.ts +275 -3
  49. package/dist/utils/is.d.ts.map +1 -1
  50. package/dist/utils/latex.d.ts +12 -0
  51. package/dist/utils/latex.d.ts.map +1 -1
  52. package/package.json +59 -59
@@ -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,CAAC;IACtD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,aAAa,KAAK,MAAM,CAAC;IAC5C,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,aAAa,KAAK,MAAM,CAAC;IAC3C,QAAQ,EAAE,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAzM1D,QAAQ,EAAE;qBACT,OAAO;oBA8BR,MAAM;2BAGC,OAAO;QAI1B;;;;;;;;;;;;WAYG;uBACY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,eAAe;QAmE3F;;;WAGG;0BACe,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,gBAAW,KAAK,IAAI,GAAG,IAAI;QAMnF;;;;;WAKG;sBACW,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,gBAAW,KAAK,QAAQ;QAS5E;;WAEG;;QAKH;;WAEG;4BACiB,OAAO;QAQ3B;;;WAGG;6BACkB,MAAM,GAAG,IAAI;QAMlC;;;;WAIG;6BACkB,aAAa,GAAG,MAAM;QAO3C;;WAEG;kBACO;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,QAAQ,EAAE,CAAC;YAAC,WAAW,EAAE,OAAO,CAAA;SAAE;QAmB1E;;;;WAIG;2BACgB,aAAa,GAAG,MAAM;QAsBzC;;;;WAIG;yBACc,aAAa,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc5C,CAAC"}
@@ -1,10 +1,21 @@
1
1
  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
+ * A handler that returns `undefined` falls back to the default output for that node.
14
+ * `parenthesis` sets the parenthesis rule. `implicit` sets how implicit multiplication shows.
15
+ * The index signature allows other keys.
16
+ */
6
17
  export interface StringOptions {
7
- handler?: ((node: MathNode, options?: StringOptions) => string) | Record<string, (node: MathNode, options?: StringOptions) => string>;
18
+ handler?: ((node: MathNode, options?: StringOptions) => string | undefined) | Record<string, (node: MathNode, options?: StringOptions) => string | undefined>;
8
19
  parenthesis?: 'keep' | 'auto' | 'all';
9
20
  implicit?: 'hide' | 'show';
10
21
  [key: string]: unknown;
@@ -18,13 +29,13 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
18
29
  get isNode(): boolean;
19
30
  /**
20
31
  * Evaluate the node
21
- * @param {Object} [scope] Scope to read/write variables
22
- * @return {*} Returns the result
32
+ * @param scope - Optional. Scope to read/write variables
33
+ * @returns Returns the result
23
34
  */
24
35
  evaluate(scope?: Record<string, unknown>): unknown;
25
36
  /**
26
37
  * Compile the node into an optimized, evauatable JavaScript function
27
- * @return {{evaluate: function([Object])}} object
38
+ * @returns object
28
39
  * Returns an object with a function 'evaluate',
29
40
  * which can be invoked as expr.evaluate([scope: Object]),
30
41
  * where scope is an optional object with
@@ -35,39 +46,39 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
35
46
  * Compile a node into a JavaScript function.
36
47
  * This basically pre-calculates as much as possible and only leaves open
37
48
  * 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`
49
+ * @param _math - Math.js namespace with functions and constants.
50
+ * @param _argNames - An object with argument names as key and `true`
40
51
  * as value. Used in the SymbolNode to optimize
41
52
  * for arguments from user assigned functions
42
53
  * (see FunctionAssignmentNode) or special symbols
43
54
  * like `end` (see IndexNode).
44
- * @return {function} Returns a function which can be called like:
55
+ * @returns Returns a function which can be called like:
45
56
  * evalNode(scope: Object, args: Object, context: *)
46
57
  */
47
58
  _compile(_math: Record<string, unknown>, _argNames: Record<string, boolean>): CompileFunction;
48
59
  /**
49
60
  * Execute a callback for each of the child nodes of this node
50
- * @param {function(child: Node, path: string, parent: Node)} callback
61
+ * @param _callback
51
62
  */
52
63
  forEach(_callback: (child: /*elided*/ any, path: string, parent: /*elided*/ any) => void): void;
53
64
  /**
54
65
  * Create a new Node whose children are the results of calling the
55
66
  * 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
67
+ * @param _callback
68
+ * @returns Returns a transformed copy of the node
58
69
  */
59
70
  map(_callback: (child: /*elided*/ any, path: string, parent: /*elided*/ any) => /*elided*/ any): /*elided*/ any;
60
71
  /**
61
72
  * 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
73
+ * @param node
74
+ * @returns Returns the input if it's a node, else throws an Error
64
75
  * @protected
65
76
  */
66
77
  _ifNode(node: unknown): /*elided*/ any;
67
78
  /**
68
79
  * Recursively traverse all nodes in a node tree. Executes given callback for
69
80
  * this node and each of its child nodes.
70
- * @param {function(node: Node, path: string, parent: Node)} callback
81
+ * @param callback
71
82
  * A callback called for every node in the node tree.
72
83
  */
73
84
  traverse(callback: (node: /*elided*/ any, path: string | null, parent: /*elided*/ any | null) => void): void;
@@ -86,12 +97,12 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
86
97
  * }
87
98
  * })
88
99
  *
89
- * @param {function(node: Node, path: string, parent: Node) : Node} callback
100
+ * @param callback
90
101
  * A mapping function accepting a node, and returning
91
102
  * a replacement for the node or the original node. The "signature"
92
103
  * of the callback must be:
93
104
  * callback(node: Node, index: string, parent: Node) : Node
94
- * @return {Node} Returns the original node or its replacement
105
+ * @returns Returns the original node or its replacement
95
106
  */
96
107
  transform(callback: (node: /*elided*/ any, path: string | null, parent: /*elided*/ any | null) => /*elided*/ any): /*elided*/ any;
97
108
  /**
@@ -102,28 +113,26 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
102
113
  * return (node && node.isSymbolNode) && (node.name === 'x')
103
114
  * })
104
115
  *
105
- * @param {function(node: Node, path: string, parent: Node) : Node} callback
116
+ * @param callback
106
117
  * A test function returning true when a node matches, and false
107
118
  * otherwise. Function signature:
108
119
  * callback(node: Node, index: string, parent: Node) : boolean
109
- * @return {Node[]} nodes
120
+ * @returns nodes
110
121
  * An array with nodes matching given filter criteria
111
122
  */
112
123
  filter(callback: (node: /*elided*/ any, path: string | null, parent: /*elided*/ any | null) => boolean): /*elided*/ any[];
113
124
  /**
114
125
  * Create a shallow clone of this node
115
- * @return {Node}
116
126
  */
117
127
  clone(): /*elided*/ any;
118
128
  /**
119
129
  * Create a deep clone of this node
120
- * @return {Node}
121
130
  */
122
131
  cloneDeep(): /*elided*/ any;
123
132
  /**
124
133
  * 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
134
+ * @param other
135
+ * @returns Returns true when both nodes are of the same type and
127
136
  * contain the same values (as do their childs)
128
137
  */
129
138
  equals(other: /*elided*/ any | null | undefined): boolean;
@@ -139,22 +148,20 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
139
148
  * parenthesis: "keep" //the parenthesis option (This is optional)
140
149
  * }
141
150
  *
142
- * @param {Object} [options]
143
- * @return {string}
151
+ * @param options - Optional.
144
152
  */
145
153
  toString(options?: StringOptions): string;
146
154
  /**
147
155
  * Internal function to generate the string output.
148
156
  * This has to be implemented by every Node
149
157
  *
150
- * @throws {Error}
158
+ * @throws Error
151
159
  */
152
160
  _toString(_options?: StringOptions): string;
153
161
  /**
154
162
  * Get a JSON representation of the node
155
163
  * Both .toJSON() and the static .fromJSON(json) should be implemented by all
156
164
  * implementations of Node
157
- * @returns {Object}
158
165
  */
159
166
  toJSON(): Record<string, unknown>;
160
167
  /**
@@ -169,15 +176,14 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
169
176
  * parenthesis: "keep" //the parenthesis option (This is optional)
170
177
  * }
171
178
  *
172
- * @param {Object} [options]
173
- * @return {string}
179
+ * @param options - Optional.
174
180
  */
175
181
  toHTML(options?: StringOptions): string;
176
182
  /**
177
183
  * Internal function to generate the HTML output.
178
184
  * This has to be implemented by every Node
179
185
  *
180
- * @throws {Error}
186
+ * @throws Error
181
187
  */
182
188
  _toHTML(_options?: StringOptions): string;
183
189
  /**
@@ -192,16 +198,14 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
192
198
  * parenthesis: "keep" //the parenthesis option (This is optional)
193
199
  * }
194
200
  *
195
- * @param {Object} [options]
196
- * @return {string}
201
+ * @param options - Optional.
197
202
  */
198
203
  toTex(options?: StringOptions): string;
199
204
  /**
200
205
  * Render this node as Markdown-embeddable math. Display (block) math by
201
206
  * default (`$$…$$`), inline (`$…$`) when `options.inline` is true. Thin
202
207
  * wrapper over toTex(); adds no failure mode beyond toTex's own.
203
- * @param {Object} [options]
204
- * @return {string}
208
+ * @param options - Optional.
205
209
  */
206
210
  toMarkdown(options?: {
207
211
  inline?: boolean;
@@ -210,8 +214,7 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
210
214
  * Render the AST subtree rooted at this node as a Graphviz digraph: one
211
215
  * DOT node per AST node (label = node type + a value for leaves), with
212
216
  * parent→child edges. Never throws.
213
- * @param {Object} [options]
214
- * @return {string}
217
+ * @param options - Optional.
215
218
  */
216
219
  toDOT(options?: {
217
220
  name?: string;
@@ -221,7 +224,6 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
221
224
  * Like `toTex`, this returns the body — wrap it in a `<math>` element with
222
225
  * `mathMLDocument(node)` to render. Never throws: a failing node degrades
223
226
  * to an escaped `<merror>` fragment.
224
- * @return {string}
225
227
  */
226
228
  toMathML(): string;
227
229
  /**
@@ -234,8 +236,8 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
234
236
  * Internal function to generate the LaTeX output.
235
237
  * This has to be implemented by every Node
236
238
  *
237
- * @param {Object} [options]
238
- * @throws {Error}
239
+ * @param _options - Optional.
240
+ * @throws Error
239
241
  */
240
242
  _toTex(_options?: StringOptions): string;
241
243
  /**
@@ -244,16 +246,18 @@ export declare const createNode: import("../utils/factory.js").FactoryFunction<D
244
246
  _getCustomString(options?: StringOptions): string | undefined;
245
247
  /**
246
248
  * Get identifier.
247
- * @return {string}
248
249
  */
249
250
  getIdentifier(): string;
250
251
  /**
251
252
  * Get the content of the current Node.
252
- * @return {Node} node
253
+ * @returns node
253
254
  **/
254
255
  getContent(): /*elided*/ any;
255
256
  };
256
257
  }>;
258
+ /**
259
+ * The instance type of the `Node` class that `createNode` makes.
260
+ */
257
261
  export type MathNode = InstanceType<ReturnType<typeof createNode>>;
258
262
  export {};
259
263
  //# sourceMappingURL=Node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Node.d.ts","sourceRoot":"","sources":["../../src/node/Node.ts"],"names":[],"mappings":"AAeA,KAAK,KAAK,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAElC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC;CACxD;AAED,KAAK,eAAe,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC;AAElG,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EACJ,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,MAAM,CAAC,GACrD,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,MAAM,CAAC,CAAC;IACxE,WAAW,CAAC,EAAE,MAAM,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