@danielsimonjr/mathts-expression 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +42 -42
  2. package/dist/index.js +261 -333
  3. package/dist/node/AccessorNode.d.ts +121 -132
  4. package/dist/node/AccessorNode.d.ts.map +1 -1
  5. package/dist/node/ArrayNode.d.ts +25 -30
  6. package/dist/node/ArrayNode.d.ts.map +1 -1
  7. package/dist/node/AssignmentNode.d.ts +19 -32
  8. package/dist/node/AssignmentNode.d.ts.map +1 -1
  9. package/dist/node/BlockNode.d.ts +121 -126
  10. package/dist/node/BlockNode.d.ts.map +1 -1
  11. package/dist/node/ConditionalNode.d.ts +25 -30
  12. package/dist/node/ConditionalNode.d.ts.map +1 -1
  13. package/dist/node/ConstantNode.d.ts +93 -100
  14. package/dist/node/ConstantNode.d.ts.map +1 -1
  15. package/dist/node/FunctionAssignmentNode.d.ts +25 -30
  16. package/dist/node/FunctionAssignmentNode.d.ts.map +1 -1
  17. package/dist/node/FunctionNode.d.ts +32 -43
  18. package/dist/node/FunctionNode.d.ts.map +1 -1
  19. package/dist/node/IndexNode.d.ts +25 -34
  20. package/dist/node/IndexNode.d.ts.map +1 -1
  21. package/dist/node/Node.d.ts +41 -38
  22. package/dist/node/Node.d.ts.map +1 -1
  23. package/dist/node/ObjectNode.d.ts +25 -30
  24. package/dist/node/ObjectNode.d.ts.map +1 -1
  25. package/dist/node/OperatorNode.d.ts +29 -42
  26. package/dist/node/OperatorNode.d.ts.map +1 -1
  27. package/dist/node/ParenthesisNode.d.ts +27 -34
  28. package/dist/node/ParenthesisNode.d.ts.map +1 -1
  29. package/dist/node/RangeNode.d.ts +23 -30
  30. package/dist/node/RangeNode.d.ts.map +1 -1
  31. package/dist/node/RelationalNode.d.ts +25 -32
  32. package/dist/node/RelationalNode.d.ts.map +1 -1
  33. package/dist/node/SymbolNode.d.ts +26 -33
  34. package/dist/node/SymbolNode.d.ts.map +1 -1
  35. package/dist/node/utils/access.d.ts +7 -0
  36. package/dist/node/utils/access.d.ts.map +1 -1
  37. package/dist/node/utils/assign.d.ts +8 -0
  38. package/dist/node/utils/assign.d.ts.map +1 -1
  39. package/dist/node/utils/stringSubset.d.ts +8 -8
  40. package/dist/operators.d.ts +12 -15
  41. package/dist/operators.d.ts.map +1 -1
  42. package/dist/parse.d.ts.map +1 -1
  43. package/dist/transform/utils/dimToZeroBase.d.ts +4 -0
  44. package/dist/transform/utils/dimToZeroBase.d.ts.map +1 -1
  45. package/dist/types.d.ts +8 -0
  46. package/dist/types.d.ts.map +1 -1
  47. package/dist/utils/is.d.ts +273 -3
  48. package/dist/utils/is.d.ts.map +1 -1
  49. package/dist/utils/latex.d.ts +12 -0
  50. package/dist/utils/latex.d.ts.map +1 -1
  51. package/package.json +59 -59
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,13 +10734,13 @@ 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
10746
  // @ts-expect-error - method overrides property from Node base class
@@ -10827,7 +10782,7 @@ var createIndexNode = /* @__PURE__ */ factory(
10827
10782
  }
10828
10783
  /**
10829
10784
  * Execute a callback for each of the child nodes of this node
10830
- * @param {function(child: Node, path: string, parent: Node)} callback
10785
+ * @param callback
10831
10786
  */
10832
10787
  forEach(callback) {
10833
10788
  for (let i = 0; i < this.dimensions.length; i++) {
@@ -10837,8 +10792,8 @@ var createIndexNode = /* @__PURE__ */ factory(
10837
10792
  /**
10838
10793
  * Create a new IndexNode whose children are the results of calling
10839
10794
  * 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
10795
+ * @param callback
10796
+ * @returns Returns a transformed copy of the node
10842
10797
  */
10843
10798
  map(callback) {
10844
10799
  const dimensions = [];
@@ -10849,14 +10804,12 @@ var createIndexNode = /* @__PURE__ */ factory(
10849
10804
  }
10850
10805
  /**
10851
10806
  * Create a clone of this node, a shallow copy
10852
- * @return {IndexNode}
10853
10807
  */
10854
10808
  clone() {
10855
10809
  return new IndexNode(this.dimensions.slice(0), this.dotNotation);
10856
10810
  }
10857
10811
  /**
10858
10812
  * Test whether this IndexNode contains a single property name
10859
- * @return {boolean}
10860
10813
  */
10861
10814
  isObjectProperty() {
10862
10815
  return this.dimensions.length === 1 && isConstantNode(this.dimensions[0]) && typeof this.dimensions[0].value === "string";
@@ -10864,22 +10817,20 @@ var createIndexNode = /* @__PURE__ */ factory(
10864
10817
  /**
10865
10818
  * Returns the property name if IndexNode contains a property.
10866
10819
  * If not, returns null.
10867
- * @return {string | null}
10868
10820
  */
10869
10821
  getObjectProperty() {
10870
10822
  return this.isObjectProperty() ? this.dimensions[0].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,13 +10919,13 @@ 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
10931
  // @ts-expect-error - method overrides property from Node base class
@@ -11001,7 +10951,7 @@ var createObjectNode = /* @__PURE__ */ factory(
11001
10951
  }
11002
10952
  /**
11003
10953
  * Execute a callback for each of the child nodes of this node
11004
- * @param {function(child: Node, path: string, parent: Node)} callback
10954
+ * @param callback
11005
10955
  */
11006
10956
  forEach(callback) {
11007
10957
  for (const key in this.properties) {
@@ -11013,8 +10963,8 @@ var createObjectNode = /* @__PURE__ */ factory(
11013
10963
  /**
11014
10964
  * Create a new ObjectNode whose children are the results of calling
11015
10965
  * 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
10966
+ * @param callback
10967
+ * @returns Returns a transformed copy of the node
11018
10968
  */
11019
10969
  map(callback) {
11020
10970
  const properties2 = {};
@@ -11029,7 +10979,6 @@ var createObjectNode = /* @__PURE__ */ factory(
11029
10979
  }
11030
10980
  /**
11031
10981
  * Create a clone of this node, a shallow copy
11032
- * @return {ObjectNode}
11033
10982
  */
11034
10983
  clone() {
11035
10984
  const properties2 = {};
@@ -11042,8 +10991,8 @@ var createObjectNode = /* @__PURE__ */ factory(
11042
10991
  }
11043
10992
  /**
11044
10993
  * Get string representation
11045
- * @param {Object} options
11046
- * @return {string} str
10994
+ * @param options
10995
+ * @returns str
11047
10996
  * @override
11048
10997
  */
11049
10998
  _toString(options) {
@@ -11057,7 +11006,6 @@ var createObjectNode = /* @__PURE__ */ factory(
11057
11006
  }
11058
11007
  /**
11059
11008
  * Get a JSON representation of the node
11060
- * @returns {Object}
11061
11009
  */
11062
11010
  toJSON() {
11063
11011
  return {
@@ -11067,18 +11015,17 @@ var createObjectNode = /* @__PURE__ */ factory(
11067
11015
  }
11068
11016
  /**
11069
11017
  * Instantiate an OperatorNode from its JSON representation
11070
- * @param {Object} json An object structured like
11018
+ * @param json - An object structured like
11071
11019
  * `{"mathjs": "ObjectNode", "properties": {...}}`,
11072
11020
  * where mathjs is optional
11073
- * @returns {ObjectNode}
11074
11021
  */
11075
11022
  static fromJSON(json) {
11076
11023
  return new ObjectNode(json.properties);
11077
11024
  }
11078
11025
  /**
11079
11026
  * Get HTML representation
11080
- * @param {Object} options
11081
- * @return {string} str
11027
+ * @param options
11028
+ * @returns str
11082
11029
  * @override
11083
11030
  */
11084
11031
  _toHTML(options) {
@@ -11094,8 +11041,8 @@ var createObjectNode = /* @__PURE__ */ factory(
11094
11041
  }
11095
11042
  /**
11096
11043
  * Get LaTeX representation
11097
- * @param {Object} options
11098
- * @return {string} str
11044
+ * @param options
11045
+ * @returns str
11099
11046
  */
11100
11047
  _toTex(options) {
11101
11048
  const entries = [];
@@ -11285,11 +11232,11 @@ var createOperatorNode = /* @__PURE__ */ factory(
11285
11232
  * @extends {Node}
11286
11233
  * An operator with two arguments, like 2+3
11287
11234
  *
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?
11235
+ * @param op - Operator name, for example '+'
11236
+ * @param fn - Function name, for example 'add'
11237
+ * @param args - Operator arguments
11238
+ * @param implicit - Optional. Is this an implicit multiplication?
11239
+ * @param isPercentage - Optional. Is this an percentage Operation?
11293
11240
  */
11294
11241
  constructor(op, fn, args, implicit, isPercentage) {
11295
11242
  super();
@@ -11319,13 +11266,13 @@ var createOperatorNode = /* @__PURE__ */ factory(
11319
11266
  * Compile a node into a JavaScript function.
11320
11267
  * This basically pre-calculates as much as possible and only leaves open
11321
11268
  * 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`
11269
+ * @param math - Math.js namespace with functions and constants.
11270
+ * @param argNames - An object with argument names as key and `true`
11324
11271
  * as value. Used in the SymbolNode to optimize
11325
11272
  * for arguments from user assigned functions
11326
11273
  * (see FunctionAssignmentNode) or special symbols
11327
11274
  * like `end` (see IndexNode).
11328
- * @return {function} Returns a function which can be called like:
11275
+ * @returns Returns a function which can be called like:
11329
11276
  * evalNode(scope: Object, args: Object, context: *)
11330
11277
  */
11331
11278
  // @ts-expect-error - method overrides property from Node base class
@@ -11369,7 +11316,7 @@ var createOperatorNode = /* @__PURE__ */ factory(
11369
11316
  }
11370
11317
  /**
11371
11318
  * Execute a callback for each of the child nodes of this node
11372
- * @param {function(child: Node, path: string, parent: Node)} callback
11319
+ * @param callback
11373
11320
  */
11374
11321
  forEach(callback) {
11375
11322
  for (let i = 0; i < this.args.length; i++) {
@@ -11379,8 +11326,8 @@ var createOperatorNode = /* @__PURE__ */ factory(
11379
11326
  /**
11380
11327
  * Create a new OperatorNode whose children are the results of calling
11381
11328
  * 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
11329
+ * @param callback
11330
+ * @returns Returns a transformed copy of the node
11384
11331
  */
11385
11332
  map(callback) {
11386
11333
  const args = [];
@@ -11391,7 +11338,6 @@ var createOperatorNode = /* @__PURE__ */ factory(
11391
11338
  }
11392
11339
  /**
11393
11340
  * Create a clone of this node, a shallow copy
11394
- * @return {OperatorNode}
11395
11341
  */
11396
11342
  clone() {
11397
11343
  return new OperatorNode(
@@ -11405,8 +11351,7 @@ var createOperatorNode = /* @__PURE__ */ factory(
11405
11351
  /**
11406
11352
  * Check whether this is an unary OperatorNode:
11407
11353
  * has exactly one argument, like `-a`.
11408
- * @return {boolean}
11409
- * Returns true when an unary operator node, false otherwise.
11354
+ * @returns `true` when an unary operator node, `false` otherwise.
11410
11355
  */
11411
11356
  isUnary() {
11412
11357
  return this.args.length === 1;
@@ -11414,16 +11359,15 @@ var createOperatorNode = /* @__PURE__ */ factory(
11414
11359
  /**
11415
11360
  * Check whether this is a binary OperatorNode:
11416
11361
  * has exactly two arguments, like `a + b`.
11417
- * @return {boolean}
11418
- * Returns true when a binary operator node, false otherwise.
11362
+ * @returns `true` when a binary operator node, `false` otherwise.
11419
11363
  */
11420
11364
  isBinary() {
11421
11365
  return this.args.length === 2;
11422
11366
  }
11423
11367
  /**
11424
11368
  * Get string representation.
11425
- * @param {Object} options
11426
- * @return {string} str
11369
+ * @param options
11370
+ * @returns str
11427
11371
  */
11428
11372
  _toString(options) {
11429
11373
  const parenthesis = options && options.parenthesis ? options.parenthesis : "keep";
@@ -11474,7 +11418,6 @@ var createOperatorNode = /* @__PURE__ */ factory(
11474
11418
  }
11475
11419
  /**
11476
11420
  * Get a JSON representation of the node
11477
- * @returns {Object}
11478
11421
  */
11479
11422
  toJSON() {
11480
11423
  return {
@@ -11488,7 +11431,7 @@ var createOperatorNode = /* @__PURE__ */ factory(
11488
11431
  }
11489
11432
  /**
11490
11433
  * Instantiate an OperatorNode from its JSON representation
11491
- * @param {Object} json
11434
+ * @param json
11492
11435
  * An object structured like
11493
11436
  * ```
11494
11437
  * {"mathjs": "OperatorNode",
@@ -11497,15 +11440,14 @@ var createOperatorNode = /* @__PURE__ */ factory(
11497
11440
  * "isPercentage":false}
11498
11441
  * ```
11499
11442
  * where mathjs is optional
11500
- * @returns {OperatorNode}
11501
11443
  */
11502
11444
  static fromJSON(json) {
11503
11445
  return new OperatorNode(json.op, json.fn, json.args, json.implicit, json.isPercentage);
11504
11446
  }
11505
11447
  /**
11506
11448
  * Get HTML representation.
11507
- * @param {Object} options
11508
- * @return {string} str
11449
+ * @param options
11450
+ * @returns str
11509
11451
  */
11510
11452
  _toHTML(options) {
11511
11453
  const parenthesis = options && options.parenthesis ? options.parenthesis : "keep";
@@ -11559,9 +11501,8 @@ var createOperatorNode = /* @__PURE__ */ factory(
11559
11501
  }
11560
11502
  }
11561
11503
  /**
11562
- * Get LaTeX representation
11563
- * @param {Object} options
11564
- * @return {string} str
11504
+ * Get the MathML representation of this node.
11505
+ * @returns str
11565
11506
  */
11566
11507
  _toMathML() {
11567
11508
  const fn = this.fn;
@@ -11572,7 +11513,11 @@ var createOperatorNode = /* @__PURE__ */ factory(
11572
11513
  if (fn === "pow" && args.length === 2) {
11573
11514
  return `<msup><mrow>${args[0].toMathML()}</mrow><mrow>${args[1].toMathML()}</mrow></msup>`;
11574
11515
  }
11575
- const child = (arg) => parenthesizeLower(arg.toMathML(), isOperatorNode(arg) ? arg.fn : void 0, fn);
11516
+ const child = (arg) => parenthesizeLower(
11517
+ arg.toMathML(),
11518
+ isOperatorNode(arg) ? arg.fn : void 0,
11519
+ fn
11520
+ );
11576
11521
  if (args.length === 1) {
11577
11522
  const op = this.op === "-" || this.op === "+" ? this.op : escapeMathML(this.op);
11578
11523
  const operand = child(args[0]);
@@ -11659,7 +11604,6 @@ var createOperatorNode = /* @__PURE__ */ factory(
11659
11604
  }
11660
11605
  /**
11661
11606
  * Get identifier.
11662
- * @return {string}
11663
11607
  */
11664
11608
  // @ts-expect-error - method overrides property from Node base class
11665
11609
  getIdentifier() {
@@ -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,13 +11649,13 @@ 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
11661
  // @ts-expect-error - method overrides property from Node base class
@@ -11720,7 +11664,7 @@ var createParenthesisNode = /* @__PURE__ */ factory(
11720
11664
  }
11721
11665
  /**
11722
11666
  * Get the content of the current Node.
11723
- * @return {Node} content
11667
+ * @returns content
11724
11668
  * @override
11725
11669
  **/
11726
11670
  // @ts-expect-error - method overrides property from Node base class
@@ -11729,7 +11673,7 @@ var createParenthesisNode = /* @__PURE__ */ factory(
11729
11673
  }
11730
11674
  /**
11731
11675
  * Execute a callback for each of the child nodes of this node
11732
- * @param {function(child: Node, path: string, parent: Node)} callback
11676
+ * @param callback
11733
11677
  */
11734
11678
  forEach(callback) {
11735
11679
  callback(this.content, "content", this);
@@ -11737,8 +11681,8 @@ var createParenthesisNode = /* @__PURE__ */ factory(
11737
11681
  /**
11738
11682
  * Create a new ParenthesisNode whose child is the result of calling
11739
11683
  * 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
11684
+ * @param callback
11685
+ * @returns Returns a clone of the node
11742
11686
  */
11743
11687
  map(callback) {
11744
11688
  const content = callback(this.content, "content", this);
@@ -11746,15 +11690,14 @@ var createParenthesisNode = /* @__PURE__ */ factory(
11746
11690
  }
11747
11691
  /**
11748
11692
  * Create a clone of this node, a shallow copy
11749
- * @return {ParenthesisNode}
11750
11693
  */
11751
11694
  clone() {
11752
11695
  return new ParenthesisNode(this.content);
11753
11696
  }
11754
11697
  /**
11755
11698
  * Get string representation
11756
- * @param {Object} options
11757
- * @return {string} str
11699
+ * @param options
11700
+ * @returns str
11758
11701
  * @override
11759
11702
  */
11760
11703
  _toString(options) {
@@ -11765,25 +11708,23 @@ var createParenthesisNode = /* @__PURE__ */ factory(
11765
11708
  }
11766
11709
  /**
11767
11710
  * Get a JSON representation of the node
11768
- * @returns {Object}
11769
11711
  */
11770
11712
  toJSON() {
11771
11713
  return { mathjs: name17, content: this.content };
11772
11714
  }
11773
11715
  /**
11774
11716
  * Instantiate an ParenthesisNode from its JSON representation
11775
- * @param {Object} json An object structured like
11717
+ * @param json - An object structured like
11776
11718
  * `{"mathjs": "ParenthesisNode", "content": ...}`,
11777
11719
  * where mathjs is optional
11778
- * @returns {ParenthesisNode}
11779
11720
  */
11780
11721
  static fromJSON(json) {
11781
11722
  return new ParenthesisNode(json.content);
11782
11723
  }
11783
11724
  /**
11784
11725
  * Get HTML representation
11785
- * @param {Object} options
11786
- * @return {string} str
11726
+ * @param options
11727
+ * @returns str
11787
11728
  * @override
11788
11729
  */
11789
11730
  _toHTML(options) {
@@ -11793,9 +11734,8 @@ var createParenthesisNode = /* @__PURE__ */ factory(
11793
11734
  return this.content.toHTML(options);
11794
11735
  }
11795
11736
  /**
11796
- * Get LaTeX representation
11797
- * @param {Object} options
11798
- * @return {string} str
11737
+ * Get the MathML representation of this node.
11738
+ * @returns str
11799
11739
  * @override
11800
11740
  */
11801
11741
  _toMathML() {
@@ -11841,9 +11781,9 @@ var createRangeNode = /* @__PURE__ */ factory(
11841
11781
  * @constructor RangeNode
11842
11782
  * @extends {Node}
11843
11783
  * create a range
11844
- * @param {Node} start included lower-bound
11845
- * @param {Node} end included upper-bound
11846
- * @param {Node} [step] optional step
11784
+ * @param start - included lower-bound
11785
+ * @param end - included upper-bound
11786
+ * @param step - optional step
11847
11787
  */
11848
11788
  constructor(start, end, step) {
11849
11789
  super();
@@ -11865,7 +11805,6 @@ var createRangeNode = /* @__PURE__ */ factory(
11865
11805
  /**
11866
11806
  * Check whether the RangeNode needs the `end` symbol to be defined.
11867
11807
  * This end is the size of the Matrix in current dimension.
11868
- * @return {boolean}
11869
11808
  */
11870
11809
  needsEnd() {
11871
11810
  const endSymbols = this.filter(function(node) {
@@ -11877,13 +11816,13 @@ var createRangeNode = /* @__PURE__ */ factory(
11877
11816
  * Compile a node into a JavaScript function.
11878
11817
  * This basically pre-calculates as much as possible and only leaves open
11879
11818
  * 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`
11819
+ * @param math - Math.js namespace with functions and constants.
11820
+ * @param argNames - An object with argument names as key and `true`
11882
11821
  * as value. Used in the SymbolNode to optimize
11883
11822
  * for arguments from user assigned functions
11884
11823
  * (see FunctionAssignmentNode) or special symbols
11885
11824
  * like `end` (see IndexNode).
11886
- * @return {function} Returns a function which can be called like:
11825
+ * @returns Returns a function which can be called like:
11887
11826
  * evalNode(scope: Object, args: Object, context: *)
11888
11827
  */
11889
11828
  // @ts-expect-error - method overrides property from Node base class
@@ -11908,7 +11847,7 @@ var createRangeNode = /* @__PURE__ */ factory(
11908
11847
  }
11909
11848
  /**
11910
11849
  * Execute a callback for each of the child nodes of this node
11911
- * @param {function(child: Node, path: string, parent: Node)} callback
11850
+ * @param callback
11912
11851
  */
11913
11852
  forEach(callback) {
11914
11853
  callback(this.start, "start", this);
@@ -11920,8 +11859,8 @@ var createRangeNode = /* @__PURE__ */ factory(
11920
11859
  /**
11921
11860
  * Create a new RangeNode whose children are the results of calling
11922
11861
  * 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
11862
+ * @param callback
11863
+ * @returns Returns a transformed copy of the node
11925
11864
  */
11926
11865
  map(callback) {
11927
11866
  return new RangeNode(
@@ -11932,15 +11871,14 @@ var createRangeNode = /* @__PURE__ */ factory(
11932
11871
  }
11933
11872
  /**
11934
11873
  * Create a clone of this node, a shallow copy
11935
- * @return {RangeNode}
11936
11874
  */
11937
11875
  clone() {
11938
11876
  return new RangeNode(this.start, this.end, this.step || void 0);
11939
11877
  }
11940
11878
  /**
11941
11879
  * Get string representation
11942
- * @param {Object} options
11943
- * @return {string} str
11880
+ * @param options
11881
+ * @returns str
11944
11882
  */
11945
11883
  _toString(options) {
11946
11884
  const parenthesis = options && options.parenthesis ? options.parenthesis : "keep";
@@ -11971,7 +11909,6 @@ var createRangeNode = /* @__PURE__ */ factory(
11971
11909
  }
11972
11910
  /**
11973
11911
  * Get a JSON representation of the node
11974
- * @returns {Object}
11975
11912
  */
11976
11913
  toJSON() {
11977
11914
  return {
@@ -11983,19 +11920,18 @@ var createRangeNode = /* @__PURE__ */ factory(
11983
11920
  }
11984
11921
  /**
11985
11922
  * Instantiate an RangeNode from its JSON representation
11986
- * @param {Object} json
11923
+ * @param json
11987
11924
  * An object structured like
11988
11925
  * `{"mathjs": "RangeNode", "start": ..., "end": ..., "step": ...}`,
11989
11926
  * where mathjs is optional
11990
- * @returns {RangeNode}
11991
11927
  */
11992
11928
  static fromJSON(json) {
11993
11929
  return new RangeNode(json.start, json.end, json.step);
11994
11930
  }
11995
11931
  /**
11996
11932
  * Get HTML representation
11997
- * @param {Object} options
11998
- * @return {string} str
11933
+ * @param options
11934
+ * @returns str
11999
11935
  */
12000
11936
  _toHTML(options) {
12001
11937
  const parenthesis = options && options.parenthesis ? options.parenthesis : "keep";
@@ -12027,7 +11963,7 @@ var createRangeNode = /* @__PURE__ */ factory(
12027
11963
  /**
12028
11964
  * Get LaTeX representation
12029
11965
  * @params {Object} options
12030
- * @return {string} str
11966
+ * @returns str
12031
11967
  */
12032
11968
  _toTex(options) {
12033
11969
  const parenthesis = options && options.parenthesis ? options.parenthesis : "keep";
@@ -12081,9 +12017,9 @@ var createRelationalNode = /* @__PURE__ */ factory(
12081
12017
  /**
12082
12018
  * A node representing a chained conditional expression, such as 'x > y > z'
12083
12019
  *
12084
- * @param {String[]} conditionals
12020
+ * @param conditionals
12085
12021
  * An array of conditional operators used to compare the parameters
12086
- * @param {Node[]} params
12022
+ * @param params
12087
12023
  * The parameters that will be compared
12088
12024
  *
12089
12025
  * @constructor RelationalNode
@@ -12116,13 +12052,13 @@ var createRelationalNode = /* @__PURE__ */ factory(
12116
12052
  * Compile a node into a JavaScript function.
12117
12053
  * This basically pre-calculates as much as possible and only leaves open
12118
12054
  * 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`
12055
+ * @param math - Math.js namespace with functions and constants.
12056
+ * @param argNames - An object with argument names as key and `true`
12121
12057
  * as value. Used in the SymbolNode to optimize
12122
12058
  * for arguments from user assigned functions
12123
12059
  * (see FunctionAssignmentNode) or special symbols
12124
12060
  * like `end` (see IndexNode).
12125
- * @return {function} Returns a function which can be called like:
12061
+ * @returns Returns a function which can be called like:
12126
12062
  * evalNode(scope: Object, args: Object, context: *)
12127
12063
  */
12128
12064
  // @ts-expect-error - method overrides property from Node base class
@@ -12145,7 +12081,7 @@ var createRelationalNode = /* @__PURE__ */ factory(
12145
12081
  }
12146
12082
  /**
12147
12083
  * Execute a callback for each of the child nodes of this node
12148
- * @param {function(child: Node, path: string, parent: Node)} callback
12084
+ * @param callback
12149
12085
  */
12150
12086
  forEach(callback) {
12151
12087
  this.params.forEach((n, i) => callback(n, "params[" + i + "]", this), this);
@@ -12153,8 +12089,8 @@ var createRelationalNode = /* @__PURE__ */ factory(
12153
12089
  /**
12154
12090
  * Create a new RelationalNode whose children are the results of calling
12155
12091
  * 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
12092
+ * @param callback
12093
+ * @returns Returns a transformed copy of the node
12158
12094
  */
12159
12095
  map(callback) {
12160
12096
  return new RelationalNode(
@@ -12167,15 +12103,14 @@ var createRelationalNode = /* @__PURE__ */ factory(
12167
12103
  }
12168
12104
  /**
12169
12105
  * Create a clone of this node, a shallow copy
12170
- * @return {RelationalNode}
12171
12106
  */
12172
12107
  clone() {
12173
12108
  return new RelationalNode(this.conditionals, this.params);
12174
12109
  }
12175
12110
  /**
12176
12111
  * Get string representation.
12177
- * @param {Object} options
12178
- * @return {string} str
12112
+ * @param options
12113
+ * @returns str
12179
12114
  */
12180
12115
  _toString(options) {
12181
12116
  const parenthesis = options && options.parenthesis ? options.parenthesis : "keep";
@@ -12203,7 +12138,6 @@ var createRelationalNode = /* @__PURE__ */ factory(
12203
12138
  }
12204
12139
  /**
12205
12140
  * Get a JSON representation of the node
12206
- * @returns {Object}
12207
12141
  */
12208
12142
  toJSON() {
12209
12143
  return {
@@ -12214,19 +12148,18 @@ var createRelationalNode = /* @__PURE__ */ factory(
12214
12148
  }
12215
12149
  /**
12216
12150
  * Instantiate a RelationalNode from its JSON representation
12217
- * @param {Object} json
12151
+ * @param json
12218
12152
  * An object structured like
12219
12153
  * `{"mathjs": "RelationalNode", "conditionals": ..., "params": ...}`,
12220
12154
  * where mathjs is optional
12221
- * @returns {RelationalNode}
12222
12155
  */
12223
12156
  static fromJSON(json) {
12224
12157
  return new RelationalNode(json.conditionals, json.params);
12225
12158
  }
12226
12159
  /**
12227
12160
  * Get HTML representation
12228
- * @param {Object} options
12229
- * @return {string} str
12161
+ * @param options
12162
+ * @returns str
12230
12163
  */
12231
12164
  _toHTML(options) {
12232
12165
  const parenthesis = options && options.parenthesis ? options.parenthesis : "keep";
@@ -12252,9 +12185,8 @@ var createRelationalNode = /* @__PURE__ */ factory(
12252
12185
  return ret;
12253
12186
  }
12254
12187
  /**
12255
- * Get LaTeX representation
12256
- * @param {Object} options
12257
- * @return {string} str
12188
+ * Get the MathML representation of this node.
12189
+ * @returns str
12258
12190
  */
12259
12191
  _toMathML() {
12260
12192
  const params = this.params;
@@ -12313,7 +12245,7 @@ var createSymbolNode = /* @__PURE__ */ factory(
12313
12245
  * @constructor SymbolNode
12314
12246
  * @extends {Node}
12315
12247
  * A symbol node can hold and resolve a symbol
12316
- * @param {string} name
12248
+ * @param name
12317
12249
  * @extends {Node}
12318
12250
  */
12319
12251
  constructor(name47) {
@@ -12333,13 +12265,13 @@ var createSymbolNode = /* @__PURE__ */ factory(
12333
12265
  * Compile a node into a JavaScript function.
12334
12266
  * This basically pre-calculates as much as possible and only leaves open
12335
12267
  * 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`
12268
+ * @param math - Math.js namespace with functions and constants.
12269
+ * @param argNames - An object with argument names as key and `true`
12338
12270
  * as value. Used in the SymbolNode to optimize
12339
12271
  * for arguments from user assigned functions
12340
12272
  * (see FunctionAssignmentNode) or special symbols
12341
12273
  * like `end` (see IndexNode).
12342
- * @return {function} Returns a function which can be called like:
12274
+ * @returns Returns a function which can be called like:
12343
12275
  * evalNode(scope: Object, args: Object, context: *)
12344
12276
  */
12345
12277
  _compile(math2, argNames) {
@@ -12361,29 +12293,28 @@ var createSymbolNode = /* @__PURE__ */ factory(
12361
12293
  }
12362
12294
  /**
12363
12295
  * Execute a callback for each of the child nodes of this node
12364
- * @param {function(child: Node, path: string, parent: Node)} callback
12296
+ * @param _callback
12365
12297
  */
12366
12298
  forEach(_callback) {
12367
12299
  }
12368
12300
  /**
12369
12301
  * Create a new SymbolNode with children produced by the given callback.
12370
12302
  * 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
12303
+ * @param _callback
12304
+ * @returns Returns a clone of the node
12373
12305
  */
12374
12306
  map(_callback) {
12375
12307
  return this.clone();
12376
12308
  }
12377
12309
  /**
12378
12310
  * Throws an error 'Undefined symbol {name}'
12379
- * @param {string} name
12311
+ * @param name
12380
12312
  */
12381
12313
  static onUndefinedSymbol(name47) {
12382
12314
  throw new Error("Undefined symbol " + name47);
12383
12315
  }
12384
12316
  /**
12385
12317
  * Create a clone of this node, a shallow copy
12386
- * @return {SymbolNode}
12387
12318
  */
12388
12319
  // @ts-expect-error - method overrides property from Node base class
12389
12320
  clone() {
@@ -12391,8 +12322,8 @@ var createSymbolNode = /* @__PURE__ */ factory(
12391
12322
  }
12392
12323
  /**
12393
12324
  * Get string representation
12394
- * @param {Object} options
12395
- * @return {string} str
12325
+ * @param _options
12326
+ * @returns str
12396
12327
  * @override
12397
12328
  */
12398
12329
  _toString(_options) {
@@ -12400,8 +12331,8 @@ var createSymbolNode = /* @__PURE__ */ factory(
12400
12331
  }
12401
12332
  /**
12402
12333
  * Get HTML representation
12403
- * @param {Object} options
12404
- * @return {string} str
12334
+ * @param _options
12335
+ * @returns str
12405
12336
  * @override
12406
12337
  */
12407
12338
  _toHTML(_options) {
@@ -12423,7 +12354,6 @@ var createSymbolNode = /* @__PURE__ */ factory(
12423
12354
  }
12424
12355
  /**
12425
12356
  * Get a JSON representation of the node
12426
- * @returns {Object}
12427
12357
  */
12428
12358
  toJSON() {
12429
12359
  return {
@@ -12433,18 +12363,16 @@ var createSymbolNode = /* @__PURE__ */ factory(
12433
12363
  }
12434
12364
  /**
12435
12365
  * Instantiate a SymbolNode from its JSON representation
12436
- * @param {Object} json An object structured like
12366
+ * @param json - An object structured like
12437
12367
  * `{"mathjs": "SymbolNode", name: "x"}`,
12438
12368
  * where mathjs is optional
12439
- * @returns {SymbolNode}
12440
12369
  */
12441
12370
  static fromJSON(json) {
12442
12371
  return new SymbolNode(json.name);
12443
12372
  }
12444
12373
  /**
12445
- * Get LaTeX representation
12446
- * @param {Object} options
12447
- * @return {string} str
12374
+ * Get the MathML representation of this node.
12375
+ * @returns str
12448
12376
  * @override
12449
12377
  */
12450
12378
  _toMathML() {