mathjs 10.6.0 → 10.6.1
Sign up to get free protection for your applications and to get access to all the features.
- package/HISTORY.md +6 -0
- package/lib/browser/math.js +6 -5
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/version.js +1 -1
- package/lib/esm/version.js +1 -1
- package/package.json +14 -14
- package/types/index.d.ts +57 -13
- package/types/index.ts +20 -4
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 10.6.
|
10
|
-
* @date 2022-05-
|
9
|
+
* @version 10.6.1
|
10
|
+
* @date 2022-05-31
|
11
11
|
*
|
12
12
|
* @license
|
13
13
|
* Copyright (C) 2013-2022 Jos de Jong <wjosdejong@gmail.com>
|
package/lib/cjs/version.js
CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.version = void 0;
|
7
|
-
var version = '10.6.
|
7
|
+
var version = '10.6.1'; // Note: This file is automatically generated when building math.js.
|
8
8
|
// Changes made in this file will be overwritten.
|
9
9
|
|
10
10
|
exports.version = version;
|
package/lib/esm/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export var version = '10.6.
|
1
|
+
export var version = '10.6.1'; // Note: This file is automatically generated when building math.js.
|
2
2
|
// Changes made in this file will be overwritten.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "mathjs",
|
3
|
-
"version": "10.6.
|
3
|
+
"version": "10.6.1",
|
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.
|
28
|
+
"@babel/runtime": "^7.18.3",
|
29
29
|
"complex.js": "^2.1.1",
|
30
30
|
"decimal.js": "^10.3.1",
|
31
31
|
"escape-latex": "^1.2.0",
|
@@ -36,27 +36,27 @@
|
|
36
36
|
"typed-function": "^2.1.0"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
|
-
"@babel/core": "7.
|
39
|
+
"@babel/core": "7.18.2",
|
40
40
|
"@babel/plugin-transform-object-assign": "7.16.7",
|
41
|
-
"@babel/plugin-transform-runtime": "7.
|
42
|
-
"@babel/preset-env": "7.
|
41
|
+
"@babel/plugin-transform-runtime": "7.18.2",
|
42
|
+
"@babel/preset-env": "7.18.2",
|
43
43
|
"@babel/register": "7.17.7",
|
44
44
|
"@types/assert": "1.5.6",
|
45
45
|
"@types/mocha": "9.1.1",
|
46
|
-
"@typescript-eslint/eslint-plugin": "5.
|
47
|
-
"@typescript-eslint/parser": "5.
|
46
|
+
"@typescript-eslint/eslint-plugin": "5.27.0",
|
47
|
+
"@typescript-eslint/parser": "5.27.0",
|
48
48
|
"assert": "2.0.0",
|
49
49
|
"babel-loader": "8.2.5",
|
50
50
|
"benchmark": "2.1.4",
|
51
51
|
"codecov": "3.8.3",
|
52
|
-
"core-js": "3.22.
|
53
|
-
"del": "6.
|
52
|
+
"core-js": "3.22.7",
|
53
|
+
"del": "6.1.1",
|
54
54
|
"dtslint": "4.2.1",
|
55
|
-
"eslint": "8.
|
55
|
+
"eslint": "8.16.0",
|
56
56
|
"eslint-config-prettier": "8.5.0",
|
57
57
|
"eslint-config-standard": "17.0.0",
|
58
58
|
"eslint-plugin-import": "2.26.0",
|
59
|
-
"eslint-plugin-mocha": "10.0.
|
59
|
+
"eslint-plugin-mocha": "10.0.5",
|
60
60
|
"eslint-plugin-n": "15.2.0",
|
61
61
|
"eslint-plugin-prettier": "4.0.0",
|
62
62
|
"eslint-plugin-promise": "6.0.0",
|
@@ -69,7 +69,7 @@
|
|
69
69
|
"handlebars": "4.7.7",
|
70
70
|
"istanbul": "0.4.5",
|
71
71
|
"jsep": "1.3.6",
|
72
|
-
"karma": "6.3.
|
72
|
+
"karma": "6.3.20",
|
73
73
|
"karma-browserstack-launcher": "1.6.0",
|
74
74
|
"karma-firefox-launcher": "2.1.2",
|
75
75
|
"karma-mocha": "2.0.1",
|
@@ -89,8 +89,8 @@
|
|
89
89
|
"prettier": "2.6.2",
|
90
90
|
"process": "0.11.10",
|
91
91
|
"sylvester": "0.0.21",
|
92
|
-
"ts-node": "10.
|
93
|
-
"typescript": "4.
|
92
|
+
"ts-node": "10.8.0",
|
93
|
+
"typescript": "4.7.2",
|
94
94
|
"webpack": "4.46.0",
|
95
95
|
"zeros": "1.0.0"
|
96
96
|
},
|
package/types/index.d.ts
CHANGED
@@ -276,25 +276,67 @@ declare namespace math {
|
|
276
276
|
new (properties: Record<string, MathNode>): ObjectNode
|
277
277
|
}
|
278
278
|
|
279
|
-
|
279
|
+
type OperatorNodeMap = {
|
280
|
+
xor: 'xor'
|
281
|
+
and: 'and'
|
282
|
+
bitOr: '|'
|
283
|
+
bitXor: '^|'
|
284
|
+
bitAnd: '&'
|
285
|
+
equal: '=='
|
286
|
+
unequal: '!='
|
287
|
+
smaller: '<'
|
288
|
+
larger: '>'
|
289
|
+
smallerEq: '<='
|
290
|
+
leftShift: '<<'
|
291
|
+
rightArithShift: '>>'
|
292
|
+
rightLogShift: '>>>'
|
293
|
+
to: 'to'
|
294
|
+
add: '+'
|
295
|
+
subtract: '-'
|
296
|
+
multiply: '*'
|
297
|
+
divide: '/'
|
298
|
+
dotMultiply: '.*'
|
299
|
+
dotDivide: './'
|
300
|
+
mod: 'mod'
|
301
|
+
unaryPlus: '+'
|
302
|
+
unaryMinus: '-'
|
303
|
+
bitNot: '~'
|
304
|
+
not: 'not'
|
305
|
+
pow: '^'
|
306
|
+
dotPow: '.^'
|
307
|
+
factorial: '!'
|
308
|
+
}
|
309
|
+
|
310
|
+
type OperatorNodeOp = OperatorNodeMap[keyof OperatorNodeMap]
|
311
|
+
type OperatorNodeFn = keyof OperatorNodeMap
|
312
|
+
|
313
|
+
interface OperatorNode<
|
314
|
+
TOp extends OperatorNodeMap[TFn] = never,
|
315
|
+
TFn extends OperatorNodeFn = never,
|
316
|
+
TArgs extends MathNode[] = MathNode[]
|
317
|
+
> extends MathNodeCommon {
|
280
318
|
type: 'OperatorNode'
|
281
319
|
isOperatorNode: true
|
282
|
-
op:
|
283
|
-
fn:
|
284
|
-
args:
|
320
|
+
op: TOp
|
321
|
+
fn: TFn
|
322
|
+
args: TArgs
|
285
323
|
implicit: boolean
|
286
324
|
isUnary(): boolean
|
287
325
|
isBinary(): boolean
|
288
326
|
}
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
327
|
+
|
328
|
+
interface OperatorNodeCtor extends MathNodeCommon {
|
329
|
+
new <
|
330
|
+
TOp extends OperatorNodeMap[TFn],
|
331
|
+
TFn extends OperatorNodeFn,
|
332
|
+
TArgs extends MathNode[]
|
333
|
+
>(
|
334
|
+
op: TOp,
|
335
|
+
fn: TFn,
|
336
|
+
args: TArgs,
|
294
337
|
implicit?: boolean
|
295
|
-
): OperatorNode
|
338
|
+
): OperatorNode<TOp, TFn, TArgs>
|
296
339
|
}
|
297
|
-
|
298
340
|
interface ParenthesisNode extends MathNodeCommon {
|
299
341
|
type: 'ParenthesisNode'
|
300
342
|
isParenthesisNode: true
|
@@ -345,7 +387,7 @@ declare namespace math {
|
|
345
387
|
| FunctionNode
|
346
388
|
| IndexNode
|
347
389
|
| ObjectNode
|
348
|
-
| OperatorNode
|
390
|
+
| OperatorNode<OperatorNodeOp, OperatorNodeFn>
|
349
391
|
| ParenthesisNode
|
350
392
|
| RangeNode
|
351
393
|
| RelationalNode
|
@@ -3095,7 +3137,9 @@ declare namespace math {
|
|
3095
3137
|
|
3096
3138
|
isObjectNode(x: unknown): x is ObjectNode
|
3097
3139
|
|
3098
|
-
isOperatorNode(
|
3140
|
+
isOperatorNode(
|
3141
|
+
x: unknown
|
3142
|
+
): x is OperatorNode<OperatorNodeOp, OperatorNodeFn>
|
3099
3143
|
|
3100
3144
|
isParenthesisNode(x: unknown): x is ParenthesisNode
|
3101
3145
|
|
package/types/index.ts
CHANGED
@@ -25,6 +25,9 @@ import {
|
|
25
25
|
MathNumericType,
|
26
26
|
ConstantNode,
|
27
27
|
OperatorNode,
|
28
|
+
OperatorNodeFn,
|
29
|
+
OperatorNodeOp,
|
30
|
+
SymbolNode,
|
28
31
|
} from 'mathjs'
|
29
32
|
import * as assert from 'assert'
|
30
33
|
import { expectTypeOf } from 'expect-type'
|
@@ -1527,23 +1530,34 @@ Function round examples
|
|
1527
1530
|
*/
|
1528
1531
|
{
|
1529
1532
|
const math = create(all, {})
|
1533
|
+
expectTypeOf(
|
1534
|
+
new math.OperatorNode('/', 'divide', [
|
1535
|
+
new math.ConstantNode(3),
|
1536
|
+
new math.SymbolNode('x'),
|
1537
|
+
])
|
1538
|
+
).toMatchTypeOf<OperatorNode<'/', 'divide', (ConstantNode | SymbolNode)[]>>()
|
1539
|
+
|
1530
1540
|
expectTypeOf(new math.ConstantNode(1).clone()).toMatchTypeOf<ConstantNode>()
|
1531
1541
|
expectTypeOf(
|
1532
1542
|
new math.OperatorNode('*', 'multiply', [
|
1533
1543
|
new math.ConstantNode(3),
|
1534
1544
|
new math.SymbolNode('x'),
|
1535
1545
|
]).clone()
|
1536
|
-
).toMatchTypeOf<
|
1546
|
+
).toMatchTypeOf<
|
1547
|
+
OperatorNode<'*', 'multiply', (ConstantNode | SymbolNode)[]>
|
1548
|
+
>()
|
1537
1549
|
|
1538
1550
|
expectTypeOf(
|
1539
1551
|
new math.ConstantNode(1).cloneDeep()
|
1540
1552
|
).toMatchTypeOf<ConstantNode>()
|
1541
1553
|
expectTypeOf(
|
1542
|
-
new math.OperatorNode('
|
1554
|
+
new math.OperatorNode('+', 'unaryPlus', [
|
1543
1555
|
new math.ConstantNode(3),
|
1544
1556
|
new math.SymbolNode('x'),
|
1545
1557
|
]).cloneDeep()
|
1546
|
-
).toMatchTypeOf<
|
1558
|
+
).toMatchTypeOf<
|
1559
|
+
OperatorNode<'+', 'unaryPlus', (ConstantNode | SymbolNode)[]>
|
1560
|
+
>()
|
1547
1561
|
|
1548
1562
|
expectTypeOf(
|
1549
1563
|
math.clone(new math.ConstantNode(1))
|
@@ -1900,7 +1914,9 @@ Factory Test
|
|
1900
1914
|
expectTypeOf(x).toMatchTypeOf<math.ObjectNode>()
|
1901
1915
|
}
|
1902
1916
|
if (math.isOperatorNode(x)) {
|
1903
|
-
expectTypeOf(x).toMatchTypeOf<
|
1917
|
+
expectTypeOf(x).toMatchTypeOf<
|
1918
|
+
OperatorNode<OperatorNodeOp, OperatorNodeFn, MathNode[]>
|
1919
|
+
>()
|
1904
1920
|
}
|
1905
1921
|
if (math.isParenthesisNode(x)) {
|
1906
1922
|
expectTypeOf(x).toMatchTypeOf<math.ParenthesisNode>()
|