mathjs 13.2.1 → 13.2.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 +13 -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/function/matrix/filter.js +7 -0
- package/lib/cjs/function/matrix/forEach.js +7 -0
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/utils/object.js +4 -0
- package/lib/cjs/version.js +1 -1
- package/lib/esm/expression/parse.js +1 -1
- package/lib/esm/function/matrix/filter.js +7 -0
- package/lib/esm/function/matrix/forEach.js +7 -0
- package/lib/esm/utils/object.js +4 -0
- package/lib/esm/version.js +1 -1
- package/package.json +2 -2
- package/types/index.d.ts +5 -7
@@ -1041,7 +1041,7 @@ const createParse = exports.createParse = /* #__PURE__ */(0, _factory.factory)(n
|
|
1041
1041
|
getTokenSkipNewline(state);
|
1042
1042
|
|
1043
1043
|
// Match the "symbol" part of the pattern, or a left parenthesis
|
1044
|
-
if (state.tokenType === TOKENTYPE.SYMBOL || state.token === '(') {
|
1044
|
+
if (state.tokenType === TOKENTYPE.SYMBOL || state.token === '(' || state.token === 'in') {
|
1045
1045
|
// We've matched the pattern "number / number symbol".
|
1046
1046
|
// Rewind once and build the "number / number" node; the symbol will be consumed later
|
1047
1047
|
(0, _extends2.default)(state, tokenStates.pop());
|
@@ -16,6 +16,13 @@ const createFilter = exports.createFilter = /* #__PURE__ */(0, _factory.factory)
|
|
16
16
|
/**
|
17
17
|
* Filter the items in an array or one dimensional matrix.
|
18
18
|
*
|
19
|
+
* The callback is invoked with three arguments: the current value,
|
20
|
+
* the current index, and the matrix operated upon.
|
21
|
+
* Note that because the matrix/array might be
|
22
|
+
* multidimensional, the "index" argument is always an array of numbers giving
|
23
|
+
* the index in each dimension. This is true even for vectors: the "index"
|
24
|
+
* argument is an array of length 1, rather than simply a number.
|
25
|
+
*
|
19
26
|
* Syntax:
|
20
27
|
*
|
21
28
|
* math.filter(x, test)
|
@@ -16,6 +16,13 @@ const createForEach = exports.createForEach = /* #__PURE__ */(0, _factory.factor
|
|
16
16
|
/**
|
17
17
|
* Iterate over all elements of a matrix/array, and executes the given callback function.
|
18
18
|
*
|
19
|
+
* The callback is invoked with three arguments: the current value,
|
20
|
+
* the current index, and the matrix operated upon.
|
21
|
+
* Note that because the matrix/array might be
|
22
|
+
* multidimensional, the "index" argument is always an array of numbers giving
|
23
|
+
* the index in each dimension. This is true even for vectors: the "index"
|
24
|
+
* argument is an array of length 1, rather than simply a number.
|
25
|
+
*
|
19
26
|
* Syntax:
|
20
27
|
*
|
21
28
|
* math.forEach(x, callback)
|
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 13.2.
|
10
|
-
* @date 2024-11-
|
9
|
+
* @version 13.2.3
|
10
|
+
* @date 2024-11-20
|
11
11
|
*
|
12
12
|
* @license
|
13
13
|
* Copyright (C) 2013-2024 Jos de Jong <wjosdejong@gmail.com>
|
package/lib/cjs/utils/object.js
CHANGED
@@ -56,6 +56,10 @@ function clone(x) {
|
|
56
56
|
if ((0, _is.isObject)(x)) {
|
57
57
|
return mapObject(x, clone);
|
58
58
|
}
|
59
|
+
if (type === 'function') {
|
60
|
+
// we assume that the function is immutable
|
61
|
+
return x;
|
62
|
+
}
|
59
63
|
throw new TypeError(`Cannot clone: unknown type of value (value: ${x})`);
|
60
64
|
}
|
61
65
|
|
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 = '13.2.
|
7
|
+
const version = exports.version = '13.2.3';
|
8
8
|
// Note: This file is automatically generated when building math.js.
|
9
9
|
// Changes made in this file will be overwritten.
|
@@ -1034,7 +1034,7 @@ export var createParse = /* #__PURE__ */factory(name, dependencies, _ref => {
|
|
1034
1034
|
getTokenSkipNewline(state);
|
1035
1035
|
|
1036
1036
|
// Match the "symbol" part of the pattern, or a left parenthesis
|
1037
|
-
if (state.tokenType === TOKENTYPE.SYMBOL || state.token === '(') {
|
1037
|
+
if (state.tokenType === TOKENTYPE.SYMBOL || state.token === '(' || state.token === 'in') {
|
1038
1038
|
// We've matched the pattern "number / number symbol".
|
1039
1039
|
// Rewind once and build the "number / number" node; the symbol will be consumed later
|
1040
1040
|
_extends(state, tokenStates.pop());
|
@@ -10,6 +10,13 @@ export var createFilter = /* #__PURE__ */factory(name, dependencies, _ref => {
|
|
10
10
|
/**
|
11
11
|
* Filter the items in an array or one dimensional matrix.
|
12
12
|
*
|
13
|
+
* The callback is invoked with three arguments: the current value,
|
14
|
+
* the current index, and the matrix operated upon.
|
15
|
+
* Note that because the matrix/array might be
|
16
|
+
* multidimensional, the "index" argument is always an array of numbers giving
|
17
|
+
* the index in each dimension. This is true even for vectors: the "index"
|
18
|
+
* argument is an array of length 1, rather than simply a number.
|
19
|
+
*
|
13
20
|
* Syntax:
|
14
21
|
*
|
15
22
|
* math.filter(x, test)
|
@@ -10,6 +10,13 @@ export var createForEach = /* #__PURE__ */factory(name, dependencies, _ref => {
|
|
10
10
|
/**
|
11
11
|
* Iterate over all elements of a matrix/array, and executes the given callback function.
|
12
12
|
*
|
13
|
+
* The callback is invoked with three arguments: the current value,
|
14
|
+
* the current index, and the matrix operated upon.
|
15
|
+
* Note that because the matrix/array might be
|
16
|
+
* multidimensional, the "index" argument is always an array of numbers giving
|
17
|
+
* the index in each dimension. This is true even for vectors: the "index"
|
18
|
+
* argument is an array of length 1, rather than simply a number.
|
19
|
+
*
|
13
20
|
* Syntax:
|
14
21
|
*
|
15
22
|
* math.forEach(x, callback)
|
package/lib/esm/utils/object.js
CHANGED
@@ -37,6 +37,10 @@ export function clone(x) {
|
|
37
37
|
if (isObject(x)) {
|
38
38
|
return mapObject(x, clone);
|
39
39
|
}
|
40
|
+
if (type === 'function') {
|
41
|
+
// we assume that the function is immutable
|
42
|
+
return x;
|
43
|
+
}
|
40
44
|
throw new TypeError("Cannot clone: unknown type of value (value: ".concat(x, ")"));
|
41
45
|
}
|
42
46
|
|
package/lib/esm/version.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "mathjs",
|
3
|
-
"version": "13.2.
|
3
|
+
"version": "13.2.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",
|
@@ -69,7 +69,7 @@
|
|
69
69
|
"gulp": "5.0.0",
|
70
70
|
"gulp-babel": "8.0.0",
|
71
71
|
"handlebars": "4.7.8",
|
72
|
-
"jsep": "1.
|
72
|
+
"jsep": "1.4.0",
|
73
73
|
"karma": "6.4.4",
|
74
74
|
"karma-browserstack-launcher": "1.6.0",
|
75
75
|
"karma-firefox-launcher": "2.1.3",
|
package/types/index.d.ts
CHANGED
@@ -1940,8 +1940,7 @@ export interface MathJsInstance extends MathJsFactory {
|
|
1940
1940
|
| ((
|
1941
1941
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
1942
1942
|
value: any,
|
1943
|
-
|
1944
|
-
index: any,
|
1943
|
+
index: number[],
|
1945
1944
|
matrix: MathCollection | string[]
|
1946
1945
|
) => boolean)
|
1947
1946
|
| RegExp
|
@@ -1965,7 +1964,7 @@ export interface MathJsInstance extends MathJsFactory {
|
|
1965
1964
|
forEach<T extends MathCollection>(
|
1966
1965
|
x: T,
|
1967
1966
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
1968
|
-
callback: (value: any, index:
|
1967
|
+
callback: (value: any, index: number[], matrix: T) => void
|
1969
1968
|
): void
|
1970
1969
|
|
1971
1970
|
/**
|
@@ -5714,8 +5713,7 @@ export interface MathJsChain<TValue> {
|
|
5714
5713
|
| ((
|
5715
5714
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5716
5715
|
value: any,
|
5717
|
-
|
5718
|
-
index: any,
|
5716
|
+
index: number[],
|
5719
5717
|
matrix: MathCollection | string[]
|
5720
5718
|
) => boolean)
|
5721
5719
|
| RegExp
|
@@ -5734,7 +5732,7 @@ export interface MathJsChain<TValue> {
|
|
5734
5732
|
forEach<T extends MathCollection>(
|
5735
5733
|
this: MathJsChain<T>,
|
5736
5734
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5737
|
-
callback: (value: any, index:
|
5735
|
+
callback: (value: any, index: number[], matrix: T) => void
|
5738
5736
|
): void
|
5739
5737
|
|
5740
5738
|
/**
|
@@ -5764,7 +5762,7 @@ export interface MathJsChain<TValue> {
|
|
5764
5762
|
map<T extends MathCollection>(
|
5765
5763
|
this: MathJsChain<T>,
|
5766
5764
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5767
|
-
callback: (value: any, index:
|
5765
|
+
callback: (value: any, index: number[], matrix: T) => MathType | string
|
5768
5766
|
): MathJsChain<T>
|
5769
5767
|
|
5770
5768
|
/**
|