mathjs 14.5.2 → 14.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HISTORY.md +11 -0
- package/lib/browser/math.js +1 -1
- package/lib/browser/math.js.LICENSE.txt +2 -2
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/expression/parse.js +1 -1
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/version.js +1 -1
- package/lib/esm/expression/parse.js +1 -1
- package/lib/esm/version.js +1 -1
- package/package.json +14 -14
- package/types/EXPLANATION.md +1 -1
- package/types/index.d.ts +38 -23
@@ -511,7 +511,7 @@ const createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(n
|
|
511
511
|
*/
|
512
512
|
parse.isWhitespace = function isWhitespace(c, nestingLevel) {
|
513
513
|
// TODO: also take '\r' carriage return as newline? Or does that give problems on mac?
|
514
|
-
return c === ' ' || c === '\t' || c === '\n' && nestingLevel > 0;
|
514
|
+
return c === ' ' || c === '\t' || c === '\u00A0' || c === '\n' && nestingLevel > 0;
|
515
515
|
};
|
516
516
|
|
517
517
|
/**
|
package/lib/cjs/header.js
CHANGED
@@ -6,8 +6,8 @@
|
|
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 14.5.
|
10
|
-
* @date 2025-
|
9
|
+
* @version 14.5.3
|
10
|
+
* @date 2025-07-02
|
11
11
|
*
|
12
12
|
* @license
|
13
13
|
* Copyright (C) 2013-2025 Jos de Jong <wjosdejong@gmail.com>
|
package/lib/cjs/version.js
CHANGED
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.version = void 0;
|
7
|
-
const version = exports.version = '14.5.
|
7
|
+
const version = exports.version = '14.5.3';
|
8
8
|
// Note: This file is automatically generated when building math.js.
|
9
9
|
// Changes made in this file will be overwritten.
|
@@ -504,7 +504,7 @@ export var createParse = /* #__PURE__ */factory(name, dependencies, _ref => {
|
|
504
504
|
*/
|
505
505
|
parse.isWhitespace = function isWhitespace(c, nestingLevel) {
|
506
506
|
// TODO: also take '\r' carriage return as newline? Or does that give problems on mac?
|
507
|
-
return c === ' ' || c === '\t' || c === '\n' && nestingLevel > 0;
|
507
|
+
return c === ' ' || c === '\t' || c === '\u00A0' || c === '\n' && nestingLevel > 0;
|
508
508
|
};
|
509
509
|
|
510
510
|
/**
|
package/lib/esm/version.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "mathjs",
|
3
|
-
"version": "14.5.
|
3
|
+
"version": "14.5.3",
|
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",
|
@@ -36,37 +36,37 @@
|
|
36
36
|
"typed-function": "^4.2.1"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
|
-
"@babel/core": "7.
|
39
|
+
"@babel/core": "7.28.0",
|
40
40
|
"@babel/plugin-transform-object-assign": "7.27.1",
|
41
41
|
"@babel/plugin-transform-optional-catch-binding": "7.27.1",
|
42
|
-
"@babel/plugin-transform-runtime": "7.
|
43
|
-
"@babel/preset-env": "7.
|
42
|
+
"@babel/plugin-transform-runtime": "7.28.0",
|
43
|
+
"@babel/preset-env": "7.28.0",
|
44
44
|
"@babel/register": "7.27.1",
|
45
45
|
"@types/assert": "1.5.11",
|
46
46
|
"@types/mocha": "10.0.10",
|
47
|
-
"@typescript-eslint/eslint-plugin": "8.
|
48
|
-
"@typescript-eslint/parser": "8.
|
47
|
+
"@typescript-eslint/eslint-plugin": "8.35.1",
|
48
|
+
"@typescript-eslint/parser": "8.35.1",
|
49
49
|
"assert": "2.1.0",
|
50
50
|
"babel-loader": "10.0.0",
|
51
51
|
"c8": "10.1.3",
|
52
52
|
"codecov": "3.8.3",
|
53
|
-
"core-js": "3.
|
53
|
+
"core-js": "3.43.0",
|
54
54
|
"del": "8.0.0",
|
55
55
|
"dtslint": "4.2.1",
|
56
56
|
"eigen": "0.2.2",
|
57
57
|
"eslint": "8.57.1",
|
58
58
|
"eslint-config-prettier": "9.1.0",
|
59
59
|
"eslint-config-standard": "17.1.0",
|
60
|
-
"eslint-plugin-import": "2.
|
60
|
+
"eslint-plugin-import": "2.32.0",
|
61
61
|
"eslint-plugin-mocha": "10.5.0",
|
62
62
|
"eslint-plugin-n": "16.6.2",
|
63
|
-
"eslint-plugin-prettier": "5.
|
63
|
+
"eslint-plugin-prettier": "5.5.1",
|
64
64
|
"eslint-plugin-promise": "6.6.0",
|
65
65
|
"expect-type": "1.2.1",
|
66
66
|
"expr-eval": "2.0.2",
|
67
67
|
"fancy-log": "2.0.0",
|
68
|
-
"glob": "11.0.
|
69
|
-
"gulp": "5.0.
|
68
|
+
"glob": "11.0.3",
|
69
|
+
"gulp": "5.0.1",
|
70
70
|
"gulp-babel": "8.0.0",
|
71
71
|
"handlebars": "4.7.8",
|
72
72
|
"jsep": "1.4.0",
|
@@ -78,7 +78,7 @@
|
|
78
78
|
"karma-webdriver-launcher": "1.0.8",
|
79
79
|
"karma-webpack": "5.0.1",
|
80
80
|
"mkdirp": "3.0.1",
|
81
|
-
"mocha": "11.
|
81
|
+
"mocha": "11.7.1",
|
82
82
|
"mocha-junit-reporter": "2.2.1",
|
83
83
|
"ndarray": "1.0.19",
|
84
84
|
"ndarray-determinant": "1.0.0",
|
@@ -86,9 +86,9 @@
|
|
86
86
|
"ndarray-ops": "1.2.2",
|
87
87
|
"ndarray-pack": "1.2.1",
|
88
88
|
"numericjs": "1.2.6",
|
89
|
-
"prettier": "3.
|
89
|
+
"prettier": "3.6.2",
|
90
90
|
"process": "0.11.10",
|
91
|
-
"sinon": "
|
91
|
+
"sinon": "21.0.0",
|
92
92
|
"sylvester": "0.0.21",
|
93
93
|
"tinybench": "4.0.1",
|
94
94
|
"ts-node": "10.9.2",
|
package/types/EXPLANATION.md
CHANGED
@@ -20,7 +20,7 @@ Maintaining the TypeScript types is done manually. When adding a function, one h
|
|
20
20
|
3. Add a static definition inside `export const {...} : MathJsInstance`
|
21
21
|
4. Add a dependencies definition inside `export const {...} : Record<string, FactoryFunctionMap>`
|
22
22
|
|
23
|
-
For
|
23
|
+
For example for the function `add`, we can have the following definitions:
|
24
24
|
|
25
25
|
```ts
|
26
26
|
// instance
|
package/types/index.d.ts
CHANGED
@@ -28,7 +28,12 @@ export type MatrixFromFunctionCallback<T extends MathScalarType> = (
|
|
28
28
|
) => T
|
29
29
|
|
30
30
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
31
|
-
export type FactoryFunction<T> = (scope:
|
31
|
+
export type FactoryFunction<T> = (scope: MathScope) => T
|
32
|
+
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
34
|
+
export type MathScope<TValue = any> =
|
35
|
+
| Record<string, TValue>
|
36
|
+
| MapLike<string, TValue>
|
32
37
|
|
33
38
|
// FactoryFunctionMap can be nested; all nested objects will be flattened
|
34
39
|
export interface FactoryFunctionMap {
|
@@ -862,8 +867,8 @@ export interface MathJsInstance extends MathJsFactory {
|
|
862
867
|
* @param unit The unit to be created
|
863
868
|
* @returns The created unit
|
864
869
|
*/
|
865
|
-
unit(value: MathNumericType, unit
|
866
|
-
unit(value: MathCollection
|
870
|
+
unit(value: MathNumericType, unit?: string): Unit
|
871
|
+
unit(value: MathCollection): Unit[]
|
867
872
|
|
868
873
|
/*************************************************************************
|
869
874
|
* Expression functions
|
@@ -891,12 +896,12 @@ export interface MathJsInstance extends MathJsFactory {
|
|
891
896
|
*/
|
892
897
|
evaluate(
|
893
898
|
expr: MathExpression | Matrix,
|
894
|
-
scope?:
|
899
|
+
scope?: MathScope
|
895
900
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
896
901
|
): any
|
897
902
|
evaluate(
|
898
903
|
expr: MathExpression[],
|
899
|
-
scope?:
|
904
|
+
scope?: MathScope
|
900
905
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
901
906
|
): any[]
|
902
907
|
|
@@ -1071,14 +1076,14 @@ export interface MathJsInstance extends MathJsFactory {
|
|
1071
1076
|
* @param scope Scope to read/write variables
|
1072
1077
|
*/
|
1073
1078
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
1074
|
-
resolve(node: MathNode | string, scope?:
|
1079
|
+
resolve(node: MathNode | string, scope?: MathScope): MathNode
|
1075
1080
|
resolve(
|
1076
1081
|
node: (MathNode | string)[],
|
1077
1082
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
1078
|
-
scope?:
|
1083
|
+
scope?: MathScope
|
1079
1084
|
): MathNode[]
|
1080
1085
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
1081
|
-
resolve(node: Matrix, scope?:
|
1086
|
+
resolve(node: Matrix, scope?: MathScope): Matrix
|
1082
1087
|
|
1083
1088
|
/**
|
1084
1089
|
* Calculate the Sparse Matrix LU decomposition with full pivoting.
|
@@ -1131,9 +1136,9 @@ export interface MathJsInstance extends MathJsFactory {
|
|
1131
1136
|
* @returns Sum of x and y
|
1132
1137
|
*/
|
1133
1138
|
add<T extends MathType>(x: T, y: T): T
|
1134
|
-
add<T extends MathType>(...values: T[]): T
|
1139
|
+
add<T extends MathType>(x: T, y: T, ...values: T[]): T
|
1135
1140
|
add(x: MathType, y: MathType): MathType
|
1136
|
-
add(...values: MathType[]): MathType
|
1141
|
+
add(x: MathType, y: MathType, ...values: MathType[]): MathType
|
1137
1142
|
|
1138
1143
|
/**
|
1139
1144
|
* Calculate the cubic root of a value.
|
@@ -1460,9 +1465,8 @@ export interface MathJsInstance extends MathJsFactory {
|
|
1460
1465
|
multiply<T extends MathArray>(x: T, y: T): MathScalarType
|
1461
1466
|
multiply(x: Unit, y: Unit): Unit
|
1462
1467
|
multiply(x: number, y: number): number
|
1463
|
-
multiply(x: MathType, y: MathType): MathType
|
1464
|
-
multiply<T extends MathType>(...values: T[]): T
|
1465
|
-
multiply(...values: MathType[]): MathType
|
1468
|
+
multiply(x: MathType, y: MathType, ...values: MathType[]): MathType
|
1469
|
+
multiply<T extends MathType>(x: T, y: T, ...values: T[]): T
|
1466
1470
|
|
1467
1471
|
/**
|
1468
1472
|
* Calculate the norm of a number, vector or matrix. The second
|
@@ -4172,7 +4176,7 @@ export interface Unit {
|
|
4172
4176
|
divide(unit: Unit): Unit | number
|
4173
4177
|
pow(unit: Unit): Unit
|
4174
4178
|
abs(unit: Unit): Unit
|
4175
|
-
to(unit: string): Unit
|
4179
|
+
to(unit: string | Unit): Unit
|
4176
4180
|
toNumber(unit?: string): number
|
4177
4181
|
toNumeric(unit?: string): number | Fraction | BigNumber
|
4178
4182
|
toSI(): Unit
|
@@ -4286,10 +4290,14 @@ export interface Simplify {
|
|
4286
4290
|
(
|
4287
4291
|
expr: MathNode | string,
|
4288
4292
|
rules: SimplifyRule[],
|
4289
|
-
scope?:
|
4293
|
+
scope?: MathScope,
|
4294
|
+
options?: SimplifyOptions
|
4295
|
+
): MathNode
|
4296
|
+
(
|
4297
|
+
expr: MathNode | string,
|
4298
|
+
scope: MathScope,
|
4290
4299
|
options?: SimplifyOptions
|
4291
4300
|
): MathNode
|
4292
|
-
(expr: MathNode | string, scope: object, options?: SimplifyOptions): MathNode
|
4293
4301
|
|
4294
4302
|
rules: SimplifyRule[]
|
4295
4303
|
}
|
@@ -4316,7 +4324,7 @@ export interface ObjectWrappingMap<T extends string | number | symbol, U> {
|
|
4316
4324
|
|
4317
4325
|
export interface EvalFunction {
|
4318
4326
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4319
|
-
evaluate(scope?:
|
4327
|
+
evaluate(scope?: MathScope): any
|
4320
4328
|
}
|
4321
4329
|
|
4322
4330
|
// ResultSet type and helper
|
@@ -4354,7 +4362,7 @@ export interface MathNode {
|
|
4354
4362
|
* node.compile().evaluate(scope). Example:
|
4355
4363
|
*/
|
4356
4364
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4357
|
-
evaluate(
|
4365
|
+
evaluate(scope?: MathScope): any
|
4358
4366
|
/**
|
4359
4367
|
* Test whether this node equals an other node. Does a deep comparison
|
4360
4368
|
* of the values of both nodes.
|
@@ -4818,7 +4826,7 @@ export interface MathJsChain<TValue> {
|
|
4818
4826
|
*/
|
4819
4827
|
unit(this: MathJsChain<string>, unit?: string): MathJsChain<Unit>
|
4820
4828
|
unit(this: MathJsChain<MathNumericType>, unit?: string): MathJsChain<Unit>
|
4821
|
-
unit(this: MathJsChain<MathCollection
|
4829
|
+
unit(this: MathJsChain<MathCollection>): MathJsChain<Unit[]>
|
4822
4830
|
|
4823
4831
|
/*************************************************************************
|
4824
4832
|
* Expression functions
|
@@ -4837,12 +4845,12 @@ export interface MathJsChain<TValue> {
|
|
4837
4845
|
*/
|
4838
4846
|
evaluate(
|
4839
4847
|
this: MathJsChain<MathExpression | Matrix>,
|
4840
|
-
scope?:
|
4848
|
+
scope?: MathScope
|
4841
4849
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4842
4850
|
): MathJsChain<any>
|
4843
4851
|
evaluate(
|
4844
4852
|
this: MathJsChain<MathExpression[]>,
|
4845
|
-
scope?:
|
4853
|
+
scope?: MathScope
|
4846
4854
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4847
4855
|
): MathJsChain<any[]>
|
4848
4856
|
|
@@ -4879,12 +4887,12 @@ export interface MathJsChain<TValue> {
|
|
4879
4887
|
resolve(
|
4880
4888
|
this: MathJsChain<MathNode>,
|
4881
4889
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4882
|
-
scope?:
|
4890
|
+
scope?: MathScope
|
4883
4891
|
): MathJsChain<MathNode>
|
4884
4892
|
resolve(
|
4885
4893
|
this: MathJsChain<MathNode[]>,
|
4886
4894
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4887
|
-
scope?:
|
4895
|
+
scope?: MathScope
|
4888
4896
|
): MathJsChain<MathNode[]>
|
4889
4897
|
|
4890
4898
|
/*************************************************************************
|
@@ -7081,6 +7089,13 @@ export interface ImportObject {
|
|
7081
7089
|
[key: string]: any
|
7082
7090
|
}
|
7083
7091
|
|
7092
|
+
export interface MapLike<TKey = string, TValue = unknown> {
|
7093
|
+
get(key: TKey): TValue
|
7094
|
+
set(key: TKey, value: TValue): MapLike<TKey, TValue>
|
7095
|
+
has(key: TKey): boolean
|
7096
|
+
keys(): IterableIterator<TKey> | TKey[]
|
7097
|
+
}
|
7098
|
+
|
7084
7099
|
export const {
|
7085
7100
|
// config // Don't export config: no config available in the static instance
|
7086
7101
|
|