@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
package/dist/index.js CHANGED
@@ -7956,15 +7956,15 @@ var createNode = /* @__PURE__ */ factory(
7956
7956
  }
7957
7957
  /**
7958
7958
  * Evaluate the node
7959
- * @param {Object} [scope] Scope to read/write variables
7960
- * @return {*} Returns the result
7959
+ * @param scope - Optional. Scope to read/write variables
7960
+ * @returns Returns the result
7961
7961
  */
7962
7962
  evaluate(scope) {
7963
7963
  return this.compile().evaluate(scope);
7964
7964
  }
7965
7965
  /**
7966
7966
  * Compile the node into an optimized, evauatable JavaScript function
7967
- * @return {{evaluate: function([Object])}} object
7967
+ * @returns object
7968
7968
  * Returns an object with a function 'evaluate',
7969
7969
  * which can be invoked as expr.evaluate([scope: Object]),
7970
7970
  * where scope is an optional object with
@@ -7987,13 +7987,13 @@ var createNode = /* @__PURE__ */ factory(
7987
7987
  * Compile a node into a JavaScript function.
7988
7988
  * This basically pre-calculates as much as possible and only leaves open
7989
7989
  * calculations which depend on a dynamic scope with variables.
7990
- * @param {Object} math Math.js namespace with functions and constants.
7991
- * @param {Object} argNames An object with argument names as key and `true`
7990
+ * @param _math - Math.js namespace with functions and constants.
7991
+ * @param _argNames - An object with argument names as key and `true`
7992
7992
  * as value. Used in the SymbolNode to optimize
7993
7993
  * for arguments from user assigned functions
7994
7994
  * (see FunctionAssignmentNode) or special symbols
7995
7995
  * like `end` (see IndexNode).
7996
- * @return {function} Returns a function which can be called like:
7996
+ * @returns Returns a function which can be called like:
7997
7997
  * evalNode(scope: Object, args: Object, context: *)
7998
7998
  */
7999
7999
  _compile(_math, _argNames) {
@@ -8001,7 +8001,7 @@ var createNode = /* @__PURE__ */ factory(
8001
8001
  }
8002
8002
  /**
8003
8003
  * Execute a callback for each of the child nodes of this node
8004
- * @param {function(child: Node, path: string, parent: Node)} callback
8004
+ * @param _callback
8005
8005
  */
8006
8006
  forEach(_callback) {
8007
8007
  throw new Error("Cannot run forEach on a Node interface");
@@ -8009,16 +8009,16 @@ var createNode = /* @__PURE__ */ factory(
8009
8009
  /**
8010
8010
  * Create a new Node whose children are the results of calling the
8011
8011
  * provided callback function for each child of the original node.
8012
- * @param {function(child: Node, path: string, parent: Node): Node} callback
8013
- * @returns {OperatorNode} Returns a transformed copy of the node
8012
+ * @param _callback
8013
+ * @returns Returns a transformed copy of the node
8014
8014
  */
8015
8015
  map(_callback) {
8016
8016
  throw new Error("Cannot run map on a Node interface");
8017
8017
  }
8018
8018
  /**
8019
8019
  * Validate whether an object is a Node, for use with map
8020
- * @param {Node} node
8021
- * @returns {Node} Returns the input if it's a node, else throws an Error
8020
+ * @param node
8021
+ * @returns Returns the input if it's a node, else throws an Error
8022
8022
  * @protected
8023
8023
  */
8024
8024
  _ifNode(node) {
@@ -8030,7 +8030,7 @@ var createNode = /* @__PURE__ */ factory(
8030
8030
  /**
8031
8031
  * Recursively traverse all nodes in a node tree. Executes given callback for
8032
8032
  * this node and each of its child nodes.
8033
- * @param {function(node: Node, path: string, parent: Node)} callback
8033
+ * @param callback
8034
8034
  * A callback called for every node in the node tree.
8035
8035
  */
8036
8036
  traverse(callback) {
@@ -8058,12 +8058,12 @@ var createNode = /* @__PURE__ */ factory(
8058
8058
  * }
8059
8059
  * })
8060
8060
  *
8061
- * @param {function(node: Node, path: string, parent: Node) : Node} callback
8061
+ * @param callback
8062
8062
  * A mapping function accepting a node, and returning
8063
8063
  * a replacement for the node or the original node. The "signature"
8064
8064
  * of the callback must be:
8065
8065
  * callback(node: Node, index: string, parent: Node) : Node
8066
- * @return {Node} Returns the original node or its replacement
8066
+ * @returns Returns the original node or its replacement
8067
8067
  */
8068
8068
  transform(callback) {
8069
8069
  function _transform(child, path, parent) {
@@ -8083,11 +8083,11 @@ var createNode = /* @__PURE__ */ factory(
8083
8083
  * return (node && node.isSymbolNode) && (node.name === 'x')
8084
8084
  * })
8085
8085
  *
8086
- * @param {function(node: Node, path: string, parent: Node) : Node} callback
8086
+ * @param callback
8087
8087
  * A test function returning true when a node matches, and false
8088
8088
  * otherwise. Function signature:
8089
8089
  * callback(node: Node, index: string, parent: Node) : boolean
8090
- * @return {Node[]} nodes
8090
+ * @returns nodes
8091
8091
  * An array with nodes matching given filter criteria
8092
8092
  */
8093
8093
  filter(callback) {
@@ -8101,14 +8101,12 @@ var createNode = /* @__PURE__ */ factory(
8101
8101
  }
8102
8102
  /**
8103
8103
  * Create a shallow clone of this node
8104
- * @return {Node}
8105
8104
  */
8106
8105
  clone() {
8107
8106
  throw new Error("Cannot clone a Node interface");
8108
8107
  }
8109
8108
  /**
8110
8109
  * Create a deep clone of this node
8111
- * @return {Node}
8112
8110
  */
8113
8111
  cloneDeep() {
8114
8112
  return this.map(function(node) {
@@ -8117,8 +8115,8 @@ var createNode = /* @__PURE__ */ factory(
8117
8115
  }
8118
8116
  /**
8119
8117
  * Deep compare this node with another node.
8120
- * @param {Node} other
8121
- * @return {boolean} Returns true when both nodes are of the same type and
8118
+ * @param other
8119
+ * @returns Returns true when both nodes are of the same type and
8122
8120
  * contain the same values (as do their childs)
8123
8121
  */
8124
8122
  equals(other) {
@@ -8136,8 +8134,7 @@ var createNode = /* @__PURE__ */ factory(
8136
8134
  * parenthesis: "keep" //the parenthesis option (This is optional)
8137
8135
  * }
8138
8136
  *
8139
- * @param {Object} [options]
8140
- * @return {string}
8137
+ * @param options - Optional.
8141
8138
  */
8142
8139
  toString(options) {
8143
8140
  const customString = this._getCustomString(options);
@@ -8150,7 +8147,7 @@ var createNode = /* @__PURE__ */ factory(
8150
8147
  * Internal function to generate the string output.
8151
8148
  * This has to be implemented by every Node
8152
8149
  *
8153
- * @throws {Error}
8150
+ * @throws Error
8154
8151
  */
8155
8152
  _toString(_options) {
8156
8153
  throw new Error("_toString not implemented for " + this.type);
@@ -8159,7 +8156,6 @@ var createNode = /* @__PURE__ */ factory(
8159
8156
  * Get a JSON representation of the node
8160
8157
  * Both .toJSON() and the static .fromJSON(json) should be implemented by all
8161
8158
  * implementations of Node
8162
- * @returns {Object}
8163
8159
  */
8164
8160
  toJSON() {
8165
8161
  throw new Error("Cannot serialize object: toJSON not implemented by " + this.type);
@@ -8176,8 +8172,7 @@ var createNode = /* @__PURE__ */ factory(
8176
8172
  * parenthesis: "keep" //the parenthesis option (This is optional)
8177
8173
  * }
8178
8174
  *
8179
- * @param {Object} [options]
8180
- * @return {string}
8175
+ * @param options - Optional.
8181
8176
  */
8182
8177
  toHTML(options) {
8183
8178
  const customString = this._getCustomString(options);
@@ -8190,7 +8185,7 @@ var createNode = /* @__PURE__ */ factory(
8190
8185
  * Internal function to generate the HTML output.
8191
8186
  * This has to be implemented by every Node
8192
8187
  *
8193
- * @throws {Error}
8188
+ * @throws Error
8194
8189
  */
8195
8190
  _toHTML(_options) {
8196
8191
  throw new Error("_toHTML not implemented for " + this.type);
@@ -8207,8 +8202,7 @@ var createNode = /* @__PURE__ */ factory(
8207
8202
  * parenthesis: "keep" //the parenthesis option (This is optional)
8208
8203
  * }
8209
8204
  *
8210
- * @param {Object} [options]
8211
- * @return {string}
8205
+ * @param options - Optional.
8212
8206
  */
8213
8207
  toTex(options) {
8214
8208
  const customString = this._getCustomString(options);
@@ -8221,8 +8215,7 @@ var createNode = /* @__PURE__ */ factory(
8221
8215
  * Render this node as Markdown-embeddable math. Display (block) math by
8222
8216
  * default (`$$…$$`), inline (`$…$`) when `options.inline` is true. Thin
8223
8217
  * wrapper over toTex(); adds no failure mode beyond toTex's own.
8224
- * @param {Object} [options]
8225
- * @return {string}
8218
+ * @param options - Optional.
8226
8219
  */
8227
8220
  toMarkdown(options) {
8228
8221
  const tex = this.toTex(options);
@@ -8232,8 +8225,7 @@ var createNode = /* @__PURE__ */ factory(
8232
8225
  * Render the AST subtree rooted at this node as a Graphviz digraph: one
8233
8226
  * DOT node per AST node (label = node type + a value for leaves), with
8234
8227
  * parent→child edges. Never throws.
8235
- * @param {Object} [options]
8236
- * @return {string}
8228
+ * @param options - Optional.
8237
8229
  */
8238
8230
  toDOT(options) {
8239
8231
  const ids = /* @__PURE__ */ new Map();
@@ -8259,7 +8251,6 @@ ${nodes.concat(edges).join("\n")}
8259
8251
  * Like `toTex`, this returns the body — wrap it in a `<math>` element with
8260
8252
  * `mathMLDocument(node)` to render. Never throws: a failing node degrades
8261
8253
  * to an escaped `<merror>` fragment.
8262
- * @return {string}
8263
8254
  */
8264
8255
  toMathML() {
8265
8256
  try {
@@ -8280,8 +8271,8 @@ ${nodes.concat(edges).join("\n")}
8280
8271
  * Internal function to generate the LaTeX output.
8281
8272
  * This has to be implemented by every Node
8282
8273
  *
8283
- * @param {Object} [options]
8284
- * @throws {Error}
8274
+ * @param _options - Optional.
8275
+ * @throws Error
8285
8276
  */
8286
8277
  _toTex(_options) {
8287
8278
  throw new Error("_toTex not implemented for " + this.type);
@@ -8305,14 +8296,13 @@ ${nodes.concat(edges).join("\n")}
8305
8296
  }
8306
8297
  /**
8307
8298
  * Get identifier.
8308
- * @return {string}
8309
8299
  */
8310
8300
  getIdentifier() {
8311
8301
  return this.type;
8312
8302
  }
8313
8303
  /**
8314
8304
  * Get the content of the current Node.
8315
- * @return {Node} node
8305
+ * @returns node
8316
8306
  **/
8317
8307
  getContent() {
8318
8308
  return this;
@@ -8497,10 +8487,10 @@ var createAccessorNode = /* @__PURE__ */ factory(
8497
8487
  * @extends {Node}
8498
8488
  * Access an object property or get a matrix subset
8499
8489
  *
8500
- * @param {Node} object The object from which to retrieve
8490
+ * @param object - The object from which to retrieve
8501
8491
  * a property or subset.
8502
- * @param {IndexNode} index IndexNode containing ranges
8503
- * @param {boolean} [optionalChaining=false]
8492
+ * @param index - IndexNode containing ranges
8493
+ * @param optionalChaining - Default is `false`.
8504
8494
  * Optional property, if the accessor was written as optional-chaining
8505
8495
  * using `a?.b`, or `a?.["b"] with bracket notation.
8506
8496
  * Forces evaluate to undefined if the given object is undefined or null.
@@ -8536,13 +8526,13 @@ var createAccessorNode = /* @__PURE__ */ factory(
8536
8526
  * Compile a node into a JavaScript function.
8537
8527
  * This basically pre-calculates as much as possible and only leaves open
8538
8528
  * calculations which depend on a dynamic scope with variables.
8539
- * @param {Object} math Math.js namespace with functions and constants.
8540
- * @param {Object} argNames An object with argument names as key and `true`
8529
+ * @param math - Math.js namespace with functions and constants.
8530
+ * @param argNames - An object with argument names as key and `true`
8541
8531
  * as value. Used in the SymbolNode to optimize
8542
8532
  * for arguments from user assigned functions
8543
8533
  * (see FunctionAssignmentNode) or special symbols
8544
8534
  * like `end` (see IndexNode).
8545
- * @return {function} Returns a function which can be called like:
8535
+ * @returns Returns a function which can be called like:
8546
8536
  * evalNode(scope: Object, args: Object, context: *)
8547
8537
  */
8548
8538
  _compile(math, argNames) {
@@ -8582,7 +8572,7 @@ var createAccessorNode = /* @__PURE__ */ factory(
8582
8572
  }
8583
8573
  /**
8584
8574
  * Execute a callback for each of the child nodes of this node
8585
- * @param {function(child: Node, path: string, parent: Node)} callback
8575
+ * @param callback
8586
8576
  */
8587
8577
  forEach(callback) {
8588
8578
  callback(this.object, "object", this);
@@ -8591,8 +8581,8 @@ var createAccessorNode = /* @__PURE__ */ factory(
8591
8581
  /**
8592
8582
  * Create a new AccessorNode whose children are the results of calling
8593
8583
  * the provided callback function for each child of the original node.
8594
- * @param {function(child: Node, path: string, parent: Node): Node} callback
8595
- * @returns {AccessorNode} Returns a transformed copy of the node
8584
+ * @param callback
8585
+ * @returns Returns a transformed copy of the node
8596
8586
  */
8597
8587
  map(callback) {
8598
8588
  return new AccessorNode(
@@ -8603,15 +8593,13 @@ var createAccessorNode = /* @__PURE__ */ factory(
8603
8593
  }
8604
8594
  /**
8605
8595
  * Create a clone of this node, a shallow copy
8606
- * @return {AccessorNode}
8607
8596
  */
8608
8597
  clone() {
8609
8598
  return new AccessorNode(this.object, this.index, this.optionalChaining);
8610
8599
  }
8611
8600
  /**
8612
8601
  * Get string representation
8613
- * @param {Object} options
8614
- * @return {string}
8602
+ * @param options
8615
8603
  */
8616
8604
  _toString(options) {
8617
8605
  let object = this.object.toString(options);
@@ -8623,8 +8611,7 @@ var createAccessorNode = /* @__PURE__ */ factory(
8623
8611
  }
8624
8612
  /**
8625
8613
  * Get HTML representation
8626
- * @param {Object} options
8627
- * @return {string}
8614
+ * @param options
8628
8615
  */
8629
8616
  _toHTML(options) {
8630
8617
  let object = this.object.toHTML(options);
@@ -8635,8 +8622,7 @@ var createAccessorNode = /* @__PURE__ */ factory(
8635
8622
  }
8636
8623
  /**
8637
8624
  * Get LaTeX representation
8638
- * @param {Object} options
8639
- * @return {string}
8625
+ * @param options
8640
8626
  */
8641
8627
  _toTex(options) {
8642
8628
  let object = this.object.toTex(options);
@@ -8647,7 +8633,6 @@ var createAccessorNode = /* @__PURE__ */ factory(
8647
8633
  }
8648
8634
  /**
8649
8635
  * Get a JSON representation of the node
8650
- * @returns {Object}
8651
8636
  */
8652
8637
  toJSON() {
8653
8638
  return {
@@ -8659,11 +8644,10 @@ var createAccessorNode = /* @__PURE__ */ factory(
8659
8644
  }
8660
8645
  /**
8661
8646
  * Instantiate an AccessorNode from its JSON representation
8662
- * @param {Object} json
8647
+ * @param json
8663
8648
  * An object structured like
8664
8649
  * `{"mathjs": "AccessorNode", object: ..., index: ...}`,
8665
8650
  * where mathjs is optional
8666
- * @returns {AccessorNode}
8667
8651
  */
8668
8652
  static fromJSON(json) {
8669
8653
  return new AccessorNode(json.object, json.index, json.optionalChaining);
@@ -8687,7 +8671,7 @@ var createArrayNode = /* @__PURE__ */ factory(
8687
8671
  * @constructor ArrayNode
8688
8672
  * @extends {Node}
8689
8673
  * Holds an 1-dimensional array with items
8690
- * @param {Node[]} [items] 1 dimensional array with items
8674
+ * @param items - Optional. 1 dimensional array with items
8691
8675
  */
8692
8676
  constructor(items) {
8693
8677
  super();
@@ -8707,13 +8691,13 @@ var createArrayNode = /* @__PURE__ */ factory(
8707
8691
  * Compile a node into a JavaScript function.
8708
8692
  * This basically pre-calculates as much as possible and only leaves open
8709
8693
  * calculations which depend on a dynamic scope with variables.
8710
- * @param {Object} math Math.js namespace with functions and constants.
8711
- * @param {Object} argNames An object with argument names as key and `true`
8694
+ * @param math - Math.js namespace with functions and constants.
8695
+ * @param argNames - An object with argument names as key and `true`
8712
8696
  * as value. Used in the SymbolNode to optimize
8713
8697
  * for arguments from user assigned functions
8714
8698
  * (see FunctionAssignmentNode) or special symbols
8715
8699
  * like `end` (see IndexNode).
8716
- * @return {function} Returns a function which can be called like:
8700
+ * @returns Returns a function which can be called like:
8717
8701
  * evalNode(scope: Object, args: Object, context: *)
8718
8702
  */
8719
8703
  _compile(math, argNames) {
@@ -8740,7 +8724,7 @@ var createArrayNode = /* @__PURE__ */ factory(
8740
8724
  }
8741
8725
  /**
8742
8726
  * Execute a callback for each of the child nodes of this node
8743
- * @param {function(child: Node, path: string, parent: Node)} callback
8727
+ * @param callback
8744
8728
  */
8745
8729
  forEach(callback) {
8746
8730
  for (let i = 0; i < this.items.length; i++) {
@@ -8751,8 +8735,8 @@ var createArrayNode = /* @__PURE__ */ factory(
8751
8735
  /**
8752
8736
  * Create a new ArrayNode whose children are the results of calling
8753
8737
  * the provided callback function for each child of the original node.
8754
- * @param {function(child: Node, path: string, parent: Node): Node} callback
8755
- * @returns {ArrayNode} Returns a transformed copy of the node
8738
+ * @param callback
8739
+ * @returns Returns a transformed copy of the node
8756
8740
  */
8757
8741
  map(callback) {
8758
8742
  const items = [];
@@ -8763,15 +8747,14 @@ var createArrayNode = /* @__PURE__ */ factory(
8763
8747
  }
8764
8748
  /**
8765
8749
  * Create a clone of this node, a shallow copy
8766
- * @return {ArrayNode}
8767
8750
  */
8768
8751
  clone() {
8769
8752
  return new ArrayNode(this.items.slice(0));
8770
8753
  }
8771
8754
  /**
8772
8755
  * Get string representation
8773
- * @param {Object} options
8774
- * @return {string} str
8756
+ * @param options
8757
+ * @returns str
8775
8758
  * @override
8776
8759
  */
8777
8760
  _toString(options) {
@@ -8782,7 +8765,6 @@ var createArrayNode = /* @__PURE__ */ factory(
8782
8765
  }
8783
8766
  /**
8784
8767
  * Get a JSON representation of the node
8785
- * @returns {Object}
8786
8768
  */
8787
8769
  toJSON() {
8788
8770
  return {
@@ -8792,18 +8774,17 @@ var createArrayNode = /* @__PURE__ */ factory(
8792
8774
  }
8793
8775
  /**
8794
8776
  * Instantiate an ArrayNode from its JSON representation
8795
- * @param {Object} json An object structured like
8777
+ * @param json - An object structured like
8796
8778
  * `{"mathjs": "ArrayNode", items: [...]}`,
8797
8779
  * where mathjs is optional
8798
- * @returns {ArrayNode}
8799
8780
  */
8800
8781
  static fromJSON(json) {
8801
8782
  return new ArrayNode(json.items);
8802
8783
  }
8803
8784
  /**
8804
8785
  * Get HTML representation
8805
- * @param {Object} options
8806
- * @return {string} str
8786
+ * @param options
8787
+ * @returns str
8807
8788
  * @override
8808
8789
  */
8809
8790
  _toHTML(options) {
@@ -8814,8 +8795,8 @@ var createArrayNode = /* @__PURE__ */ factory(
8814
8795
  }
8815
8796
  /**
8816
8797
  * Get LaTeX representation
8817
- * @param {Object} options
8818
- * @return {string} str
8798
+ * @param options
8799
+ * @returns str
8819
8800
  */
8820
8801
  _toTex(options) {
8821
8802
  function itemsToTex(items, nested) {
@@ -8916,13 +8897,13 @@ var createAssignmentNode = /* @__PURE__ */ factory(
8916
8897
  * new IndexNode(1, 2),
8917
8898
  * new ConstantNode(3)) // a[1,2]=3
8918
8899
  *
8919
- * @param {SymbolNode | AccessorNode} object
8900
+ * @param object
8920
8901
  * Object on which to assign a value
8921
- * @param {IndexNode} [index=null]
8902
+ * @param index - Default is `null`.
8922
8903
  * Index, property name or matrix index. Optional. If not provided
8923
8904
  * and `object` is a SymbolNode, the property is assigned to the
8924
8905
  * global scope.
8925
- * @param {Node} value
8906
+ * @param value
8926
8907
  * The value to be assigned
8927
8908
  */
8928
8909
  constructor(object, index, value) {
@@ -8963,13 +8944,13 @@ var createAssignmentNode = /* @__PURE__ */ factory(
8963
8944
  * Compile a node into a JavaScript function.
8964
8945
  * This basically pre-calculates as much as possible and only leaves open
8965
8946
  * calculations which depend on a dynamic scope with variables.
8966
- * @param {Object} math Math.js namespace with functions and constants.
8967
- * @param {Object} argNames An object with argument names as key and `true`
8947
+ * @param math - Math.js namespace with functions and constants.
8948
+ * @param argNames - An object with argument names as key and `true`
8968
8949
  * as value. Used in the SymbolNode to optimize
8969
8950
  * for arguments from user assigned functions
8970
8951
  * (see FunctionAssignmentNode) or special symbols
8971
8952
  * like `end` (see IndexNode).
8972
- * @return {function} Returns a function which can be called like:
8953
+ * @returns Returns a function which can be called like:
8973
8954
  * evalNode(scope: Object, args: Object, context: *)
8974
8955
  */
8975
8956
  _compile(math, argNames) {
@@ -9031,7 +9012,7 @@ var createAssignmentNode = /* @__PURE__ */ factory(
9031
9012
  }
9032
9013
  /**
9033
9014
  * Execute a callback for each of the child nodes of this node
9034
- * @param {function(child: Node, path: string, parent: Node)} callback
9015
+ * @param callback
9035
9016
  */
9036
9017
  forEach(callback) {
9037
9018
  callback(this.object, "object", this);
@@ -9043,8 +9024,8 @@ var createAssignmentNode = /* @__PURE__ */ factory(
9043
9024
  /**
9044
9025
  * Create a new AssignmentNode whose children are the results of calling
9045
9026
  * the provided callback function for each child of the original node.
9046
- * @param {function(child: Node, path: string, parent: Node): Node} callback
9047
- * @returns {AssignmentNode} Returns a transformed copy of the node
9027
+ * @param callback
9028
+ * @returns Returns a transformed copy of the node
9048
9029
  */
9049
9030
  map(callback) {
9050
9031
  const object = this._ifNode(callback(this.object, "object", this));
@@ -9054,15 +9035,13 @@ var createAssignmentNode = /* @__PURE__ */ factory(
9054
9035
  }
9055
9036
  /**
9056
9037
  * Create a clone of this node, a shallow copy
9057
- * @return {AssignmentNode}
9058
9038
  */
9059
9039
  clone() {
9060
9040
  return new AssignmentNode(this.object, this.index, this.value);
9061
9041
  }
9062
9042
  /**
9063
9043
  * Get string representation
9064
- * @param {Object} options
9065
- * @return {string}
9044
+ * @param options
9066
9045
  */
9067
9046
  _toString(options) {
9068
9047
  const object = this.object.toString(options);
@@ -9075,7 +9054,6 @@ var createAssignmentNode = /* @__PURE__ */ factory(
9075
9054
  }
9076
9055
  /**
9077
9056
  * Get a JSON representation of the node
9078
- * @returns {Object}
9079
9057
  */
9080
9058
  toJSON() {
9081
9059
  return {
@@ -9087,19 +9065,17 @@ var createAssignmentNode = /* @__PURE__ */ factory(
9087
9065
  }
9088
9066
  /**
9089
9067
  * Instantiate an AssignmentNode from its JSON representation
9090
- * @param {Object} json
9068
+ * @param json
9091
9069
  * An object structured like
9092
9070
  * `{"mathjs": "AssignmentNode", object: ..., index: ..., value: ...}`,
9093
9071
  * where mathjs is optional
9094
- * @returns {AssignmentNode}
9095
9072
  */
9096
9073
  static fromJSON(json) {
9097
9074
  return new AssignmentNode(json.object, json.index, json.value);
9098
9075
  }
9099
9076
  /**
9100
9077
  * Get HTML representation
9101
- * @param {Object} options
9102
- * @return {string}
9078
+ * @param options
9103
9079
  */
9104
9080
  _toHTML(options) {
9105
9081
  const object = this.object.toHTML(options);
@@ -9111,9 +9087,7 @@ var createAssignmentNode = /* @__PURE__ */ factory(
9111
9087
  return object + index + '<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>' + value;
9112
9088
  }
9113
9089
  /**
9114
- * Get LaTeX representation
9115
- * @param {Object} options
9116
- * @return {string}
9090
+ * Get the MathML representation of this node.
9117
9091
  */
9118
9092
  _toMathML() {
9119
9093
  const obj = this.object;
@@ -9154,7 +9128,7 @@ var createBlockNode = /* @__PURE__ */ factory(
9154
9128
  * @constructor BlockNode
9155
9129
  * @extends {Node}
9156
9130
  * Holds a set with blocks
9157
- * @param {Array.<{node: Node} | {node: Node, visible: boolean}>} blocks
9131
+ * @param blocks
9158
9132
  * An array with blocks, where a block is constructed as an
9159
9133
  * Object with properties block, which is a Node, and visible,
9160
9134
  * which is a boolean. The property visible is optional and
@@ -9184,13 +9158,13 @@ var createBlockNode = /* @__PURE__ */ factory(
9184
9158
  * Compile a node into a JavaScript function.
9185
9159
  * This basically pre-calculates as much as possible and only leaves open
9186
9160
  * calculations which depend on a dynamic scope with variables.
9187
- * @param {Object} math Math.js namespace with functions and constants.
9188
- * @param {Object} argNames An object with argument names as key and `true`
9161
+ * @param math - Math.js namespace with functions and constants.
9162
+ * @param argNames - An object with argument names as key and `true`
9189
9163
  * as value. Used in the SymbolNode to optimize
9190
9164
  * for arguments from user assigned functions
9191
9165
  * (see FunctionAssignmentNode) or special symbols
9192
9166
  * like `end` (see IndexNode).
9193
- * @return {function} Returns a function which can be called like:
9167
+ * @returns Returns a function which can be called like:
9194
9168
  * evalNode(scope: Object, args: Object, context: *)
9195
9169
  */
9196
9170
  _compile(math, argNames) {
@@ -9213,7 +9187,7 @@ var createBlockNode = /* @__PURE__ */ factory(
9213
9187
  }
9214
9188
  /**
9215
9189
  * Execute a callback for each of the child blocks of this node
9216
- * @param {function(child: Node, path: string, parent: Node)} callback
9190
+ * @param callback
9217
9191
  */
9218
9192
  forEach(callback) {
9219
9193
  for (let i = 0; i < this.blocks.length; i++) {
@@ -9223,8 +9197,8 @@ var createBlockNode = /* @__PURE__ */ factory(
9223
9197
  /**
9224
9198
  * Create a new BlockNode whose children are the results of calling
9225
9199
  * the provided callback function for each child of the original node.
9226
- * @param {function(child: Node, path: string, parent: Node): Node} callback
9227
- * @returns {BlockNode} Returns a transformed copy of the node
9200
+ * @param callback
9201
+ * @returns Returns a transformed copy of the node
9228
9202
  */
9229
9203
  map(callback) {
9230
9204
  const blocks = [];
@@ -9240,7 +9214,6 @@ var createBlockNode = /* @__PURE__ */ factory(
9240
9214
  }
9241
9215
  /**
9242
9216
  * Create a clone of this node, a shallow copy
9243
- * @return {BlockNode}
9244
9217
  */
9245
9218
  clone() {
9246
9219
  const blocks = this.blocks.map(function(block) {
@@ -9253,8 +9226,8 @@ var createBlockNode = /* @__PURE__ */ factory(
9253
9226
  }
9254
9227
  /**
9255
9228
  * Get string representation
9256
- * @param {Object} options
9257
- * @return {string} str
9229
+ * @param options
9230
+ * @returns str
9258
9231
  * @override
9259
9232
  */
9260
9233
  _toString(options) {
@@ -9264,7 +9237,6 @@ var createBlockNode = /* @__PURE__ */ factory(
9264
9237
  }
9265
9238
  /**
9266
9239
  * Get a JSON representation of the node
9267
- * @returns {Object}
9268
9240
  */
9269
9241
  toJSON() {
9270
9242
  return {
@@ -9274,19 +9246,18 @@ var createBlockNode = /* @__PURE__ */ factory(
9274
9246
  }
9275
9247
  /**
9276
9248
  * Instantiate an BlockNode from its JSON representation
9277
- * @param {Object} json
9249
+ * @param json
9278
9250
  * An object structured like
9279
9251
  * `{"mathjs": "BlockNode", blocks: [{node: ..., visible: false}, ...]}`,
9280
9252
  * where mathjs is optional
9281
- * @returns {BlockNode}
9282
9253
  */
9283
9254
  static fromJSON(json) {
9284
9255
  return new BlockNode(json.blocks);
9285
9256
  }
9286
9257
  /**
9287
9258
  * Get HTML representation
9288
- * @param {Object} options
9289
- * @return {string} str
9259
+ * @param options
9260
+ * @returns str
9290
9261
  * @override
9291
9262
  */
9292
9263
  _toHTML(options) {
@@ -9296,8 +9267,8 @@ var createBlockNode = /* @__PURE__ */ factory(
9296
9267
  }
9297
9268
  /**
9298
9269
  * Get LaTeX representation
9299
- * @param {Object} options
9300
- * @return {string} str
9270
+ * @param options
9271
+ * @returns str
9301
9272
  */
9302
9273
  _toTex(options) {
9303
9274
  return this.blocks.map(function(param) {
@@ -9344,9 +9315,9 @@ var createConditionalNode = /* @__PURE__ */ factory(
9344
9315
  /**
9345
9316
  * A lazy evaluating conditional operator: 'condition ? trueExpr : falseExpr'
9346
9317
  *
9347
- * @param {Node} condition Condition, must result in a boolean
9348
- * @param {Node} trueExpr Expression evaluated when condition is true
9349
- * @param {Node} falseExpr Expression evaluated when condition is true
9318
+ * @param condition - Condition, must result in a boolean
9319
+ * @param trueExpr - Expression evaluated when condition is true
9320
+ * @param falseExpr - Expression evaluated when condition is true
9350
9321
  *
9351
9322
  * @constructor ConditionalNode
9352
9323
  * @extends {Node}
@@ -9377,13 +9348,13 @@ var createConditionalNode = /* @__PURE__ */ factory(
9377
9348
  * Compile a node into a JavaScript function.
9378
9349
  * This basically pre-calculates as much as possible and only leaves open
9379
9350
  * calculations which depend on a dynamic scope with variables.
9380
- * @param {Object} math Math.js namespace with functions and constants.
9381
- * @param {Object} argNames An object with argument names as key and `true`
9351
+ * @param math - Math.js namespace with functions and constants.
9352
+ * @param argNames - An object with argument names as key and `true`
9382
9353
  * as value. Used in the SymbolNode to optimize
9383
9354
  * for arguments from user assigned functions
9384
9355
  * (see FunctionAssignmentNode) or special symbols
9385
9356
  * like `end` (see IndexNode).
9386
- * @return {function} Returns a function which can be called like:
9357
+ * @returns Returns a function which can be called like:
9387
9358
  * evalNode(scope: Object, args: Object, context: *)
9388
9359
  */
9389
9360
  _compile(math, argNames) {
@@ -9396,7 +9367,7 @@ var createConditionalNode = /* @__PURE__ */ factory(
9396
9367
  }
9397
9368
  /**
9398
9369
  * Execute a callback for each of the child nodes of this node
9399
- * @param {function(child: Node, path: string, parent: Node)} callback
9370
+ * @param callback
9400
9371
  */
9401
9372
  forEach(callback) {
9402
9373
  callback(this.condition, "condition", this);
@@ -9406,8 +9377,8 @@ var createConditionalNode = /* @__PURE__ */ factory(
9406
9377
  /**
9407
9378
  * Create a new ConditionalNode whose children are the results of calling
9408
9379
  * the provided callback function for each child of the original node.
9409
- * @param {function(child: Node, path: string, parent: Node): Node} callback
9410
- * @returns {ConditionalNode} Returns a transformed copy of the node
9380
+ * @param callback
9381
+ * @returns Returns a transformed copy of the node
9411
9382
  */
9412
9383
  map(callback) {
9413
9384
  return new ConditionalNode(
@@ -9418,15 +9389,14 @@ var createConditionalNode = /* @__PURE__ */ factory(
9418
9389
  }
9419
9390
  /**
9420
9391
  * Create a clone of this node, a shallow copy
9421
- * @return {ConditionalNode}
9422
9392
  */
9423
9393
  clone() {
9424
9394
  return new ConditionalNode(this.condition, this.trueExpr, this.falseExpr);
9425
9395
  }
9426
9396
  /**
9427
9397
  * Get string representation
9428
- * @param {Object} options
9429
- * @return {string} str
9398
+ * @param options
9399
+ * @returns str
9430
9400
  */
9431
9401
  _toString(options) {
9432
9402
  const parenthesis = options && options.parenthesis ? options.parenthesis : "keep";
@@ -9470,7 +9440,6 @@ var createConditionalNode = /* @__PURE__ */ factory(
9470
9440
  }
9471
9441
  /**
9472
9442
  * Get a JSON representation of the node
9473
- * @returns {Object}
9474
9443
  */
9475
9444
  toJSON() {
9476
9445
  return {
@@ -9482,7 +9451,7 @@ var createConditionalNode = /* @__PURE__ */ factory(
9482
9451
  }
9483
9452
  /**
9484
9453
  * Instantiate an ConditionalNode from its JSON representation
9485
- * @param {Object} json
9454
+ * @param json
9486
9455
  * An object structured like
9487
9456
  * ```
9488
9457
  * {"mathjs": "ConditionalNode",
@@ -9491,15 +9460,14 @@ var createConditionalNode = /* @__PURE__ */ factory(
9491
9460
  * "falseExpr": ...}
9492
9461
  * ```
9493
9462
  * where mathjs is optional
9494
- * @returns {ConditionalNode}
9495
9463
  */
9496
9464
  static fromJSON(json) {
9497
9465
  return new ConditionalNode(json.condition, json.trueExpr, json.falseExpr);
9498
9466
  }
9499
9467
  /**
9500
9468
  * Get HTML representation
9501
- * @param {Object} options
9502
- * @return {string} str
9469
+ * @param options
9470
+ * @returns str
9503
9471
  */
9504
9472
  _toHTML(options) {
9505
9473
  const parenthesis = options && options.parenthesis ? options.parenthesis : "keep";
@@ -9543,8 +9511,8 @@ var createConditionalNode = /* @__PURE__ */ factory(
9543
9511
  }
9544
9512
  /**
9545
9513
  * Get LaTeX representation
9546
- * @param {Object} options
9547
- * @return {string} str
9514
+ * @param options
9515
+ * @returns str
9548
9516
  */
9549
9517
  _toTex(options) {
9550
9518
  return "\\begin{cases} {" + this.trueExpr.toTex(options) + "}, &\\quad{\\text{if }\\;" + this.condition.toTex(options) + "}\\\\{" + this.falseExpr.toTex(options) + "}, &\\quad{\\text{otherwise}}\\end{cases}";
@@ -9910,7 +9878,7 @@ var createConstantNode = /* @__PURE__ */ factory(
9910
9878
  * new ConstantNode(2.3)
9911
9879
  * new ConstantNode('hello')
9912
9880
  *
9913
- * @param {*} value Value can be any type (number, BigNumber, bigint, string, ...)
9881
+ * @param value - Value can be any type (number, BigNumber, bigint, string, ...)
9914
9882
  * @constructor ConstantNode
9915
9883
  * @extends {Node}
9916
9884
  */
@@ -9929,13 +9897,13 @@ var createConstantNode = /* @__PURE__ */ factory(
9929
9897
  * Compile a node into a JavaScript function.
9930
9898
  * This basically pre-calculates as much as possible and only leaves open
9931
9899
  * calculations which depend on a dynamic scope with variables.
9932
- * @param {Object} math Math.js namespace with functions and constants.
9933
- * @param {Object} argNames An object with argument names as key and `true`
9900
+ * @param _math - Math.js namespace with functions and constants.
9901
+ * @param _argNames - An object with argument names as key and `true`
9934
9902
  * as value. Used in the SymbolNode to optimize
9935
9903
  * for arguments from user assigned functions
9936
9904
  * (see FunctionAssignmentNode) or special symbols
9937
9905
  * like `end` (see IndexNode).
9938
- * @return {function} Returns a function which can be called like:
9906
+ * @returns Returns a function which can be called like:
9939
9907
  * evalNode(scope: Object, args: Object, context: *)
9940
9908
  */
9941
9909
  _compile(_math, _argNames) {
@@ -9946,38 +9914,37 @@ var createConstantNode = /* @__PURE__ */ factory(
9946
9914
  }
9947
9915
  /**
9948
9916
  * Execute a callback for each of the child nodes of this node
9949
- * @param {function(child: Node, path: string, parent: Node)} callback
9917
+ * @param _callback
9950
9918
  */
9951
9919
  forEach(_callback) {
9952
9920
  }
9953
9921
  /**
9954
9922
  * Create a new ConstantNode with children produced by the given callback.
9955
9923
  * Trivial because there are no children.
9956
- * @param {function(child: Node, path: string, parent: Node) : Node} callback
9957
- * @returns {ConstantNode} Returns a clone of the node
9924
+ * @param _callback
9925
+ * @returns Returns a clone of the node
9958
9926
  */
9959
9927
  map(_callback) {
9960
9928
  return this.clone();
9961
9929
  }
9962
9930
  /**
9963
9931
  * Create a clone of this node, a shallow copy
9964
- * @return {ConstantNode}
9965
9932
  */
9966
9933
  clone() {
9967
9934
  return new ConstantNode(this.value);
9968
9935
  }
9969
9936
  /**
9970
9937
  * Get string representation
9971
- * @param {Object} options
9972
- * @return {string} str
9938
+ * @param options
9939
+ * @returns str
9973
9940
  */
9974
9941
  _toString(options) {
9975
9942
  return formatGeneric(this.value, options);
9976
9943
  }
9977
9944
  /**
9978
9945
  * Get HTML representation
9979
- * @param {Object} options
9980
- * @return {string} str
9946
+ * @param options
9947
+ * @returns str
9981
9948
  */
9982
9949
  _toHTML(options) {
9983
9950
  const value = this._toString(options);
@@ -10001,25 +9968,22 @@ var createConstantNode = /* @__PURE__ */ factory(
10001
9968
  }
10002
9969
  /**
10003
9970
  * Get a JSON representation of the node
10004
- * @returns {Object}
10005
9971
  */
10006
9972
  toJSON() {
10007
9973
  return { mathjs: name11, value: this.value };
10008
9974
  }
10009
9975
  /**
10010
9976
  * Instantiate a ConstantNode from its JSON representation
10011
- * @param {Object} json An object structured like
9977
+ * @param json - An object structured like
10012
9978
  * `{"mathjs": "SymbolNode", value: 2.3}`,
10013
9979
  * where mathjs is optional
10014
- * @returns {ConstantNode}
10015
9980
  */
10016
9981
  static fromJSON(json) {
10017
9982
  return new ConstantNode(json.value);
10018
9983
  }
10019
9984
  /**
10020
- * Get LaTeX representation
10021
- * @param {Object} options
10022
- * @return {string} str
9985
+ * Get the MathML representation of this node.
9986
+ * @returns str
10023
9987
  */
10024
9988
  _toMathML() {
10025
9989
  return constantToMathML(this.value);
@@ -10081,12 +10045,12 @@ var createFunctionAssignmentNode = /* @__PURE__ */ factory(
10081
10045
  * @extends {Node}
10082
10046
  * Function assignment
10083
10047
  *
10084
- * @param {string} name Function name
10085
- * @param {string[] | Array.<{name: string, type: string}>} params
10048
+ * @param name - Function name
10049
+ * @param params
10086
10050
  * Array with function parameter names, or an
10087
10051
  * array with objects containing the name
10088
10052
  * and type of the parameter
10089
- * @param {Node} expr The function expression
10053
+ * @param expr - The function expression
10090
10054
  */
10091
10055
  constructor(name47, params, expr) {
10092
10056
  super();
@@ -10133,13 +10097,13 @@ var createFunctionAssignmentNode = /* @__PURE__ */ factory(
10133
10097
  * Compile a node into a JavaScript function.
10134
10098
  * This basically pre-calculates as much as possible and only leaves open
10135
10099
  * calculations which depend on a dynamic scope with variables.
10136
- * @param {Object} math Math.js namespace with functions and constants.
10137
- * @param {Object} argNames An object with argument names as key and `true`
10100
+ * @param math - Math.js namespace with functions and constants.
10101
+ * @param argNames - An object with argument names as key and `true`
10138
10102
  * as value. Used in the SymbolNode to optimize
10139
10103
  * for arguments from user assigned functions
10140
10104
  * (see FunctionAssignmentNode) or special symbols
10141
10105
  * like `end` (see IndexNode).
10142
- * @return {function} Returns a function which can be called like:
10106
+ * @returns Returns a function which can be called like:
10143
10107
  * evalNode(scope: Object, args: Object, context: *)
10144
10108
  */
10145
10109
  _compile(math, argNames) {
@@ -10171,7 +10135,7 @@ var createFunctionAssignmentNode = /* @__PURE__ */ factory(
10171
10135
  }
10172
10136
  /**
10173
10137
  * Execute a callback for each of the child nodes of this node
10174
- * @param {function(child: Node, path: string, parent: Node)} callback
10138
+ * @param callback
10175
10139
  */
10176
10140
  forEach(callback) {
10177
10141
  callback(this.expr, "expr", this);
@@ -10180,8 +10144,8 @@ var createFunctionAssignmentNode = /* @__PURE__ */ factory(
10180
10144
  * Create a new FunctionAssignmentNode whose children are the results of
10181
10145
  * calling the provided callback function for each child of the original
10182
10146
  * node.
10183
- * @param {function(child: Node, path: string, parent: Node): Node} callback
10184
- * @returns {FunctionAssignmentNode} Returns a transformed copy of the node
10147
+ * @param callback
10148
+ * @returns Returns a transformed copy of the node
10185
10149
  */
10186
10150
  map(callback) {
10187
10151
  const expr = this._ifNode(callback(this.expr, "expr", this));
@@ -10189,15 +10153,14 @@ var createFunctionAssignmentNode = /* @__PURE__ */ factory(
10189
10153
  }
10190
10154
  /**
10191
10155
  * Create a clone of this node, a shallow copy
10192
- * @return {FunctionAssignmentNode}
10193
10156
  */
10194
10157
  clone() {
10195
10158
  return new FunctionAssignmentNode(this.name, this.params.slice(0), this.expr);
10196
10159
  }
10197
10160
  /**
10198
10161
  * get string representation
10199
- * @param {Object} options
10200
- * @return {string} str
10162
+ * @param options
10163
+ * @returns str
10201
10164
  */
10202
10165
  _toString(options) {
10203
10166
  const parenthesis = options && options.parenthesis ? options.parenthesis : "keep";
@@ -10209,7 +10172,6 @@ var createFunctionAssignmentNode = /* @__PURE__ */ factory(
10209
10172
  }
10210
10173
  /**
10211
10174
  * Get a JSON representation of the node
10212
- * @returns {Object}
10213
10175
  */
10214
10176
  toJSON() {
10215
10177
  const types = this.types;
@@ -10227,22 +10189,21 @@ var createFunctionAssignmentNode = /* @__PURE__ */ factory(
10227
10189
  }
10228
10190
  /**
10229
10191
  * Instantiate an FunctionAssignmentNode from its JSON representation
10230
- * @param {Object} json
10192
+ * @param json
10231
10193
  * An object structured like
10232
10194
  * ```
10233
10195
  * {"mathjs": "FunctionAssignmentNode",
10234
10196
  * name: ..., params: ..., expr: ...}
10235
10197
  * ```
10236
10198
  * where mathjs is optional
10237
- * @returns {FunctionAssignmentNode}
10238
10199
  */
10239
10200
  static fromJSON(json) {
10240
10201
  return new FunctionAssignmentNode(json.name, json.params, json.expr);
10241
10202
  }
10242
10203
  /**
10243
10204
  * get HTML representation
10244
- * @param {Object} options
10245
- * @return {string} str
10205
+ * @param options
10206
+ * @returns str
10246
10207
  */
10247
10208
  _toHTML(options) {
10248
10209
  const parenthesis = options && options.parenthesis ? options.parenthesis : "keep";
@@ -10260,8 +10221,8 @@ var createFunctionAssignmentNode = /* @__PURE__ */ factory(
10260
10221
  }
10261
10222
  /**
10262
10223
  * get LaTeX representation
10263
- * @param {Object} options
10264
- * @return {string} str
10224
+ * @param options
10225
+ * @returns str
10265
10226
  */
10266
10227
  _toTex(options) {
10267
10228
  const parenthesis = options && options.parenthesis ? options.parenthesis : "keep";
@@ -10365,10 +10326,10 @@ var createFunctionNode = /* @__PURE__ */ factory(
10365
10326
  * @constructor FunctionNode
10366
10327
  * @extends {./Node}
10367
10328
  * invoke a list with arguments on a node
10368
- * @param {./Node | string} fn
10329
+ * @param fn
10369
10330
  * Item resolving to a function on which to invoke
10370
10331
  * the arguments, typically a SymbolNode or AccessorNode
10371
- * @param {./Node[]} args
10332
+ * @param args
10372
10333
  */
10373
10334
  constructor(fn, args, optional) {
10374
10335
  super();
@@ -10402,13 +10363,13 @@ var createFunctionNode = /* @__PURE__ */ factory(
10402
10363
  * Compile a node into a JavaScript function.
10403
10364
  * This basically pre-calculates as much as possible and only leaves open
10404
10365
  * calculations which depend on a dynamic scope with variables.
10405
- * @param {Object} math Math.js namespace with functions and constants.
10406
- * @param {Object} argNames An object with argument names as key and `true`
10366
+ * @param math - Math.js namespace with functions and constants.
10367
+ * @param argNames - An object with argument names as key and `true`
10407
10368
  * as value. Used in the SymbolNode to optimize
10408
10369
  * for arguments from user assigned functions
10409
10370
  * (see FunctionAssignmentNode) or special symbols
10410
10371
  * like `end` (see IndexNode).
10411
- * @return {function} Returns a function which can be called like:
10372
+ * @returns Returns a function which can be called like:
10412
10373
  * evalNode(scope: Object, args: Object, context: *)
10413
10374
  */
10414
10375
  _compile(math2, argNames) {
@@ -10536,7 +10497,7 @@ var createFunctionNode = /* @__PURE__ */ factory(
10536
10497
  }
10537
10498
  /**
10538
10499
  * Execute a callback for each of the child nodes of this node
10539
- * @param {function(child: Node, path: string, parent: Node)} callback
10500
+ * @param callback
10540
10501
  */
10541
10502
  forEach(callback) {
10542
10503
  callback(this.fn, "fn", this);
@@ -10547,8 +10508,8 @@ var createFunctionNode = /* @__PURE__ */ factory(
10547
10508
  /**
10548
10509
  * Create a new FunctionNode whose children are the results of calling
10549
10510
  * the provided callback function for each child of the original node.
10550
- * @param {function(child: Node, path: string, parent: Node): Node} callback
10551
- * @returns {FunctionNode} Returns a transformed copy of the node
10511
+ * @param callback
10512
+ * @returns Returns a transformed copy of the node
10552
10513
  */
10553
10514
  map(callback) {
10554
10515
  const fn = this._ifNode(callback(this.fn, "fn", this));
@@ -10560,14 +10521,13 @@ var createFunctionNode = /* @__PURE__ */ factory(
10560
10521
  }
10561
10522
  /**
10562
10523
  * Create a clone of this node, a shallow copy
10563
- * @return {FunctionNode}
10564
10524
  */
10565
10525
  clone() {
10566
10526
  return new FunctionNode(this.fn, this.args.slice(0));
10567
10527
  }
10568
10528
  /**
10569
10529
  * Throws an error 'Undefined function {name}'
10570
- * @param {string} name
10530
+ * @param name
10571
10531
  */
10572
10532
  static onUndefinedFunction = function(name47) {
10573
10533
  throw new Error("Undefined function " + name47);
@@ -10580,8 +10540,8 @@ var createFunctionNode = /* @__PURE__ */ factory(
10580
10540
  * otherwise it falls back to calling Node's toString
10581
10541
  * function.
10582
10542
  *
10583
- * @param {Object} options
10584
- * @return {string} str
10543
+ * @param options
10544
+ * @returns str
10585
10545
  * @override
10586
10546
  */
10587
10547
  toString(options) {
@@ -10597,8 +10557,8 @@ var createFunctionNode = /* @__PURE__ */ factory(
10597
10557
  }
10598
10558
  /**
10599
10559
  * Get string representation
10600
- * @param {Object} options
10601
- * @return {string} str
10560
+ * @param options
10561
+ * @returns str
10602
10562
  */
10603
10563
  _toString(options) {
10604
10564
  const args = this.args.map(function(arg) {
@@ -10609,7 +10569,6 @@ var createFunctionNode = /* @__PURE__ */ factory(
10609
10569
  }
10610
10570
  /**
10611
10571
  * Get a JSON representation of the node
10612
- * @returns {Object}
10613
10572
  */
10614
10573
  toJSON() {
10615
10574
  return {
@@ -10620,18 +10579,17 @@ var createFunctionNode = /* @__PURE__ */ factory(
10620
10579
  }
10621
10580
  /**
10622
10581
  * Instantiate an AssignmentNode from its JSON representation
10623
- * @param {Object} json An object structured like
10582
+ * @param json - An object structured like
10624
10583
  * `{"mathjs": "FunctionNode", fn: ..., args: ...}`,
10625
10584
  * where mathjs is optional
10626
- * @returns {FunctionNode}
10627
10585
  */
10628
10586
  static fromJSON = function(json) {
10629
10587
  return new FunctionNode(json.fn, json.args);
10630
10588
  };
10631
10589
  /**
10632
10590
  * Get HTML representation
10633
- * @param {Object} options
10634
- * @return {string} str
10591
+ * @param options
10592
+ * @returns str
10635
10593
  */
10636
10594
  _toHTML(options) {
10637
10595
  const args = this.args.map(function(arg) {
@@ -10647,8 +10605,7 @@ var createFunctionNode = /* @__PURE__ */ factory(
10647
10605
  * otherwise it falls back to calling Node's toTex
10648
10606
  * function.
10649
10607
  *
10650
- * @param {Object} options
10651
- * @return {string}
10608
+ * @param options
10652
10609
  */
10653
10610
  toTex(options) {
10654
10611
  let customTex;
@@ -10661,9 +10618,8 @@ var createFunctionNode = /* @__PURE__ */ factory(
10661
10618
  return super.toTex(options);
10662
10619
  }
10663
10620
  /**
10664
- * Get LaTeX representation
10665
- * @param {Object} options
10666
- * @return {string} str
10621
+ * Get the MathML representation of this node.
10622
+ * @returns str
10667
10623
  */
10668
10624
  _toMathML() {
10669
10625
  const fnNode = this.fn;
@@ -10722,7 +10678,6 @@ var createFunctionNode = /* @__PURE__ */ factory(
10722
10678
  }
10723
10679
  /**
10724
10680
  * Get identifier.
10725
- * @return {string}
10726
10681
  */
10727
10682
  getIdentifier() {
10728
10683
  return this.type + ":" + this.name;
@@ -10751,8 +10706,8 @@ var createIndexNode = /* @__PURE__ */ factory(
10751
10706
  * Cannot be used on its own, needs to be used within an AccessorNode or
10752
10707
  * AssignmentNode.
10753
10708
  *
10754
- * @param {Node[]} dimensions
10755
- * @param {boolean} [dotNotation=false]
10709
+ * @param dimensions
10710
+ * @param dotNotation - Default is `false`.
10756
10711
  * Optional property describing whether this index was written using dot
10757
10712
  * notation like `a.b`, or using bracket notation like `a["b"]`
10758
10713
  * (which is the default). This property is used for string conversion.
@@ -10779,21 +10734,20 @@ var createIndexNode = /* @__PURE__ */ factory(
10779
10734
  * Compile a node into a JavaScript function.
10780
10735
  * This basically pre-calculates as much as possible and only leaves open
10781
10736
  * calculations which depend on a dynamic scope with variables.
10782
- * @param {Object} math Math.js namespace with functions and constants.
10783
- * @param {Object} argNames An object with argument names as key and `true`
10737
+ * @param math - Math.js namespace with functions and constants.
10738
+ * @param argNames - An object with argument names as key and `true`
10784
10739
  * as value. Used in the SymbolNode to optimize
10785
10740
  * for arguments from user assigned functions
10786
10741
  * (see FunctionAssignmentNode) or special symbols
10787
10742
  * like `end` (see IndexNode).
10788
- * @return {function} Returns a function which can be called like:
10743
+ * @returns Returns a function which can be called like:
10789
10744
  * evalNode(scope: Object, args: Object, context: *)
10790
10745
  */
10791
- // @ts-expect-error - method overrides property from Node base class
10792
10746
  _compile(math, argNames) {
10793
10747
  const evalDimensions = map(
10794
10748
  this.dimensions,
10795
10749
  function(dimension, i) {
10796
- const needsEnd = dimension.filter((node) => !!(node.isSymbolNode && node.name === "end")).length > 0;
10750
+ const needsEnd = dimension.filter((node) => isSymbolNode(node) && node.name === "end").length > 0;
10797
10751
  if (needsEnd) {
10798
10752
  const childArgNames = Object.create(argNames);
10799
10753
  childArgNames.end = true;
@@ -10827,7 +10781,7 @@ var createIndexNode = /* @__PURE__ */ factory(
10827
10781
  }
10828
10782
  /**
10829
10783
  * Execute a callback for each of the child nodes of this node
10830
- * @param {function(child: Node, path: string, parent: Node)} callback
10784
+ * @param callback
10831
10785
  */
10832
10786
  forEach(callback) {
10833
10787
  for (let i = 0; i < this.dimensions.length; i++) {
@@ -10837,8 +10791,8 @@ var createIndexNode = /* @__PURE__ */ factory(
10837
10791
  /**
10838
10792
  * Create a new IndexNode whose children are the results of calling
10839
10793
  * the provided callback function for each child of the original node.
10840
- * @param {function(child: Node, path: string, parent: Node): Node} callback
10841
- * @returns {IndexNode} Returns a transformed copy of the node
10794
+ * @param callback
10795
+ * @returns Returns a transformed copy of the node
10842
10796
  */
10843
10797
  map(callback) {
10844
10798
  const dimensions = [];
@@ -10849,14 +10803,12 @@ var createIndexNode = /* @__PURE__ */ factory(
10849
10803
  }
10850
10804
  /**
10851
10805
  * Create a clone of this node, a shallow copy
10852
- * @return {IndexNode}
10853
10806
  */
10854
10807
  clone() {
10855
10808
  return new IndexNode(this.dimensions.slice(0), this.dotNotation);
10856
10809
  }
10857
10810
  /**
10858
10811
  * Test whether this IndexNode contains a single property name
10859
- * @return {boolean}
10860
10812
  */
10861
10813
  isObjectProperty() {
10862
10814
  return this.dimensions.length === 1 && isConstantNode(this.dimensions[0]) && typeof this.dimensions[0].value === "string";
@@ -10864,22 +10816,21 @@ var createIndexNode = /* @__PURE__ */ factory(
10864
10816
  /**
10865
10817
  * Returns the property name if IndexNode contains a property.
10866
10818
  * If not, returns null.
10867
- * @return {string | null}
10868
10819
  */
10869
10820
  getObjectProperty() {
10870
- return this.isObjectProperty() ? this.dimensions[0].value : null;
10821
+ const first = this.dimensions[0];
10822
+ return this.isObjectProperty() && isConstantNode(first) ? first.value : null;
10871
10823
  }
10872
10824
  /**
10873
10825
  * Get string representation
10874
- * @param {Object} options
10875
- * @return {string} str
10826
+ * @param _options
10827
+ * @returns str
10876
10828
  */
10877
10829
  _toString(_options) {
10878
10830
  return this.dotNotation ? "." + this.getObjectProperty() : "[" + this.dimensions.join(", ") + "]";
10879
10831
  }
10880
10832
  /**
10881
10833
  * Get a JSON representation of the node
10882
- * @returns {Object}
10883
10834
  */
10884
10835
  toJSON() {
10885
10836
  return {
@@ -10890,19 +10841,18 @@ var createIndexNode = /* @__PURE__ */ factory(
10890
10841
  }
10891
10842
  /**
10892
10843
  * Instantiate an IndexNode from its JSON representation
10893
- * @param {Object} json
10844
+ * @param json
10894
10845
  * An object structured like
10895
10846
  * `{"mathjs": "IndexNode", dimensions: [...], dotNotation: false}`,
10896
10847
  * where mathjs is optional
10897
- * @returns {IndexNode}
10898
10848
  */
10899
10849
  static fromJSON(json) {
10900
10850
  return new IndexNode(json.dimensions, json.dotNotation);
10901
10851
  }
10902
10852
  /**
10903
10853
  * Get HTML representation
10904
- * @param {Object} options
10905
- * @return {string} str
10854
+ * @param _options
10855
+ * @returns str
10906
10856
  */
10907
10857
  _toHTML(_options) {
10908
10858
  const dimensions = [];
@@ -10917,8 +10867,8 @@ var createIndexNode = /* @__PURE__ */ factory(
10917
10867
  }
10918
10868
  /**
10919
10869
  * Get LaTeX representation
10920
- * @param {Object} options
10921
- * @return {string} str
10870
+ * @param options
10871
+ * @returns str
10922
10872
  */
10923
10873
  _toTex(options) {
10924
10874
  const dimensions = this.dimensions.map(function(range) {
@@ -10945,7 +10895,7 @@ var createObjectNode = /* @__PURE__ */ factory(
10945
10895
  * @constructor ObjectNode
10946
10896
  * @extends {Node}
10947
10897
  * Holds an object with keys/values
10948
- * @param {Object.<string, Node>} [properties] object with key/value pairs
10898
+ * @param properties - Optional. object with key/value pairs
10949
10899
  */
10950
10900
  constructor(properties2) {
10951
10901
  super();
@@ -10969,16 +10919,15 @@ var createObjectNode = /* @__PURE__ */ factory(
10969
10919
  * Compile a node into a JavaScript function.
10970
10920
  * This basically pre-calculates as much as possible and only leaves open
10971
10921
  * calculations which depend on a dynamic scope with variables.
10972
- * @param {Object} math Math.js namespace with functions and constants.
10973
- * @param {Object} argNames An object with argument names as key and `true`
10922
+ * @param math - Math.js namespace with functions and constants.
10923
+ * @param argNames - An object with argument names as key and `true`
10974
10924
  * as value. Used in the SymbolNode to optimize
10975
10925
  * for arguments from user assigned functions
10976
10926
  * (see FunctionAssignmentNode) or special symbols
10977
10927
  * like `end` (see IndexNode).
10978
- * @return {function} Returns a function which can be called like:
10928
+ * @returns Returns a function which can be called like:
10979
10929
  * evalNode(scope: Object, args: Object, context: *)
10980
10930
  */
10981
- // @ts-expect-error - method overrides property from Node base class
10982
10931
  _compile(math, argNames) {
10983
10932
  const evalEntries = {};
10984
10933
  for (const key in this.properties) {
@@ -11001,7 +10950,7 @@ var createObjectNode = /* @__PURE__ */ factory(
11001
10950
  }
11002
10951
  /**
11003
10952
  * Execute a callback for each of the child nodes of this node
11004
- * @param {function(child: Node, path: string, parent: Node)} callback
10953
+ * @param callback
11005
10954
  */
11006
10955
  forEach(callback) {
11007
10956
  for (const key in this.properties) {
@@ -11013,8 +10962,8 @@ var createObjectNode = /* @__PURE__ */ factory(
11013
10962
  /**
11014
10963
  * Create a new ObjectNode whose children are the results of calling
11015
10964
  * the provided callback function for each child of the original node.
11016
- * @param {function(child: Node, path: string, parent: Node): Node} callback
11017
- * @returns {ObjectNode} Returns a transformed copy of the node
10965
+ * @param callback
10966
+ * @returns Returns a transformed copy of the node
11018
10967
  */
11019
10968
  map(callback) {
11020
10969
  const properties2 = {};
@@ -11029,7 +10978,6 @@ var createObjectNode = /* @__PURE__ */ factory(
11029
10978
  }
11030
10979
  /**
11031
10980
  * Create a clone of this node, a shallow copy
11032
- * @return {ObjectNode}
11033
10981
  */
11034
10982
  clone() {
11035
10983
  const properties2 = {};
@@ -11042,8 +10990,8 @@ var createObjectNode = /* @__PURE__ */ factory(
11042
10990
  }
11043
10991
  /**
11044
10992
  * Get string representation
11045
- * @param {Object} options
11046
- * @return {string} str
10993
+ * @param options
10994
+ * @returns str
11047
10995
  * @override
11048
10996
  */
11049
10997
  _toString(options) {
@@ -11057,7 +11005,6 @@ var createObjectNode = /* @__PURE__ */ factory(
11057
11005
  }
11058
11006
  /**
11059
11007
  * Get a JSON representation of the node
11060
- * @returns {Object}
11061
11008
  */
11062
11009
  toJSON() {
11063
11010
  return {
@@ -11067,18 +11014,17 @@ var createObjectNode = /* @__PURE__ */ factory(
11067
11014
  }
11068
11015
  /**
11069
11016
  * Instantiate an OperatorNode from its JSON representation
11070
- * @param {Object} json An object structured like
11017
+ * @param json - An object structured like
11071
11018
  * `{"mathjs": "ObjectNode", "properties": {...}}`,
11072
11019
  * where mathjs is optional
11073
- * @returns {ObjectNode}
11074
11020
  */
11075
11021
  static fromJSON(json) {
11076
11022
  return new ObjectNode(json.properties);
11077
11023
  }
11078
11024
  /**
11079
11025
  * Get HTML representation
11080
- * @param {Object} options
11081
- * @return {string} str
11026
+ * @param options
11027
+ * @returns str
11082
11028
  * @override
11083
11029
  */
11084
11030
  _toHTML(options) {
@@ -11094,8 +11040,8 @@ var createObjectNode = /* @__PURE__ */ factory(
11094
11040
  }
11095
11041
  /**
11096
11042
  * Get LaTeX representation
11097
- * @param {Object} options
11098
- * @return {string} str
11043
+ * @param options
11044
+ * @returns str
11099
11045
  */
11100
11046
  _toTex(options) {
11101
11047
  const entries = [];
@@ -11130,7 +11076,10 @@ var createOperatorNode = /* @__PURE__ */ factory(
11130
11076
  }
11131
11077
  if (isConstantNode(curNode)) return true;
11132
11078
  if (isOperatorNode(curNode)) {
11133
- return startsWithConstant(curNode.args[0], parenthesis);
11079
+ return startsWithConstant(
11080
+ curNode.args[0],
11081
+ parenthesis
11082
+ );
11134
11083
  }
11135
11084
  return false;
11136
11085
  }
@@ -11285,11 +11234,11 @@ var createOperatorNode = /* @__PURE__ */ factory(
11285
11234
  * @extends {Node}
11286
11235
  * An operator with two arguments, like 2+3
11287
11236
  *
11288
- * @param {string} op Operator name, for example '+'
11289
- * @param {string} fn Function name, for example 'add'
11290
- * @param {Node[]} args Operator arguments
11291
- * @param {boolean} [implicit] Is this an implicit multiplication?
11292
- * @param {boolean} [isPercentage] Is this an percentage Operation?
11237
+ * @param op - Operator name, for example '+'
11238
+ * @param fn - Function name, for example 'add'
11239
+ * @param args - Operator arguments
11240
+ * @param implicit - Optional. Is this an implicit multiplication?
11241
+ * @param isPercentage - Optional. Is this an percentage Operation?
11293
11242
  */
11294
11243
  constructor(op, fn, args, implicit, isPercentage) {
11295
11244
  super();
@@ -11319,16 +11268,15 @@ var createOperatorNode = /* @__PURE__ */ factory(
11319
11268
  * Compile a node into a JavaScript function.
11320
11269
  * This basically pre-calculates as much as possible and only leaves open
11321
11270
  * calculations which depend on a dynamic scope with variables.
11322
- * @param {Object} math Math.js namespace with functions and constants.
11323
- * @param {Object} argNames An object with argument names as key and `true`
11271
+ * @param math - Math.js namespace with functions and constants.
11272
+ * @param argNames - An object with argument names as key and `true`
11324
11273
  * as value. Used in the SymbolNode to optimize
11325
11274
  * for arguments from user assigned functions
11326
11275
  * (see FunctionAssignmentNode) or special symbols
11327
11276
  * like `end` (see IndexNode).
11328
- * @return {function} Returns a function which can be called like:
11277
+ * @returns Returns a function which can be called like:
11329
11278
  * evalNode(scope: Object, args: Object, context: *)
11330
11279
  */
11331
- // @ts-expect-error - method overrides property from Node base class
11332
11280
  _compile(math, argNames) {
11333
11281
  if (typeof this.fn !== "string" || !isSafeMethod(math, this.fn)) {
11334
11282
  if (!math[this.fn]) {
@@ -11369,7 +11317,7 @@ var createOperatorNode = /* @__PURE__ */ factory(
11369
11317
  }
11370
11318
  /**
11371
11319
  * Execute a callback for each of the child nodes of this node
11372
- * @param {function(child: Node, path: string, parent: Node)} callback
11320
+ * @param callback
11373
11321
  */
11374
11322
  forEach(callback) {
11375
11323
  for (let i = 0; i < this.args.length; i++) {
@@ -11379,8 +11327,8 @@ var createOperatorNode = /* @__PURE__ */ factory(
11379
11327
  /**
11380
11328
  * Create a new OperatorNode whose children are the results of calling
11381
11329
  * the provided callback function for each child of the original node.
11382
- * @param {function(child: Node, path: string, parent: Node): Node} callback
11383
- * @returns {OperatorNode} Returns a transformed copy of the node
11330
+ * @param callback
11331
+ * @returns Returns a transformed copy of the node
11384
11332
  */
11385
11333
  map(callback) {
11386
11334
  const args = [];
@@ -11391,7 +11339,6 @@ var createOperatorNode = /* @__PURE__ */ factory(
11391
11339
  }
11392
11340
  /**
11393
11341
  * Create a clone of this node, a shallow copy
11394
- * @return {OperatorNode}
11395
11342
  */
11396
11343
  clone() {
11397
11344
  return new OperatorNode(
@@ -11405,8 +11352,7 @@ var createOperatorNode = /* @__PURE__ */ factory(
11405
11352
  /**
11406
11353
  * Check whether this is an unary OperatorNode:
11407
11354
  * has exactly one argument, like `-a`.
11408
- * @return {boolean}
11409
- * Returns true when an unary operator node, false otherwise.
11355
+ * @returns `true` when an unary operator node, `false` otherwise.
11410
11356
  */
11411
11357
  isUnary() {
11412
11358
  return this.args.length === 1;
@@ -11414,16 +11360,15 @@ var createOperatorNode = /* @__PURE__ */ factory(
11414
11360
  /**
11415
11361
  * Check whether this is a binary OperatorNode:
11416
11362
  * has exactly two arguments, like `a + b`.
11417
- * @return {boolean}
11418
- * Returns true when a binary operator node, false otherwise.
11363
+ * @returns `true` when a binary operator node, `false` otherwise.
11419
11364
  */
11420
11365
  isBinary() {
11421
11366
  return this.args.length === 2;
11422
11367
  }
11423
11368
  /**
11424
11369
  * Get string representation.
11425
- * @param {Object} options
11426
- * @return {string} str
11370
+ * @param options
11371
+ * @returns str
11427
11372
  */
11428
11373
  _toString(options) {
11429
11374
  const parenthesis = options && options.parenthesis ? options.parenthesis : "keep";
@@ -11474,7 +11419,6 @@ var createOperatorNode = /* @__PURE__ */ factory(
11474
11419
  }
11475
11420
  /**
11476
11421
  * Get a JSON representation of the node
11477
- * @returns {Object}
11478
11422
  */
11479
11423
  toJSON() {
11480
11424
  return {
@@ -11488,7 +11432,7 @@ var createOperatorNode = /* @__PURE__ */ factory(
11488
11432
  }
11489
11433
  /**
11490
11434
  * Instantiate an OperatorNode from its JSON representation
11491
- * @param {Object} json
11435
+ * @param json
11492
11436
  * An object structured like
11493
11437
  * ```
11494
11438
  * {"mathjs": "OperatorNode",
@@ -11497,15 +11441,14 @@ var createOperatorNode = /* @__PURE__ */ factory(
11497
11441
  * "isPercentage":false}
11498
11442
  * ```
11499
11443
  * where mathjs is optional
11500
- * @returns {OperatorNode}
11501
11444
  */
11502
11445
  static fromJSON(json) {
11503
11446
  return new OperatorNode(json.op, json.fn, json.args, json.implicit, json.isPercentage);
11504
11447
  }
11505
11448
  /**
11506
11449
  * Get HTML representation.
11507
- * @param {Object} options
11508
- * @return {string} str
11450
+ * @param options
11451
+ * @returns str
11509
11452
  */
11510
11453
  _toHTML(options) {
11511
11454
  const parenthesis = options && options.parenthesis ? options.parenthesis : "keep";
@@ -11559,9 +11502,8 @@ var createOperatorNode = /* @__PURE__ */ factory(
11559
11502
  }
11560
11503
  }
11561
11504
  /**
11562
- * Get LaTeX representation
11563
- * @param {Object} options
11564
- * @return {string} str
11505
+ * Get the MathML representation of this node.
11506
+ * @returns str
11565
11507
  */
11566
11508
  _toMathML() {
11567
11509
  const fn = this.fn;
@@ -11572,7 +11514,11 @@ var createOperatorNode = /* @__PURE__ */ factory(
11572
11514
  if (fn === "pow" && args.length === 2) {
11573
11515
  return `<msup><mrow>${args[0].toMathML()}</mrow><mrow>${args[1].toMathML()}</mrow></msup>`;
11574
11516
  }
11575
- const child = (arg) => parenthesizeLower(arg.toMathML(), isOperatorNode(arg) ? arg.fn : void 0, fn);
11517
+ const child = (arg) => parenthesizeLower(
11518
+ arg.toMathML(),
11519
+ isOperatorNode(arg) ? arg.fn : void 0,
11520
+ fn
11521
+ );
11576
11522
  if (args.length === 1) {
11577
11523
  const op = this.op === "-" || this.op === "+" ? this.op : escapeMathML(this.op);
11578
11524
  const operand = child(args[0]);
@@ -11659,9 +11605,7 @@ var createOperatorNode = /* @__PURE__ */ factory(
11659
11605
  }
11660
11606
  /**
11661
11607
  * Get identifier.
11662
- * @return {string}
11663
11608
  */
11664
- // @ts-expect-error - method overrides property from Node base class
11665
11609
  getIdentifier() {
11666
11610
  return this.type + ":" + this.fn;
11667
11611
  }
@@ -11684,7 +11628,7 @@ var createParenthesisNode = /* @__PURE__ */ factory(
11684
11628
  * @constructor ParenthesisNode
11685
11629
  * @extends {Node}
11686
11630
  * A parenthesis node describes manual parenthesis from the user input
11687
- * @param {Node} content
11631
+ * @param content
11688
11632
  * @extends {Node}
11689
11633
  */
11690
11634
  constructor(content) {
@@ -11705,31 +11649,29 @@ var createParenthesisNode = /* @__PURE__ */ factory(
11705
11649
  * Compile a node into a JavaScript function.
11706
11650
  * This basically pre-calculates as much as possible and only leaves open
11707
11651
  * calculations which depend on a dynamic scope with variables.
11708
- * @param {Object} math Math.js namespace with functions and constants.
11709
- * @param {Object} argNames An object with argument names as key and `true`
11652
+ * @param math - Math.js namespace with functions and constants.
11653
+ * @param argNames - An object with argument names as key and `true`
11710
11654
  * as value. Used in the SymbolNode to optimize
11711
11655
  * for arguments from user assigned functions
11712
11656
  * (see FunctionAssignmentNode) or special symbols
11713
11657
  * like `end` (see IndexNode).
11714
- * @return {function} Returns a function which can be called like:
11658
+ * @returns Returns a function which can be called like:
11715
11659
  * evalNode(scope: Object, args: Object, context: *)
11716
11660
  */
11717
- // @ts-expect-error - method overrides property from Node base class
11718
11661
  _compile(math, argNames) {
11719
11662
  return this.content._compile(math, argNames);
11720
11663
  }
11721
11664
  /**
11722
11665
  * Get the content of the current Node.
11723
- * @return {Node} content
11666
+ * @returns content
11724
11667
  * @override
11725
11668
  **/
11726
- // @ts-expect-error - method overrides property from Node base class
11727
11669
  getContent() {
11728
11670
  return this.content.getContent();
11729
11671
  }
11730
11672
  /**
11731
11673
  * Execute a callback for each of the child nodes of this node
11732
- * @param {function(child: Node, path: string, parent: Node)} callback
11674
+ * @param callback
11733
11675
  */
11734
11676
  forEach(callback) {
11735
11677
  callback(this.content, "content", this);
@@ -11737,8 +11679,8 @@ var createParenthesisNode = /* @__PURE__ */ factory(
11737
11679
  /**
11738
11680
  * Create a new ParenthesisNode whose child is the result of calling
11739
11681
  * the provided callback function on the child of this node.
11740
- * @param {function(child: Node, path: string, parent: Node) : Node} callback
11741
- * @returns {ParenthesisNode} Returns a clone of the node
11682
+ * @param callback
11683
+ * @returns Returns a clone of the node
11742
11684
  */
11743
11685
  map(callback) {
11744
11686
  const content = callback(this.content, "content", this);
@@ -11746,15 +11688,14 @@ var createParenthesisNode = /* @__PURE__ */ factory(
11746
11688
  }
11747
11689
  /**
11748
11690
  * Create a clone of this node, a shallow copy
11749
- * @return {ParenthesisNode}
11750
11691
  */
11751
11692
  clone() {
11752
11693
  return new ParenthesisNode(this.content);
11753
11694
  }
11754
11695
  /**
11755
11696
  * Get string representation
11756
- * @param {Object} options
11757
- * @return {string} str
11697
+ * @param options
11698
+ * @returns str
11758
11699
  * @override
11759
11700
  */
11760
11701
  _toString(options) {
@@ -11765,25 +11706,23 @@ var createParenthesisNode = /* @__PURE__ */ factory(
11765
11706
  }
11766
11707
  /**
11767
11708
  * Get a JSON representation of the node
11768
- * @returns {Object}
11769
11709
  */
11770
11710
  toJSON() {
11771
11711
  return { mathjs: name17, content: this.content };
11772
11712
  }
11773
11713
  /**
11774
11714
  * Instantiate an ParenthesisNode from its JSON representation
11775
- * @param {Object} json An object structured like
11715
+ * @param json - An object structured like
11776
11716
  * `{"mathjs": "ParenthesisNode", "content": ...}`,
11777
11717
  * where mathjs is optional
11778
- * @returns {ParenthesisNode}
11779
11718
  */
11780
11719
  static fromJSON(json) {
11781
11720
  return new ParenthesisNode(json.content);
11782
11721
  }
11783
11722
  /**
11784
11723
  * Get HTML representation
11785
- * @param {Object} options
11786
- * @return {string} str
11724
+ * @param options
11725
+ * @returns str
11787
11726
  * @override
11788
11727
  */
11789
11728
  _toHTML(options) {
@@ -11793,9 +11732,8 @@ var createParenthesisNode = /* @__PURE__ */ factory(
11793
11732
  return this.content.toHTML(options);
11794
11733
  }
11795
11734
  /**
11796
- * Get LaTeX representation
11797
- * @param {Object} options
11798
- * @return {string} str
11735
+ * Get the MathML representation of this node.
11736
+ * @returns str
11799
11737
  * @override
11800
11738
  */
11801
11739
  _toMathML() {
@@ -11841,10 +11779,11 @@ var createRangeNode = /* @__PURE__ */ factory(
11841
11779
  * @constructor RangeNode
11842
11780
  * @extends {Node}
11843
11781
  * create a range
11844
- * @param {Node} start included lower-bound
11845
- * @param {Node} end included upper-bound
11846
- * @param {Node} [step] optional step
11782
+ * @param start - included lower-bound
11783
+ * @param end - included upper-bound
11784
+ * @param step - optional step
11847
11785
  */
11786
+ // `step` may be null: toJSON() emits `step: null` for a range without one.
11848
11787
  constructor(start, end, step) {
11849
11788
  super();
11850
11789
  if (!isNode(start)) throw new TypeError("Node expected");
@@ -11865,7 +11804,6 @@ var createRangeNode = /* @__PURE__ */ factory(
11865
11804
  /**
11866
11805
  * Check whether the RangeNode needs the `end` symbol to be defined.
11867
11806
  * This end is the size of the Matrix in current dimension.
11868
- * @return {boolean}
11869
11807
  */
11870
11808
  needsEnd() {
11871
11809
  const endSymbols = this.filter(function(node) {
@@ -11877,16 +11815,15 @@ var createRangeNode = /* @__PURE__ */ factory(
11877
11815
  * Compile a node into a JavaScript function.
11878
11816
  * This basically pre-calculates as much as possible and only leaves open
11879
11817
  * calculations which depend on a dynamic scope with variables.
11880
- * @param {Object} math Math.js namespace with functions and constants.
11881
- * @param {Object} argNames An object with argument names as key and `true`
11818
+ * @param math - Math.js namespace with functions and constants.
11819
+ * @param argNames - An object with argument names as key and `true`
11882
11820
  * as value. Used in the SymbolNode to optimize
11883
11821
  * for arguments from user assigned functions
11884
11822
  * (see FunctionAssignmentNode) or special symbols
11885
11823
  * like `end` (see IndexNode).
11886
- * @return {function} Returns a function which can be called like:
11824
+ * @returns Returns a function which can be called like:
11887
11825
  * evalNode(scope: Object, args: Object, context: *)
11888
11826
  */
11889
- // @ts-expect-error - method overrides property from Node base class
11890
11827
  _compile(math, argNames) {
11891
11828
  const range = math.range;
11892
11829
  const evalStart = this.start._compile(math, argNames);
@@ -11908,7 +11845,7 @@ var createRangeNode = /* @__PURE__ */ factory(
11908
11845
  }
11909
11846
  /**
11910
11847
  * Execute a callback for each of the child nodes of this node
11911
- * @param {function(child: Node, path: string, parent: Node)} callback
11848
+ * @param callback
11912
11849
  */
11913
11850
  forEach(callback) {
11914
11851
  callback(this.start, "start", this);
@@ -11920,8 +11857,8 @@ var createRangeNode = /* @__PURE__ */ factory(
11920
11857
  /**
11921
11858
  * Create a new RangeNode whose children are the results of calling
11922
11859
  * the provided callback function for each child of the original node.
11923
- * @param {function(child: Node, path: string, parent: Node): Node} callback
11924
- * @returns {RangeNode} Returns a transformed copy of the node
11860
+ * @param callback
11861
+ * @returns Returns a transformed copy of the node
11925
11862
  */
11926
11863
  map(callback) {
11927
11864
  return new RangeNode(
@@ -11932,15 +11869,14 @@ var createRangeNode = /* @__PURE__ */ factory(
11932
11869
  }
11933
11870
  /**
11934
11871
  * Create a clone of this node, a shallow copy
11935
- * @return {RangeNode}
11936
11872
  */
11937
11873
  clone() {
11938
11874
  return new RangeNode(this.start, this.end, this.step || void 0);
11939
11875
  }
11940
11876
  /**
11941
11877
  * Get string representation
11942
- * @param {Object} options
11943
- * @return {string} str
11878
+ * @param options
11879
+ * @returns str
11944
11880
  */
11945
11881
  _toString(options) {
11946
11882
  const parenthesis = options && options.parenthesis ? options.parenthesis : "keep";
@@ -11971,7 +11907,6 @@ var createRangeNode = /* @__PURE__ */ factory(
11971
11907
  }
11972
11908
  /**
11973
11909
  * Get a JSON representation of the node
11974
- * @returns {Object}
11975
11910
  */
11976
11911
  toJSON() {
11977
11912
  return {
@@ -11983,19 +11918,18 @@ var createRangeNode = /* @__PURE__ */ factory(
11983
11918
  }
11984
11919
  /**
11985
11920
  * Instantiate an RangeNode from its JSON representation
11986
- * @param {Object} json
11921
+ * @param json
11987
11922
  * An object structured like
11988
11923
  * `{"mathjs": "RangeNode", "start": ..., "end": ..., "step": ...}`,
11989
11924
  * where mathjs is optional
11990
- * @returns {RangeNode}
11991
11925
  */
11992
11926
  static fromJSON(json) {
11993
11927
  return new RangeNode(json.start, json.end, json.step);
11994
11928
  }
11995
11929
  /**
11996
11930
  * Get HTML representation
11997
- * @param {Object} options
11998
- * @return {string} str
11931
+ * @param options
11932
+ * @returns str
11999
11933
  */
12000
11934
  _toHTML(options) {
12001
11935
  const parenthesis = options && options.parenthesis ? options.parenthesis : "keep";
@@ -12027,7 +11961,7 @@ var createRangeNode = /* @__PURE__ */ factory(
12027
11961
  /**
12028
11962
  * Get LaTeX representation
12029
11963
  * @params {Object} options
12030
- * @return {string} str
11964
+ * @returns str
12031
11965
  */
12032
11966
  _toTex(options) {
12033
11967
  const parenthesis = options && options.parenthesis ? options.parenthesis : "keep";
@@ -12081,9 +12015,9 @@ var createRelationalNode = /* @__PURE__ */ factory(
12081
12015
  /**
12082
12016
  * A node representing a chained conditional expression, such as 'x > y > z'
12083
12017
  *
12084
- * @param {String[]} conditionals
12018
+ * @param conditionals
12085
12019
  * An array of conditional operators used to compare the parameters
12086
- * @param {Node[]} params
12020
+ * @param params
12087
12021
  * The parameters that will be compared
12088
12022
  *
12089
12023
  * @constructor RelationalNode
@@ -12116,19 +12050,20 @@ var createRelationalNode = /* @__PURE__ */ factory(
12116
12050
  * Compile a node into a JavaScript function.
12117
12051
  * This basically pre-calculates as much as possible and only leaves open
12118
12052
  * calculations which depend on a dynamic scope with variables.
12119
- * @param {Object} math Math.js namespace with functions and constants.
12120
- * @param {Object} argNames An object with argument names as key and `true`
12053
+ * @param math - Math.js namespace with functions and constants.
12054
+ * @param argNames - An object with argument names as key and `true`
12121
12055
  * as value. Used in the SymbolNode to optimize
12122
12056
  * for arguments from user assigned functions
12123
12057
  * (see FunctionAssignmentNode) or special symbols
12124
12058
  * like `end` (see IndexNode).
12125
- * @return {function} Returns a function which can be called like:
12059
+ * @returns Returns a function which can be called like:
12126
12060
  * evalNode(scope: Object, args: Object, context: *)
12127
12061
  */
12128
- // @ts-expect-error - method overrides property from Node base class
12129
12062
  _compile(math, argNames) {
12130
12063
  const conditionals = this.conditionals;
12131
- const compiled = this.params.map((p) => p._compile(math, argNames));
12064
+ const compiled = this.params.map(
12065
+ (p) => p._compile(math, argNames)
12066
+ );
12132
12067
  return function evalRelationalNode(scope, args, context) {
12133
12068
  let evalLhs;
12134
12069
  let evalRhs = compiled[0](scope, args, context);
@@ -12145,16 +12080,19 @@ var createRelationalNode = /* @__PURE__ */ factory(
12145
12080
  }
12146
12081
  /**
12147
12082
  * Execute a callback for each of the child nodes of this node
12148
- * @param {function(child: Node, path: string, parent: Node)} callback
12083
+ * @param callback
12149
12084
  */
12150
12085
  forEach(callback) {
12151
- this.params.forEach((n, i) => callback(n, "params[" + i + "]", this), this);
12086
+ this.params.forEach(
12087
+ (n, i) => callback(n, "params[" + i + "]", this),
12088
+ this
12089
+ );
12152
12090
  }
12153
12091
  /**
12154
12092
  * Create a new RelationalNode whose children are the results of calling
12155
12093
  * the provided callback function for each child of the original node.
12156
- * @param {function(child: Node, path: string, parent: Node): Node} callback
12157
- * @returns {RelationalNode} Returns a transformed copy of the node
12094
+ * @param callback
12095
+ * @returns Returns a transformed copy of the node
12158
12096
  */
12159
12097
  map(callback) {
12160
12098
  return new RelationalNode(
@@ -12167,15 +12105,14 @@ var createRelationalNode = /* @__PURE__ */ factory(
12167
12105
  }
12168
12106
  /**
12169
12107
  * Create a clone of this node, a shallow copy
12170
- * @return {RelationalNode}
12171
12108
  */
12172
12109
  clone() {
12173
12110
  return new RelationalNode(this.conditionals, this.params);
12174
12111
  }
12175
12112
  /**
12176
12113
  * Get string representation.
12177
- * @param {Object} options
12178
- * @return {string} str
12114
+ * @param options
12115
+ * @returns str
12179
12116
  */
12180
12117
  _toString(options) {
12181
12118
  const parenthesis = options && options.parenthesis ? options.parenthesis : "keep";
@@ -12203,7 +12140,6 @@ var createRelationalNode = /* @__PURE__ */ factory(
12203
12140
  }
12204
12141
  /**
12205
12142
  * Get a JSON representation of the node
12206
- * @returns {Object}
12207
12143
  */
12208
12144
  toJSON() {
12209
12145
  return {
@@ -12214,19 +12150,18 @@ var createRelationalNode = /* @__PURE__ */ factory(
12214
12150
  }
12215
12151
  /**
12216
12152
  * Instantiate a RelationalNode from its JSON representation
12217
- * @param {Object} json
12153
+ * @param json
12218
12154
  * An object structured like
12219
12155
  * `{"mathjs": "RelationalNode", "conditionals": ..., "params": ...}`,
12220
12156
  * where mathjs is optional
12221
- * @returns {RelationalNode}
12222
12157
  */
12223
12158
  static fromJSON(json) {
12224
12159
  return new RelationalNode(json.conditionals, json.params);
12225
12160
  }
12226
12161
  /**
12227
12162
  * Get HTML representation
12228
- * @param {Object} options
12229
- * @return {string} str
12163
+ * @param options
12164
+ * @returns str
12230
12165
  */
12231
12166
  _toHTML(options) {
12232
12167
  const parenthesis = options && options.parenthesis ? options.parenthesis : "keep";
@@ -12252,9 +12187,8 @@ var createRelationalNode = /* @__PURE__ */ factory(
12252
12187
  return ret;
12253
12188
  }
12254
12189
  /**
12255
- * Get LaTeX representation
12256
- * @param {Object} options
12257
- * @return {string} str
12190
+ * Get the MathML representation of this node.
12191
+ * @returns str
12258
12192
  */
12259
12193
  _toMathML() {
12260
12194
  const params = this.params;
@@ -12313,7 +12247,7 @@ var createSymbolNode = /* @__PURE__ */ factory(
12313
12247
  * @constructor SymbolNode
12314
12248
  * @extends {Node}
12315
12249
  * A symbol node can hold and resolve a symbol
12316
- * @param {string} name
12250
+ * @param name
12317
12251
  * @extends {Node}
12318
12252
  */
12319
12253
  constructor(name47) {
@@ -12333,13 +12267,13 @@ var createSymbolNode = /* @__PURE__ */ factory(
12333
12267
  * Compile a node into a JavaScript function.
12334
12268
  * This basically pre-calculates as much as possible and only leaves open
12335
12269
  * calculations which depend on a dynamic scope with variables.
12336
- * @param {Object} math Math.js namespace with functions and constants.
12337
- * @param {Object} argNames An object with argument names as key and `true`
12270
+ * @param math - Math.js namespace with functions and constants.
12271
+ * @param argNames - An object with argument names as key and `true`
12338
12272
  * as value. Used in the SymbolNode to optimize
12339
12273
  * for arguments from user assigned functions
12340
12274
  * (see FunctionAssignmentNode) or special symbols
12341
12275
  * like `end` (see IndexNode).
12342
- * @return {function} Returns a function which can be called like:
12276
+ * @returns Returns a function which can be called like:
12343
12277
  * evalNode(scope: Object, args: Object, context: *)
12344
12278
  */
12345
12279
  _compile(math2, argNames) {
@@ -12361,38 +12295,36 @@ var createSymbolNode = /* @__PURE__ */ factory(
12361
12295
  }
12362
12296
  /**
12363
12297
  * Execute a callback for each of the child nodes of this node
12364
- * @param {function(child: Node, path: string, parent: Node)} callback
12298
+ * @param _callback
12365
12299
  */
12366
12300
  forEach(_callback) {
12367
12301
  }
12368
12302
  /**
12369
12303
  * Create a new SymbolNode with children produced by the given callback.
12370
12304
  * Trivial since a SymbolNode has no children
12371
- * @param {function(child: Node, path: string, parent: Node) : Node} callback
12372
- * @returns {SymbolNode} Returns a clone of the node
12305
+ * @param _callback
12306
+ * @returns Returns a clone of the node
12373
12307
  */
12374
12308
  map(_callback) {
12375
12309
  return this.clone();
12376
12310
  }
12377
12311
  /**
12378
12312
  * Throws an error 'Undefined symbol {name}'
12379
- * @param {string} name
12313
+ * @param name
12380
12314
  */
12381
12315
  static onUndefinedSymbol(name47) {
12382
12316
  throw new Error("Undefined symbol " + name47);
12383
12317
  }
12384
12318
  /**
12385
12319
  * Create a clone of this node, a shallow copy
12386
- * @return {SymbolNode}
12387
12320
  */
12388
- // @ts-expect-error - method overrides property from Node base class
12389
12321
  clone() {
12390
12322
  return new SymbolNode(this.name);
12391
12323
  }
12392
12324
  /**
12393
12325
  * Get string representation
12394
- * @param {Object} options
12395
- * @return {string} str
12326
+ * @param _options
12327
+ * @returns str
12396
12328
  * @override
12397
12329
  */
12398
12330
  _toString(_options) {
@@ -12400,8 +12332,8 @@ var createSymbolNode = /* @__PURE__ */ factory(
12400
12332
  }
12401
12333
  /**
12402
12334
  * Get HTML representation
12403
- * @param {Object} options
12404
- * @return {string} str
12335
+ * @param _options
12336
+ * @returns str
12405
12337
  * @override
12406
12338
  */
12407
12339
  _toHTML(_options) {
@@ -12423,7 +12355,6 @@ var createSymbolNode = /* @__PURE__ */ factory(
12423
12355
  }
12424
12356
  /**
12425
12357
  * Get a JSON representation of the node
12426
- * @returns {Object}
12427
12358
  */
12428
12359
  toJSON() {
12429
12360
  return {
@@ -12433,18 +12364,16 @@ var createSymbolNode = /* @__PURE__ */ factory(
12433
12364
  }
12434
12365
  /**
12435
12366
  * Instantiate a SymbolNode from its JSON representation
12436
- * @param {Object} json An object structured like
12367
+ * @param json - An object structured like
12437
12368
  * `{"mathjs": "SymbolNode", name: "x"}`,
12438
12369
  * where mathjs is optional
12439
- * @returns {SymbolNode}
12440
12370
  */
12441
12371
  static fromJSON(json) {
12442
12372
  return new SymbolNode(json.name);
12443
12373
  }
12444
12374
  /**
12445
- * Get LaTeX representation
12446
- * @param {Object} options
12447
- * @return {string} str
12375
+ * Get the MathML representation of this node.
12376
+ * @returns str
12448
12377
  * @override
12449
12378
  */
12450
12379
  _toMathML() {