@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.
- package/README.md +42 -42
- package/dist/index.js +276 -347
- package/dist/node/AccessorNode.d.ts +121 -132
- package/dist/node/AccessorNode.d.ts.map +1 -1
- package/dist/node/ArrayNode.d.ts +25 -30
- package/dist/node/ArrayNode.d.ts.map +1 -1
- package/dist/node/AssignmentNode.d.ts +19 -32
- package/dist/node/AssignmentNode.d.ts.map +1 -1
- package/dist/node/BlockNode.d.ts +121 -126
- package/dist/node/BlockNode.d.ts.map +1 -1
- package/dist/node/ConditionalNode.d.ts +25 -30
- package/dist/node/ConditionalNode.d.ts.map +1 -1
- package/dist/node/ConstantNode.d.ts +93 -100
- package/dist/node/ConstantNode.d.ts.map +1 -1
- package/dist/node/FunctionAssignmentNode.d.ts +93 -98
- package/dist/node/FunctionAssignmentNode.d.ts.map +1 -1
- package/dist/node/FunctionNode.d.ts +32 -43
- package/dist/node/FunctionNode.d.ts.map +1 -1
- package/dist/node/IndexNode.d.ts +949 -72
- package/dist/node/IndexNode.d.ts.map +1 -1
- package/dist/node/Node.d.ts +43 -39
- package/dist/node/Node.d.ts.map +1 -1
- package/dist/node/ObjectNode.d.ts +947 -56
- package/dist/node/ObjectNode.d.ts.map +1 -1
- package/dist/node/OperatorNode.d.ts +955 -79
- package/dist/node/OperatorNode.d.ts.map +1 -1
- package/dist/node/ParenthesisNode.d.ts +881 -63
- package/dist/node/ParenthesisNode.d.ts.map +1 -1
- package/dist/node/RangeNode.d.ts +955 -71
- package/dist/node/RangeNode.d.ts.map +1 -1
- package/dist/node/RelationalNode.d.ts +947 -61
- package/dist/node/RelationalNode.d.ts.map +1 -1
- package/dist/node/SymbolNode.d.ts +942 -43
- package/dist/node/SymbolNode.d.ts.map +1 -1
- package/dist/node/utils/access.d.ts +8 -1
- package/dist/node/utils/access.d.ts.map +1 -1
- package/dist/node/utils/assign.d.ts +9 -1
- package/dist/node/utils/assign.d.ts.map +1 -1
- package/dist/node/utils/stringSubset.d.ts +8 -8
- package/dist/operators.d.ts +12 -15
- package/dist/operators.d.ts.map +1 -1
- package/dist/parse.d.ts +2 -0
- package/dist/parse.d.ts.map +1 -1
- package/dist/transform/utils/dimToZeroBase.d.ts +4 -0
- package/dist/transform/utils/dimToZeroBase.d.ts.map +1 -1
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/is.d.ts +275 -3
- package/dist/utils/is.d.ts.map +1 -1
- package/dist/utils/latex.d.ts +12 -0
- package/dist/utils/latex.d.ts.map +1 -1
- 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
|
|
464
|
-
* @param
|
|
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
|
-
* @
|
|
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
|
|
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
|
|
482
|
-
* @returns
|
|
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
|
|
499
|
-
* @
|
|
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
|
|
506
|
-
* @
|
|
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
|
|
521
|
-
* @
|
|
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
|
|
533
|
-
* @return {string}
|
|
530
|
+
* @param options
|
|
534
531
|
*/
|
|
535
532
|
toTex(options?: StringOptions): string;
|
|
536
533
|
/**
|
|
537
|
-
* Get
|
|
538
|
-
* @
|
|
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
|
|
550
|
+
* @param name
|
|
556
551
|
*/
|
|
557
552
|
onUndefinedFunction: (name: string) => never;
|
|
558
553
|
/**
|
|
559
554
|
* Instantiate an AssignmentNode from its JSON representation
|
|
560
|
-
* @param
|
|
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
|
|
1025
|
-
* @param
|
|
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
|
-
* @
|
|
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
|
|
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
|
|
1043
|
-
* @returns
|
|
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
|
|
1060
|
-
* @
|
|
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
|
|
1067
|
-
* @
|
|
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
|
|
1082
|
-
* @
|
|
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
|
|
1094
|
-
* @return {string}
|
|
1085
|
+
* @param options
|
|
1095
1086
|
*/
|
|
1096
1087
|
toTex(options?: StringOptions): string;
|
|
1097
1088
|
/**
|
|
1098
|
-
* Get
|
|
1099
|
-
* @
|
|
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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