@khanacademy/kmath 0.1.23 → 0.2.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.
- package/dist/es/index.js +10045 -9
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +10046 -8
- package/dist/index.js.map +1 -1
- package/dist/math.d.ts +29 -0
- package/package.json +2 -2
package/dist/math.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { MathFormat } from "@khanacademy/perseus-core";
|
|
2
|
+
declare const KhanMath: {
|
|
3
|
+
readonly cleanMath: (expr: string) => string;
|
|
4
|
+
readonly bound: (num: number) => number;
|
|
5
|
+
readonly factorial: (x: number) => number;
|
|
6
|
+
readonly getGCD: (a: number, b: number) => number;
|
|
7
|
+
readonly getLCM: (a: number, b: number) => number;
|
|
8
|
+
readonly primes: readonly [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97];
|
|
9
|
+
readonly isPrime: (n: number) => boolean;
|
|
10
|
+
readonly getPrimeFactorization: (number: number) => ReadonlyArray<number>;
|
|
11
|
+
readonly roundToNearest: (increment: number, num: number) => number;
|
|
12
|
+
readonly roundTo: (precision: number, num: number) => number;
|
|
13
|
+
/**
|
|
14
|
+
* Return a string of num rounded to a fixed precision decimal places,
|
|
15
|
+
* with an approx symbol if num had to be rounded, and trailing 0s
|
|
16
|
+
*/
|
|
17
|
+
readonly toFixedApprox: (num: number, precision: number) => string;
|
|
18
|
+
/**
|
|
19
|
+
* Return a string of num rounded to precision decimal places, with an
|
|
20
|
+
* approx symbol if num had to be rounded, but no trailing 0s if it was
|
|
21
|
+
* not rounded.
|
|
22
|
+
*/
|
|
23
|
+
readonly roundToApprox: (num: number, precision: number) => string;
|
|
24
|
+
readonly toFraction: (decimal: number, tolerance?: number) => [number, number];
|
|
25
|
+
readonly getNumericFormat: (text: string) => MathFormat | null | undefined;
|
|
26
|
+
readonly toNumericString: (number: number, format?: MathFormat) => string;
|
|
27
|
+
};
|
|
28
|
+
export declare function sum(array: number[]): number;
|
|
29
|
+
export default KhanMath;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Khan Academy's Javascript Numeric Math Utilities",
|
|
4
4
|
"author": "Khan Academy",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.2.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"test": "bash -c 'yarn --silent --cwd \"../..\" test ${@:0} $($([[ ${@: -1} = -* ]] || [[ ${@: -1} = bash ]]) && echo $PWD)'"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@khanacademy/perseus-core": "3.0
|
|
28
|
+
"@khanacademy/perseus-core": "3.1.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"perseus-build-settings": "^0.4.3",
|