mathjs 12.2.0 → 12.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/HISTORY.md +13 -0
  2. package/NOTICE +1 -1
  3. package/README.md +4 -3
  4. package/bin/cli.js +1 -1
  5. package/lib/browser/math.js +1 -1
  6. package/lib/browser/math.js.LICENSE.txt +3 -3
  7. package/lib/browser/math.js.map +1 -1
  8. package/lib/cjs/expression/node/AccessorNode.js +6 -7
  9. package/lib/cjs/expression/node/ArrayNode.js +6 -7
  10. package/lib/cjs/expression/node/AssignmentNode.js +6 -7
  11. package/lib/cjs/expression/node/BlockNode.js +6 -7
  12. package/lib/cjs/expression/node/ConditionalNode.js +6 -7
  13. package/lib/cjs/expression/node/ConstantNode.js +6 -7
  14. package/lib/cjs/expression/node/FunctionAssignmentNode.js +6 -7
  15. package/lib/cjs/expression/node/FunctionNode.js +7 -8
  16. package/lib/cjs/expression/node/IndexNode.js +6 -7
  17. package/lib/cjs/expression/node/Node.js +18 -5
  18. package/lib/cjs/expression/node/ObjectNode.js +6 -7
  19. package/lib/cjs/expression/node/OperatorNode.js +6 -7
  20. package/lib/cjs/expression/node/ParenthesisNode.js +6 -7
  21. package/lib/cjs/expression/node/RangeNode.js +6 -7
  22. package/lib/cjs/expression/node/RelationalNode.js +6 -7
  23. package/lib/cjs/expression/node/SymbolNode.js +6 -7
  24. package/lib/cjs/header.js +3 -3
  25. package/lib/cjs/type/unit/Unit.js +86 -2
  26. package/lib/cjs/version.js +1 -1
  27. package/lib/esm/expression/node/AccessorNode.js +1 -1
  28. package/lib/esm/expression/node/ArrayNode.js +1 -1
  29. package/lib/esm/expression/node/AssignmentNode.js +1 -1
  30. package/lib/esm/expression/node/BlockNode.js +1 -1
  31. package/lib/esm/expression/node/ConditionalNode.js +1 -1
  32. package/lib/esm/expression/node/ConstantNode.js +1 -1
  33. package/lib/esm/expression/node/FunctionAssignmentNode.js +1 -1
  34. package/lib/esm/expression/node/FunctionNode.js +1 -1
  35. package/lib/esm/expression/node/IndexNode.js +1 -1
  36. package/lib/esm/expression/node/Node.js +15 -4
  37. package/lib/esm/expression/node/ObjectNode.js +1 -1
  38. package/lib/esm/expression/node/OperatorNode.js +1 -1
  39. package/lib/esm/expression/node/ParenthesisNode.js +1 -1
  40. package/lib/esm/expression/node/RangeNode.js +1 -1
  41. package/lib/esm/expression/node/RelationalNode.js +1 -1
  42. package/lib/esm/expression/node/SymbolNode.js +1 -1
  43. package/lib/esm/header.js +1 -1
  44. package/lib/esm/type/unit/Unit.js +86 -2
  45. package/lib/esm/version.js +1 -1
  46. package/package.json +15 -15
@@ -7,9 +7,9 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.createOperatorNode = void 0;
8
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
11
10
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
12
11
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
12
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
14
  var _is = require("../../utils/is.js");
15
15
  var _array = require("../../utils/array.js");
@@ -18,8 +18,8 @@ var _customs = require("../../utils/customs.js");
18
18
  var _operators = require("../operators.js");
19
19
  var _latex = require("../../utils/latex.js");
20
20
  var _factory = require("../../utils/factory.js");
21
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
22
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
21
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
22
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
23
23
  var name = 'OperatorNode';
24
24
  var dependencies = ['Node'];
25
25
  var createOperatorNode = exports.createOperatorNode = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
@@ -235,7 +235,6 @@ var createOperatorNode = exports.createOperatorNode = /* #__PURE__ */(0, _factor
235
235
  }
236
236
  var OperatorNode = /*#__PURE__*/function (_Node) {
237
237
  (0, _inherits2["default"])(OperatorNode, _Node);
238
- var _super = _createSuper(OperatorNode);
239
238
  /**
240
239
  * @constructor OperatorNode
241
240
  * @extends {Node}
@@ -250,7 +249,7 @@ var createOperatorNode = exports.createOperatorNode = /* #__PURE__ */(0, _factor
250
249
  function OperatorNode(op, fn, args, implicit, isPercentage) {
251
250
  var _this;
252
251
  (0, _classCallCheck2["default"])(this, OperatorNode);
253
- _this = _super.call(this);
252
+ _this = _callSuper(this, OperatorNode);
254
253
  // validate input
255
254
  if (typeof op !== 'string') {
256
255
  throw new TypeError('string expected for parameter "op"');
@@ -493,14 +492,14 @@ var createOperatorNode = exports.createOperatorNode = /* #__PURE__ */(0, _factor
493
492
  * @returns {OperatorNode}
494
493
  */
495
494
  }, {
496
- key: "toHTML",
495
+ key: "_toHTML",
497
496
  value:
498
497
  /**
499
498
  * Get HTML representation.
500
499
  * @param {Object} options
501
500
  * @return {string} str
502
501
  */
503
- function toHTML(options) {
502
+ function _toHTML(options) {
504
503
  var parenthesis = options && options.parenthesis ? options.parenthesis : 'keep';
505
504
  var implicit = options && options.implicit ? options.implicit : 'hide';
506
505
  var args = this.args;
@@ -7,21 +7,20 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.createParenthesisNode = void 0;
8
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
11
10
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
12
11
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
12
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
14
  var _is = require("../../utils/is.js");
15
15
  var _factory = require("../../utils/factory.js");
16
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
17
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
16
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
17
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
18
18
  var name = 'ParenthesisNode';
19
19
  var dependencies = ['Node'];
20
20
  var createParenthesisNode = exports.createParenthesisNode = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
21
21
  var Node = _ref.Node;
22
22
  var ParenthesisNode = /*#__PURE__*/function (_Node) {
23
23
  (0, _inherits2["default"])(ParenthesisNode, _Node);
24
- var _super = _createSuper(ParenthesisNode);
25
24
  /**
26
25
  * @constructor ParenthesisNode
27
26
  * @extends {Node}
@@ -32,7 +31,7 @@ var createParenthesisNode = exports.createParenthesisNode = /* #__PURE__ */(0, _
32
31
  function ParenthesisNode(content) {
33
32
  var _this;
34
33
  (0, _classCallCheck2["default"])(this, ParenthesisNode);
35
- _this = _super.call(this);
34
+ _this = _callSuper(this, ParenthesisNode);
36
35
  // validate input
37
36
  if (!(0, _is.isNode)(content)) {
38
37
  throw new TypeError('Node expected for parameter "content"');
@@ -150,7 +149,7 @@ var createParenthesisNode = exports.createParenthesisNode = /* #__PURE__ */(0, _
150
149
  * @returns {ParenthesisNode}
151
150
  */
152
151
  }, {
153
- key: "toHTML",
152
+ key: "_toHTML",
154
153
  value:
155
154
  /**
156
155
  * Get HTML representation
@@ -158,7 +157,7 @@ var createParenthesisNode = exports.createParenthesisNode = /* #__PURE__ */(0, _
158
157
  * @return {string} str
159
158
  * @override
160
159
  */
161
- function toHTML(options) {
160
+ function _toHTML(options) {
162
161
  if (!options || options && !options.parenthesis || options && options.parenthesis === 'keep') {
163
162
  return '<span class="math-parenthesis math-round-parenthesis">(</span>' + this.content.toHTML(options) + '<span class="math-parenthesis math-round-parenthesis">)</span>';
164
163
  }
@@ -7,15 +7,15 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.createRangeNode = void 0;
8
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
11
10
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
12
11
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
12
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
14
  var _is = require("../../utils/is.js");
15
15
  var _factory = require("../../utils/factory.js");
16
16
  var _operators = require("../operators.js");
17
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
18
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
17
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
18
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
19
19
  var name = 'RangeNode';
20
20
  var dependencies = ['Node'];
21
21
  var createRangeNode = exports.createRangeNode = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
@@ -43,7 +43,6 @@ var createRangeNode = exports.createRangeNode = /* #__PURE__ */(0, _factory.fact
43
43
  }
44
44
  var RangeNode = /*#__PURE__*/function (_Node) {
45
45
  (0, _inherits2["default"])(RangeNode, _Node);
46
- var _super = _createSuper(RangeNode);
47
46
  /**
48
47
  * @constructor RangeNode
49
48
  * @extends {Node}
@@ -55,7 +54,7 @@ var createRangeNode = exports.createRangeNode = /* #__PURE__ */(0, _factory.fact
55
54
  function RangeNode(start, end, step) {
56
55
  var _this;
57
56
  (0, _classCallCheck2["default"])(this, RangeNode);
58
- _this = _super.call(this);
57
+ _this = _callSuper(this, RangeNode);
59
58
  // validate inputs
60
59
  if (!(0, _is.isNode)(start)) throw new TypeError('Node expected');
61
60
  if (!(0, _is.isNode)(end)) throw new TypeError('Node expected');
@@ -216,14 +215,14 @@ var createRangeNode = exports.createRangeNode = /* #__PURE__ */(0, _factory.fact
216
215
  * @returns {RangeNode}
217
216
  */
218
217
  }, {
219
- key: "toHTML",
218
+ key: "_toHTML",
220
219
  value:
221
220
  /**
222
221
  * Get HTML representation
223
222
  * @param {Object} options
224
223
  * @return {string} str
225
224
  */
226
- function toHTML(options) {
225
+ function _toHTML(options) {
227
226
  var parenthesis = options && options.parenthesis ? options.parenthesis : 'keep';
228
227
  var parens = calculateNecessaryParentheses(this, parenthesis, options && options.implicit);
229
228
 
@@ -7,17 +7,17 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.createRelationalNode = void 0;
8
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
11
10
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
12
11
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
12
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
14
  var _operators = require("../operators.js");
15
15
  var _string = require("../../utils/string.js");
16
16
  var _customs = require("../../utils/customs.js");
17
17
  var _latex = require("../../utils/latex.js");
18
18
  var _factory = require("../../utils/factory.js");
19
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
20
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
19
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
20
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
21
21
  var name = 'RelationalNode';
22
22
  var dependencies = ['Node'];
23
23
  var createRelationalNode = exports.createRelationalNode = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
@@ -32,7 +32,6 @@ var createRelationalNode = exports.createRelationalNode = /* #__PURE__ */(0, _fa
32
32
  };
33
33
  var RelationalNode = /*#__PURE__*/function (_Node) {
34
34
  (0, _inherits2["default"])(RelationalNode, _Node);
35
- var _super = _createSuper(RelationalNode);
36
35
  /**
37
36
  * A node representing a chained conditional expression, such as 'x > y > z'
38
37
  *
@@ -47,7 +46,7 @@ var createRelationalNode = exports.createRelationalNode = /* #__PURE__ */(0, _fa
47
46
  function RelationalNode(conditionals, params) {
48
47
  var _this;
49
48
  (0, _classCallCheck2["default"])(this, RelationalNode);
50
- _this = _super.call(this);
49
+ _this = _callSuper(this, RelationalNode);
51
50
  if (!Array.isArray(conditionals)) {
52
51
  throw new TypeError('Parameter conditionals must be an array');
53
52
  }
@@ -190,14 +189,14 @@ var createRelationalNode = exports.createRelationalNode = /* #__PURE__ */(0, _fa
190
189
  * @returns {RelationalNode}
191
190
  */
192
191
  }, {
193
- key: "toHTML",
192
+ key: "_toHTML",
194
193
  value:
195
194
  /**
196
195
  * Get HTML representation
197
196
  * @param {Object} options
198
197
  * @return {string} str
199
198
  */
200
- function toHTML(options) {
199
+ function _toHTML(options) {
201
200
  var parenthesis = options && options.parenthesis ? options.parenthesis : 'keep';
202
201
  var precedence = (0, _operators.getPrecedence)(this, parenthesis, options && options.implicit);
203
202
  var paramStrings = this.params.map(function (p, index) {
@@ -7,15 +7,15 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.createSymbolNode = void 0;
8
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
11
10
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
12
11
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
12
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
13
  var _string = require("../../utils/string.js");
14
14
  var _customs = require("../../utils/customs.js");
15
15
  var _factory = require("../../utils/factory.js");
16
16
  var _latex = require("../../utils/latex.js");
17
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
18
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
17
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
18
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
19
19
  var name = 'SymbolNode';
20
20
  var dependencies = ['math', '?Unit', 'Node'];
21
21
  var createSymbolNode = exports.createSymbolNode = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
@@ -32,7 +32,6 @@ var createSymbolNode = exports.createSymbolNode = /* #__PURE__ */(0, _factory.fa
32
32
  }
33
33
  var SymbolNode = /*#__PURE__*/function (_Node) {
34
34
  (0, _inherits2["default"])(SymbolNode, _Node);
35
- var _super = _createSuper(SymbolNode);
36
35
  /**
37
36
  * @constructor SymbolNode
38
37
  * @extends {Node}
@@ -43,7 +42,7 @@ var createSymbolNode = exports.createSymbolNode = /* #__PURE__ */(0, _factory.fa
43
42
  function SymbolNode(name) {
44
43
  var _this;
45
44
  (0, _classCallCheck2["default"])(this, SymbolNode);
46
- _this = _super.call(this);
45
+ _this = _callSuper(this, SymbolNode);
47
46
  // validate input
48
47
  if (typeof name !== 'string') {
49
48
  throw new TypeError('String expected for parameter "name"');
@@ -154,8 +153,8 @@ var createSymbolNode = exports.createSymbolNode = /* #__PURE__ */(0, _factory.fa
154
153
  * @override
155
154
  */
156
155
  }, {
157
- key: "toHTML",
158
- value: function toHTML(options) {
156
+ key: "_toHTML",
157
+ value: function _toHTML(options) {
159
158
  var name = (0, _string.escape)(this.name);
160
159
  if (name === 'true' || name === 'false') {
161
160
  return '<span class="math-symbol math-boolean">' + name + '</span>';
package/lib/cjs/header.js CHANGED
@@ -6,11 +6,11 @@
6
6
  * It features real and complex numbers, units, matrices, a large set of
7
7
  * mathematical functions, and a flexible expression parser.
8
8
  *
9
- * @version 12.2.0
10
- * @date 2023-12-08
9
+ * @version 12.3.0
10
+ * @date 2024-01-12
11
11
  *
12
12
  * @license
13
- * Copyright (C) 2013-2023 Jos de Jong <wjosdejong@gmail.com>
13
+ * Copyright (C) 2013-2024 Jos de Jong <wjosdejong@gmail.com>
14
14
  *
15
15
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
16
16
  * use this file except in compliance with the License. You may obtain a copy
@@ -743,7 +743,7 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
743
743
  Unit.prototype.abs = function () {
744
744
  var ret = this.clone();
745
745
  if (ret.value !== null) {
746
- if (ret._isDerived() || ret.units[0].unit.offset === 0) {
746
+ if (ret._isDerived() || ret.units.length === 0 || ret.units[0].unit.offset === 0) {
747
747
  ret.value = abs(ret.value);
748
748
  } else {
749
749
  // To give the correct, but unexpected, results for units with an offset.
@@ -786,7 +786,7 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
786
786
  if (other.value !== null) {
787
787
  throw new Error('Cannot convert to a unit with a value');
788
788
  }
789
- if (this.value === null || this._isDerived() || this.units[0].unit.offset === other.units[0].unit.offset) {
789
+ if (this.value === null || this._isDerived() || this.units.length === 0 || other.units.length === 0 || this.units[0].unit.offset === other.units[0].unit.offset) {
790
790
  other.value = (0, _object.clone)(value);
791
791
  } else {
792
792
  /* Need to adjust value by difference in offset to convert */
@@ -974,6 +974,10 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
974
974
  ret.units = proposedUnitList;
975
975
  ret.fixPrefix = true;
976
976
  ret.skipAutomaticSimplification = true;
977
+ if (this.value !== null) {
978
+ ret.value = null;
979
+ return this.to(ret);
980
+ }
977
981
  return ret;
978
982
  };
979
983
 
@@ -1254,6 +1258,16 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
1254
1258
  value: 1e24,
1255
1259
  scientific: true
1256
1260
  },
1261
+ R: {
1262
+ name: 'R',
1263
+ value: 1e27,
1264
+ scientific: true
1265
+ },
1266
+ Q: {
1267
+ name: 'Q',
1268
+ value: 1e30,
1269
+ scientific: true
1270
+ },
1257
1271
  d: {
1258
1272
  name: 'd',
1259
1273
  value: 1e-1,
@@ -1303,6 +1317,16 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
1303
1317
  name: 'y',
1304
1318
  value: 1e-24,
1305
1319
  scientific: true
1320
+ },
1321
+ r: {
1322
+ name: 'r',
1323
+ value: 1e-27,
1324
+ scientific: true
1325
+ },
1326
+ q: {
1327
+ name: 'q',
1328
+ value: 1e-30,
1329
+ scientific: true
1306
1330
  }
1307
1331
  },
1308
1332
  LONG: {
@@ -1361,6 +1385,16 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
1361
1385
  value: 1e24,
1362
1386
  scientific: true
1363
1387
  },
1388
+ ronna: {
1389
+ name: 'ronna',
1390
+ value: 1e27,
1391
+ scientific: true
1392
+ },
1393
+ quetta: {
1394
+ name: 'quetta',
1395
+ value: 1e30,
1396
+ scientific: true
1397
+ },
1364
1398
  deci: {
1365
1399
  name: 'deci',
1366
1400
  value: 1e-1,
@@ -1410,6 +1444,16 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
1410
1444
  name: 'yocto',
1411
1445
  value: 1e-24,
1412
1446
  scientific: true
1447
+ },
1448
+ ronto: {
1449
+ name: 'ronto',
1450
+ value: 1e-27,
1451
+ scientific: true
1452
+ },
1453
+ quecto: {
1454
+ name: 'quecto',
1455
+ value: 1e-30,
1456
+ scientific: true
1413
1457
  }
1414
1458
  },
1415
1459
  SQUARED: {
@@ -1468,6 +1512,16 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
1468
1512
  value: 1e48,
1469
1513
  scientific: true
1470
1514
  },
1515
+ R: {
1516
+ name: 'R',
1517
+ value: 1e54,
1518
+ scientific: true
1519
+ },
1520
+ Q: {
1521
+ name: 'Q',
1522
+ value: 1e60,
1523
+ scientific: true
1524
+ },
1471
1525
  d: {
1472
1526
  name: 'd',
1473
1527
  value: 1e-2,
@@ -1517,6 +1571,16 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
1517
1571
  name: 'y',
1518
1572
  value: 1e-48,
1519
1573
  scientific: true
1574
+ },
1575
+ r: {
1576
+ name: 'r',
1577
+ value: 1e-54,
1578
+ scientific: true
1579
+ },
1580
+ q: {
1581
+ name: 'q',
1582
+ value: 1e-60,
1583
+ scientific: true
1520
1584
  }
1521
1585
  },
1522
1586
  CUBIC: {
@@ -1575,6 +1639,16 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
1575
1639
  value: 1e72,
1576
1640
  scientific: true
1577
1641
  },
1642
+ R: {
1643
+ name: 'R',
1644
+ value: 1e81,
1645
+ scientific: true
1646
+ },
1647
+ Q: {
1648
+ name: 'Q',
1649
+ value: 1e90,
1650
+ scientific: true
1651
+ },
1578
1652
  d: {
1579
1653
  name: 'd',
1580
1654
  value: 1e-3,
@@ -1624,6 +1698,16 @@ var createUnitClass = exports.createUnitClass = /* #__PURE__ */(0, _factory.fact
1624
1698
  name: 'y',
1625
1699
  value: 1e-72,
1626
1700
  scientific: true
1701
+ },
1702
+ r: {
1703
+ name: 'r',
1704
+ value: 1e-81,
1705
+ scientific: true
1706
+ },
1707
+ q: {
1708
+ name: 'q',
1709
+ value: 1e-90,
1710
+ scientific: true
1627
1711
  }
1628
1712
  },
1629
1713
  BINARY_SHORT_SI: {
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.version = void 0;
7
- var version = exports.version = '12.2.0';
7
+ var version = exports.version = '12.3.0';
8
8
  // Note: This file is automatically generated when building math.js.
9
9
  // Changes made in this file will be overwritten.
@@ -136,7 +136,7 @@ export var createAccessorNode = /* #__PURE__ */factory(name, dependencies, _ref
136
136
  * @param {Object} options
137
137
  * @return {string}
138
138
  */
139
- toHTML(options) {
139
+ _toHTML(options) {
140
140
  var object = this.object.toHTML(options);
141
141
  if (needParenthesis(this.object)) {
142
142
  object = '<span class="math-parenthesis math-round-parenthesis">(</span>' + object + '<span class="math-parenthesis math-round-parenthesis">)</span>';
@@ -139,7 +139,7 @@ export var createArrayNode = /* #__PURE__ */factory(name, dependencies, _ref =>
139
139
  * @return {string} str
140
140
  * @override
141
141
  */
142
- toHTML(options) {
142
+ _toHTML(options) {
143
143
  var items = this.items.map(function (node) {
144
144
  return node.toHTML(options);
145
145
  });
@@ -273,7 +273,7 @@ export var createAssignmentNode = /* #__PURE__ */factory(name, dependencies, _re
273
273
  * @param {Object} options
274
274
  * @return {string}
275
275
  */
276
- toHTML(options) {
276
+ _toHTML(options) {
277
277
  var object = this.object.toHTML(options);
278
278
  var index = this.index ? this.index.toHTML(options) : '';
279
279
  var value = this.value.toHTML(options);
@@ -160,7 +160,7 @@ export var createBlockNode = /* #__PURE__ */factory(name, dependencies, _ref =>
160
160
  * @return {string} str
161
161
  * @override
162
162
  */
163
- toHTML(options) {
163
+ _toHTML(options) {
164
164
  return this.blocks.map(function (param) {
165
165
  return param.node.toHTML(options) + (param.visible ? '' : '<span class="math-separator">;</span>');
166
166
  }).join('<span class="math-separator"><br /></span>');
@@ -182,7 +182,7 @@ export var createConditionalNode = /* #__PURE__ */factory(name, dependencies, _r
182
182
  * @param {Object} options
183
183
  * @return {string} str
184
184
  */
185
- toHTML(options) {
185
+ _toHTML(options) {
186
186
  var parenthesis = options && options.parenthesis ? options.parenthesis : 'keep';
187
187
  var precedence = getPrecedence(this, parenthesis, options && options.implicit);
188
188
 
@@ -93,7 +93,7 @@ export var createConstantNode = /* #__PURE__ */factory(name, dependencies, _ref
93
93
  * @param {Object} options
94
94
  * @return {string} str
95
95
  */
96
- toHTML(options) {
96
+ _toHTML(options) {
97
97
  var value = this._toString(options);
98
98
  switch (typeOf(this.value)) {
99
99
  case 'number':
@@ -200,7 +200,7 @@ export var createFunctionAssignmentNode = /* #__PURE__ */factory(name, dependenc
200
200
  * @param {Object} options
201
201
  * @return {string} str
202
202
  */
203
- toHTML(options) {
203
+ _toHTML(options) {
204
204
  var parenthesis = options && options.parenthesis ? options.parenthesis : 'keep';
205
205
  var params = [];
206
206
  for (var i = 0; i < this.params.length; i++) {
@@ -366,7 +366,7 @@ export var createFunctionNode = /* #__PURE__ */factory(name, dependencies, _ref
366
366
  * @param {Object} options
367
367
  * @return {string} str
368
368
  */
369
- toHTML(options) {
369
+ _toHTML(options) {
370
370
  var args = this.args.map(function (arg) {
371
371
  return arg.toHTML(options);
372
372
  });
@@ -186,7 +186,7 @@ export var createIndexNode = /* #__PURE__ */factory(name, dependencies, _ref =>
186
186
  * @param {Object} options
187
187
  * @return {string} str
188
188
  */
189
- toHTML(options) {
189
+ _toHTML(options) {
190
190
  // format the parameters like "[1, 0:5]"
191
191
  var dimensions = [];
192
192
  for (var i = 0; i < this.dimensions.length; i++) {
@@ -242,6 +242,17 @@ export var createNode = /* #__PURE__ */factory(name, dependencies, _ref => {
242
242
  return this._toString(options);
243
243
  }
244
244
 
245
+ /**
246
+ * Internal function to generate the string output.
247
+ * This has to be implemented by every Node
248
+ *
249
+ * @throws {Error}
250
+ */
251
+ _toString() {
252
+ // must be implemented by each of the Node implementations
253
+ throw new Error('_toString not implemented for ' + this.type);
254
+ }
255
+
245
256
  /**
246
257
  * Get a JSON representation of the node
247
258
  * Both .toJSON() and the static .fromJSON(json) should be implemented by all
@@ -272,18 +283,18 @@ export var createNode = /* #__PURE__ */factory(name, dependencies, _ref => {
272
283
  if (typeof customString !== 'undefined') {
273
284
  return customString;
274
285
  }
275
- return this.toHTML(options);
286
+ return this._toHTML(options);
276
287
  }
277
288
 
278
289
  /**
279
- * Internal function to generate the string output.
290
+ * Internal function to generate the HTML output.
280
291
  * This has to be implemented by every Node
281
292
  *
282
293
  * @throws {Error}
283
294
  */
284
- _toString() {
295
+ _toHTML() {
285
296
  // must be implemented by each of the Node implementations
286
- throw new Error('_toString not implemented for ' + this.type);
297
+ throw new Error('_toHTML not implemented for ' + this.type);
287
298
  }
288
299
 
289
300
  /**
@@ -159,7 +159,7 @@ export var createObjectNode = /* #__PURE__ */factory(name, dependencies, _ref =>
159
159
  * @return {string} str
160
160
  * @override
161
161
  */
162
- toHTML(options) {
162
+ _toHTML(options) {
163
163
  var entries = [];
164
164
  for (var key in this.properties) {
165
165
  if (hasOwnProperty(this.properties, key)) {
@@ -464,7 +464,7 @@ export var createOperatorNode = /* #__PURE__ */factory(name, dependencies, _ref
464
464
  * @param {Object} options
465
465
  * @return {string} str
466
466
  */
467
- toHTML(options) {
467
+ _toHTML(options) {
468
468
  var parenthesis = options && options.parenthesis ? options.parenthesis : 'keep';
469
469
  var implicit = options && options.implicit ? options.implicit : 'hide';
470
470
  var args = this.args;
@@ -124,7 +124,7 @@ export var createParenthesisNode = /* #__PURE__ */factory(name, dependencies, _r
124
124
  * @return {string} str
125
125
  * @override
126
126
  */
127
- toHTML(options) {
127
+ _toHTML(options) {
128
128
  if (!options || options && !options.parenthesis || options && options.parenthesis === 'keep') {
129
129
  return '<span class="math-parenthesis math-round-parenthesis">(</span>' + this.content.toHTML(options) + '<span class="math-parenthesis math-round-parenthesis">)</span>';
130
130
  }
@@ -189,7 +189,7 @@ export var createRangeNode = /* #__PURE__ */factory(name, dependencies, _ref =>
189
189
  * @param {Object} options
190
190
  * @return {string} str
191
191
  */
192
- toHTML(options) {
192
+ _toHTML(options) {
193
193
  var parenthesis = options && options.parenthesis ? options.parenthesis : 'keep';
194
194
  var parens = calculateNecessaryParentheses(this, parenthesis, options && options.implicit);
195
195
 
@@ -157,7 +157,7 @@ export var createRelationalNode = /* #__PURE__ */factory(name, dependencies, _re
157
157
  * @param {Object} options
158
158
  * @return {string} str
159
159
  */
160
- toHTML(options) {
160
+ _toHTML(options) {
161
161
  var parenthesis = options && options.parenthesis ? options.parenthesis : 'keep';
162
162
  var precedence = getPrecedence(this, parenthesis, options && options.implicit);
163
163
  var paramStrings = this.params.map(function (p, index) {