mathjs 12.0.0 → 12.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/HISTORY.md +18 -3
- 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/embeddedDocs/function/arithmetic/round.js +2 -2
- package/lib/cjs/function/algebra/derivative.js +8 -31
- package/lib/cjs/function/arithmetic/gcd.js +4 -5
- package/lib/cjs/function/arithmetic/mod.js +2 -9
- package/lib/cjs/function/arithmetic/round.js +59 -16
- package/lib/cjs/function/probability/pickRandom.js +2 -2
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/type/number.js +2 -2
- package/lib/cjs/utils/snapshot.js +6 -6
- package/lib/cjs/version.js +1 -1
- package/lib/esm/expression/embeddedDocs/function/arithmetic/round.js +2 -2
- package/lib/esm/function/algebra/derivative.js +8 -31
- package/lib/esm/function/arithmetic/mod.js +2 -9
- package/lib/esm/function/arithmetic/round.js +40 -17
- package/lib/esm/function/probability/pickRandom.js +2 -2
- package/lib/esm/type/number.js +2 -2
- package/lib/esm/version.js +1 -1
- package/package.json +13 -13
- package/types/index.d.ts +29 -7
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "mathjs",
|
3
|
-
"version": "12.
|
3
|
+
"version": "12.1.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",
|
@@ -36,29 +36,29 @@
|
|
36
36
|
"typed-function": "^4.1.1"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
|
-
"@babel/core": "7.23.
|
40
|
-
"@babel/plugin-transform-object-assign": "7.
|
41
|
-
"@babel/plugin-transform-runtime": "7.23.
|
42
|
-
"@babel/preset-env": "7.23.
|
39
|
+
"@babel/core": "7.23.3",
|
40
|
+
"@babel/plugin-transform-object-assign": "7.23.3",
|
41
|
+
"@babel/plugin-transform-runtime": "7.23.3",
|
42
|
+
"@babel/preset-env": "7.23.3",
|
43
43
|
"@babel/register": "7.22.15",
|
44
|
-
"@types/assert": "1.5.
|
45
|
-
"@types/mocha": "10.0.
|
46
|
-
"@typescript-eslint/eslint-plugin": "6.
|
47
|
-
"@typescript-eslint/parser": "6.
|
44
|
+
"@types/assert": "1.5.9",
|
45
|
+
"@types/mocha": "10.0.4",
|
46
|
+
"@typescript-eslint/eslint-plugin": "6.11.0",
|
47
|
+
"@typescript-eslint/parser": "6.11.0",
|
48
48
|
"assert": "2.1.0",
|
49
49
|
"babel-loader": "9.1.3",
|
50
50
|
"benchmark": "2.1.4",
|
51
51
|
"c8": "8.0.1",
|
52
52
|
"codecov": "3.8.3",
|
53
|
-
"core-js": "3.33.
|
53
|
+
"core-js": "3.33.2",
|
54
54
|
"del": "6.1.1",
|
55
55
|
"dtslint": "4.2.1",
|
56
|
-
"eslint": "8.
|
56
|
+
"eslint": "8.53.0",
|
57
57
|
"eslint-config-prettier": "9.0.0",
|
58
58
|
"eslint-config-standard": "17.1.0",
|
59
59
|
"eslint-plugin-import": "2.29.0",
|
60
60
|
"eslint-plugin-mocha": "10.2.0",
|
61
|
-
"eslint-plugin-n": "16.
|
61
|
+
"eslint-plugin-n": "16.3.1",
|
62
62
|
"eslint-plugin-prettier": "5.0.1",
|
63
63
|
"eslint-plugin-promise": "6.1.1",
|
64
64
|
"expect-type": "0.17.3",
|
@@ -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.0
|
88
|
+
"prettier": "3.1.0",
|
89
89
|
"process": "0.11.10",
|
90
90
|
"sylvester": "0.0.21",
|
91
91
|
"ts-node": "10.9.1",
|
package/types/index.d.ts
CHANGED
@@ -5,10 +5,10 @@ export as namespace math
|
|
5
5
|
export type NoLiteralType<T> = T extends number
|
6
6
|
? number
|
7
7
|
: T extends string
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
? string
|
9
|
+
: T extends boolean
|
10
|
+
? boolean
|
11
|
+
: T
|
12
12
|
|
13
13
|
// TODO: introduce generics for MathCollection, MathMatrix, and MathArray
|
14
14
|
export type MathNumericType = number | BigNumber | Fraction | Complex
|
@@ -1104,6 +1104,10 @@ export interface MathJsInstance extends MathJsFactory {
|
|
1104
1104
|
n?: number | BigNumber
|
1105
1105
|
): NoLiteralType<T>
|
1106
1106
|
round<U extends MathCollection>(x: MathNumericType, n: U): U
|
1107
|
+
round<U extends MathCollection>(x: U, unit: Unit): U
|
1108
|
+
round(x: Unit, unit: Unit): Unit
|
1109
|
+
round(x: Unit, n: number | BigNumber, unit: Unit): Unit
|
1110
|
+
round<U extends MathCollection>(x: U, n: number | BigNumber, unit: Unit): U
|
1107
1111
|
|
1108
1112
|
// End of group of rounding functions
|
1109
1113
|
|
@@ -2275,9 +2279,8 @@ export interface MathJsInstance extends MathJsFactory {
|
|
2275
2279
|
* @param array A one dimensional array
|
2276
2280
|
* @param number An int or float
|
2277
2281
|
* @param weights An array of ints or floats
|
2278
|
-
* @returns Returns a single random value from array when number is
|
2279
|
-
*
|
2280
|
-
* when number is > 1.
|
2282
|
+
* @returns Returns a single random value from array when number is undefined.
|
2283
|
+
* Returns an array with the configured number of elements when number is defined.
|
2281
2284
|
*/
|
2282
2285
|
pickRandom<T>(array: T[]): T
|
2283
2286
|
pickRandom<T>(array: T[], number: number): T[]
|
@@ -4741,6 +4744,25 @@ export interface MathJsChain<TValue> {
|
|
4741
4744
|
this: MathJsChain<T>,
|
4742
4745
|
n?: number | BigNumber | MathCollection
|
4743
4746
|
): MathJsChain<T>
|
4747
|
+
round<U extends MathCollection>(
|
4748
|
+
this: MathJsChain<MathNumericType | U>,
|
4749
|
+
n: U
|
4750
|
+
): MathJsChain<U>
|
4751
|
+
round(this: MathJsChain<Unit>, unit: Unit): MathJsChain<Unit>
|
4752
|
+
round<U extends MathCollection>(
|
4753
|
+
this: MathJsChain<U>,
|
4754
|
+
unit: Unit
|
4755
|
+
): MathJsChain<U>
|
4756
|
+
round(
|
4757
|
+
this: MathJsChain<Unit>,
|
4758
|
+
n: number | BigNumber,
|
4759
|
+
unit: Unit
|
4760
|
+
): MathJsChain<Unit>
|
4761
|
+
round<U extends MathCollection>(
|
4762
|
+
this: MathJsChain<U>,
|
4763
|
+
n: number | BigNumber,
|
4764
|
+
unit: Unit
|
4765
|
+
): MathJsChain<U>
|
4744
4766
|
|
4745
4767
|
// End of rounding group
|
4746
4768
|
|