mathjs 12.2.0 → 12.3.0

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 (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
@@ -125,7 +125,7 @@ export var createSymbolNode = /* #__PURE__ */factory(name, dependencies, _ref =>
125
125
  * @return {string} str
126
126
  * @override
127
127
  */
128
- toHTML(options) {
128
+ _toHTML(options) {
129
129
  var name = escape(this.name);
130
130
  if (name === 'true' || name === 'false') {
131
131
  return '<span class="math-symbol math-boolean">' + name + '</span>';
package/lib/esm/header.js CHANGED
@@ -10,7 +10,7 @@
10
10
  * @date @@date
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
@@ -731,7 +731,7 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
731
731
  Unit.prototype.abs = function () {
732
732
  var ret = this.clone();
733
733
  if (ret.value !== null) {
734
- if (ret._isDerived() || ret.units[0].unit.offset === 0) {
734
+ if (ret._isDerived() || ret.units.length === 0 || ret.units[0].unit.offset === 0) {
735
735
  ret.value = abs(ret.value);
736
736
  } else {
737
737
  // To give the correct, but unexpected, results for units with an offset.
@@ -774,7 +774,7 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
774
774
  if (other.value !== null) {
775
775
  throw new Error('Cannot convert to a unit with a value');
776
776
  }
777
- if (this.value === null || this._isDerived() || this.units[0].unit.offset === other.units[0].unit.offset) {
777
+ if (this.value === null || this._isDerived() || this.units.length === 0 || other.units.length === 0 || this.units[0].unit.offset === other.units[0].unit.offset) {
778
778
  other.value = clone(value);
779
779
  } else {
780
780
  /* Need to adjust value by difference in offset to convert */
@@ -962,6 +962,10 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
962
962
  ret.units = proposedUnitList;
963
963
  ret.fixPrefix = true;
964
964
  ret.skipAutomaticSimplification = true;
965
+ if (this.value !== null) {
966
+ ret.value = null;
967
+ return this.to(ret);
968
+ }
965
969
  return ret;
966
970
  };
967
971
 
@@ -1242,6 +1246,16 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
1242
1246
  value: 1e24,
1243
1247
  scientific: true
1244
1248
  },
1249
+ R: {
1250
+ name: 'R',
1251
+ value: 1e27,
1252
+ scientific: true
1253
+ },
1254
+ Q: {
1255
+ name: 'Q',
1256
+ value: 1e30,
1257
+ scientific: true
1258
+ },
1245
1259
  d: {
1246
1260
  name: 'd',
1247
1261
  value: 1e-1,
@@ -1291,6 +1305,16 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
1291
1305
  name: 'y',
1292
1306
  value: 1e-24,
1293
1307
  scientific: true
1308
+ },
1309
+ r: {
1310
+ name: 'r',
1311
+ value: 1e-27,
1312
+ scientific: true
1313
+ },
1314
+ q: {
1315
+ name: 'q',
1316
+ value: 1e-30,
1317
+ scientific: true
1294
1318
  }
1295
1319
  },
1296
1320
  LONG: {
@@ -1349,6 +1373,16 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
1349
1373
  value: 1e24,
1350
1374
  scientific: true
1351
1375
  },
1376
+ ronna: {
1377
+ name: 'ronna',
1378
+ value: 1e27,
1379
+ scientific: true
1380
+ },
1381
+ quetta: {
1382
+ name: 'quetta',
1383
+ value: 1e30,
1384
+ scientific: true
1385
+ },
1352
1386
  deci: {
1353
1387
  name: 'deci',
1354
1388
  value: 1e-1,
@@ -1398,6 +1432,16 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
1398
1432
  name: 'yocto',
1399
1433
  value: 1e-24,
1400
1434
  scientific: true
1435
+ },
1436
+ ronto: {
1437
+ name: 'ronto',
1438
+ value: 1e-27,
1439
+ scientific: true
1440
+ },
1441
+ quecto: {
1442
+ name: 'quecto',
1443
+ value: 1e-30,
1444
+ scientific: true
1401
1445
  }
1402
1446
  },
1403
1447
  SQUARED: {
@@ -1456,6 +1500,16 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
1456
1500
  value: 1e48,
1457
1501
  scientific: true
1458
1502
  },
1503
+ R: {
1504
+ name: 'R',
1505
+ value: 1e54,
1506
+ scientific: true
1507
+ },
1508
+ Q: {
1509
+ name: 'Q',
1510
+ value: 1e60,
1511
+ scientific: true
1512
+ },
1459
1513
  d: {
1460
1514
  name: 'd',
1461
1515
  value: 1e-2,
@@ -1505,6 +1559,16 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
1505
1559
  name: 'y',
1506
1560
  value: 1e-48,
1507
1561
  scientific: true
1562
+ },
1563
+ r: {
1564
+ name: 'r',
1565
+ value: 1e-54,
1566
+ scientific: true
1567
+ },
1568
+ q: {
1569
+ name: 'q',
1570
+ value: 1e-60,
1571
+ scientific: true
1508
1572
  }
1509
1573
  },
1510
1574
  CUBIC: {
@@ -1563,6 +1627,16 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
1563
1627
  value: 1e72,
1564
1628
  scientific: true
1565
1629
  },
1630
+ R: {
1631
+ name: 'R',
1632
+ value: 1e81,
1633
+ scientific: true
1634
+ },
1635
+ Q: {
1636
+ name: 'Q',
1637
+ value: 1e90,
1638
+ scientific: true
1639
+ },
1566
1640
  d: {
1567
1641
  name: 'd',
1568
1642
  value: 1e-3,
@@ -1612,6 +1686,16 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
1612
1686
  name: 'y',
1613
1687
  value: 1e-72,
1614
1688
  scientific: true
1689
+ },
1690
+ r: {
1691
+ name: 'r',
1692
+ value: 1e-81,
1693
+ scientific: true
1694
+ },
1695
+ q: {
1696
+ name: 'q',
1697
+ value: 1e-90,
1698
+ scientific: true
1615
1699
  }
1616
1700
  },
1617
1701
  BINARY_SHORT_SI: {
@@ -1,3 +1,3 @@
1
- export var version = '12.2.0';
1
+ export var version = '12.3.0';
2
2
  // Note: This file is automatically generated when building math.js.
3
3
  // Changes made in this file will be overwritten.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mathjs",
3
- "version": "12.2.0",
3
+ "version": "12.3.0",
4
4
  "description": "Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.",
5
5
  "author": "Jos de Jong <wjosdejong@gmail.com> (https://github.com/josdejong)",
6
6
  "homepage": "https://mathjs.org",
@@ -25,7 +25,7 @@
25
25
  "unit"
26
26
  ],
27
27
  "dependencies": {
28
- "@babel/runtime": "^7.23.5",
28
+ "@babel/runtime": "^7.23.8",
29
29
  "complex.js": "^2.1.1",
30
30
  "decimal.js": "^10.4.3",
31
31
  "escape-latex": "^1.2.0",
@@ -36,30 +36,30 @@
36
36
  "typed-function": "^4.1.1"
37
37
  },
38
38
  "devDependencies": {
39
- "@babel/core": "7.23.5",
39
+ "@babel/core": "7.23.7",
40
40
  "@babel/plugin-transform-object-assign": "7.23.3",
41
- "@babel/plugin-transform-runtime": "7.23.4",
42
- "@babel/preset-env": "7.23.5",
43
- "@babel/register": "7.22.15",
41
+ "@babel/plugin-transform-runtime": "7.23.7",
42
+ "@babel/preset-env": "7.23.8",
43
+ "@babel/register": "7.23.7",
44
44
  "@types/assert": "1.5.10",
45
45
  "@types/mocha": "10.0.6",
46
- "@typescript-eslint/eslint-plugin": "6.13.2",
47
- "@typescript-eslint/parser": "6.13.2",
46
+ "@typescript-eslint/eslint-plugin": "6.18.1",
47
+ "@typescript-eslint/parser": "6.18.1",
48
48
  "assert": "2.1.0",
49
49
  "babel-loader": "9.1.3",
50
50
  "benchmark": "2.1.4",
51
- "c8": "8.0.1",
51
+ "c8": "9.0.0",
52
52
  "codecov": "3.8.3",
53
- "core-js": "3.34.0",
53
+ "core-js": "3.35.0",
54
54
  "del": "6.1.1",
55
55
  "dtslint": "4.2.1",
56
- "eslint": "8.55.0",
56
+ "eslint": "8.56.0",
57
57
  "eslint-config-prettier": "9.1.0",
58
58
  "eslint-config-standard": "17.1.0",
59
- "eslint-plugin-import": "2.29.0",
59
+ "eslint-plugin-import": "2.29.1",
60
60
  "eslint-plugin-mocha": "10.2.0",
61
- "eslint-plugin-n": "16.3.1",
62
- "eslint-plugin-prettier": "5.0.1",
61
+ "eslint-plugin-n": "16.6.2",
62
+ "eslint-plugin-prettier": "5.1.3",
63
63
  "eslint-plugin-promise": "6.1.1",
64
64
  "expect-type": "0.17.3",
65
65
  "expr-eval": "2.0.2",
@@ -85,7 +85,7 @@
85
85
  "ndarray-pack": "1.2.1",
86
86
  "numericjs": "1.2.6",
87
87
  "pad-right": "0.2.2",
88
- "prettier": "3.1.0",
88
+ "prettier": "3.1.1",
89
89
  "process": "0.11.10",
90
90
  "sylvester": "0.0.21",
91
91
  "ts-node": "10.9.2",