math-exercises 2.2.5 → 2.2.7
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/lib/exercises/math/calcul/addAndSub.js +1 -1
- package/lib/exercises/math/calcul/addAndSubWithoutRelatives.js +1 -1
- package/lib/exercises/math/calcul/digitDecimalRank.d.ts.map +1 -1
- package/lib/exercises/math/calcul/digitDecimalRank.js +2 -3
- package/lib/exercises/math/calcul/digitDecimalRankNumber.d.ts +8 -0
- package/lib/exercises/math/calcul/digitDecimalRankNumber.d.ts.map +1 -0
- package/lib/exercises/math/calcul/digitDecimalRankNumber.js +59 -0
- package/lib/exercises/math/calcul/digitRank.d.ts.map +1 -1
- package/lib/exercises/math/calcul/digitRank.js +2 -3
- package/lib/exercises/math/calcul/digitRankNumber.d.ts.map +1 -1
- package/lib/exercises/math/calcul/digitRankNumber.js +3 -5
- package/lib/exercises/math/calcul/index.d.ts +1 -0
- package/lib/exercises/math/calcul/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/index.js +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/index.d.ts +2 -0
- package/lib/exercises/math/calcul/mentalCaluls/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/index.js +2 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSub.js +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSubNoRelative.d.ts +7 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSubNoRelative.d.ts.map +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSubNoRelative.js +71 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplications.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplications.js +25 -17
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationsNoRelative.d.ts +7 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationsNoRelative.d.ts.map +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationsNoRelative.js +93 -0
- package/lib/exercises/math/calcul/operations/expressionNature.d.ts +1 -0
- package/lib/exercises/math/calcul/operations/expressionNature.d.ts.map +1 -0
- package/lib/exercises/math/calcul/operations/expressionNature.js +81 -0
- package/lib/exercises/math/functions/basics/inverseImageFunctionTable.d.ts +2 -0
- package/lib/exercises/math/functions/basics/inverseImageFunctionTable.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/inverseImageFunctionTable.js +46 -66
- package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationByFactorisation.js +1 -1
- package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationFromCano.js +1 -1
- package/lib/exercises/math/geometry/cartesian/placeAPoint.d.ts +4 -1
- package/lib/exercises/math/geometry/cartesian/placeAPoint.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/placeAPoint.js +1 -1
- package/lib/exercises/math/percent/averageEvolutionRate.d.ts.map +1 -1
- package/lib/exercises/math/percent/averageEvolutionRate.js +16 -0
- package/lib/exercises/math/percent/cmToEvolution.d.ts +7 -0
- package/lib/exercises/math/percent/cmToEvolution.d.ts.map +1 -0
- package/lib/exercises/math/percent/cmToEvolution.js +70 -0
- package/lib/exercises/math/percent/evolutionToCM.d.ts +0 -1
- package/lib/exercises/math/percent/evolutionToCM.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutionToCM.js +20 -24
- package/lib/exercises/math/percent/findProportion.d.ts.map +1 -1
- package/lib/exercises/math/percent/findProportion.js +15 -0
- package/lib/exercises/math/percent/globalPercent.d.ts.map +1 -1
- package/lib/exercises/math/percent/globalPercent.js +14 -0
- package/lib/exercises/math/percent/index.d.ts +1 -0
- package/lib/exercises/math/percent/index.d.ts.map +1 -1
- package/lib/exercises/math/percent/index.js +1 -0
- package/lib/exercises/math/percent/isTableProportional.d.ts.map +1 -1
- package/lib/exercises/math/percent/isTableProportional.js +35 -33
- package/lib/exercises/math/percent/percentToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/percent/percentToDecimal.js +14 -0
- package/lib/exercises/math/percent/reciprocalPercentage.d.ts.map +1 -1
- package/lib/exercises/math/percent/reciprocalPercentage.js +18 -0
- package/lib/exercises/math/percent/valuePercent.d.ts.map +1 -1
- package/lib/exercises/math/percent/valuePercent.js +7 -0
- package/lib/exercises/math/powers/powersProduct.d.ts.map +1 -1
- package/lib/exercises/math/powers/powersProduct.js +22 -0
- package/lib/exercises/math/probaStat/expectedValueOfBinomialProba.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/expectedValueOfBinomialProba.js +14 -2
- package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableNoContext.js +5 -4
- package/lib/exercises/math/probaStat/varianceOfBinomialProba.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/varianceOfBinomialProba.js +21 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticExplicitFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticExplicitFormulaUsage.js +15 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormula.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormula.js +17 -0
- package/lib/exercises/math/sequences/geometric/geometricExplicitFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricExplicitFormulaUsage.js +13 -0
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.js +15 -0
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorCoordinatesFromPoints.d.ts.map +1 -1
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorCoordinatesFromPoints.js +15 -0
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.d.ts.map +1 -1
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.js +26 -1
- package/lib/exercises/math/suites/sequenceEvaluation.js +1 -1
- package/lib/exercises/math/suites/sequencePlot.d.ts.map +1 -1
- package/lib/exercises/math/suites/sequencePlot.js +10 -3
- package/lib/index.d.ts +48 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -0
- package/lib/math/geometry/spaceVector.d.ts +1 -0
- package/lib/math/geometry/spaceVector.d.ts.map +1 -1
- package/lib/math/geometry/spaceVector.js +3 -0
- package/lib/math/polynomials/trinom.js +2 -2
- package/lib/math/utils/random/randTupleInt.d.ts +1 -0
- package/lib/math/utils/random/randTupleInt.d.ts.map +1 -1
- package/lib/math/utils/random/randTupleInt.js +5 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +2 -13
- package/lib/server.d.ts +1 -0
- package/lib/server.d.ts.map +1 -1
- package/lib/server.js +6 -2
- package/lib/utils/numberPrototype/toSeparatedThousands.d.ts +2 -0
- package/lib/utils/numberPrototype/toSeparatedThousands.d.ts.map +1 -0
- package/lib/utils/numberPrototype/toSeparatedThousands.js +12 -0
- package/package.json +1 -1
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAI3D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;QAC5B,SAAS,EAAE,MAAM,MAAM,CAAC;QACxB,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;KACpD;IACD,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAI3D,OAAO,CAAC,MAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -31,6 +31,9 @@ const PCExercises = __importStar(require("./exercises/pc"));
|
|
|
31
31
|
const infiniteNode_1 = require("./tree/nodes/numbers/infiniteNode");
|
|
32
32
|
const toScientific_1 = require("./utils/numberPrototype/toScientific");
|
|
33
33
|
const variableNode_1 = require("./tree/nodes/variables/variableNode");
|
|
34
|
+
String.prototype.unfrenchify = function () {
|
|
35
|
+
return Number(this.valueOf().replace(",", "."));
|
|
36
|
+
};
|
|
34
37
|
String.prototype.toTree = function () {
|
|
35
38
|
return new variableNode_1.VariableNode(this.valueOf());
|
|
36
39
|
};
|
|
@@ -14,6 +14,7 @@ export declare class SpaceVector {
|
|
|
14
14
|
z: AlgebraicNode;
|
|
15
15
|
constructor(name: string, x: AlgebraicNode, y: AlgebraicNode, z: AlgebraicNode);
|
|
16
16
|
toTex(): string;
|
|
17
|
+
toCoordsTex(): string;
|
|
17
18
|
toInlineCoordsTex(): string;
|
|
18
19
|
toTexWithCoords(): string;
|
|
19
20
|
isColinear(v: SpaceVector): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spaceVector.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/spaceVector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,OAAO,EAAE,IAAI,EAAY,MAAM,uBAAuB,CAAC;AAQvD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,8BAAsB,sBAAsB;IAC1C,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,WAAW;IAQnE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,UAAO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M,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,UAAO,GAAG,WAAW;IAY1D,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,UAAO,GAAG,WAAW,EAAE;CAW1E;AAED,qBAAa,WAAW;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;gBAEf,IAAI,EAAE,MAAM,EACZ,CAAC,EAAE,aAAa,EAChB,CAAC,EAAE,aAAa,EAChB,CAAC,EAAE,aAAa;IASlB,KAAK,IAAI,MAAM;IAIf,WAAW,IAAI,MAAM;IAGrB,iBAAiB,IAAI,MAAM;IAK3B,eAAe,IAAI,MAAM;IAMzB,UAAU,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO;IAGnC,WAAW,CAAC,CAAC,EAAE,WAAW,GAAG,aAAa;IAI1C,KAAK,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,MAAM;IAQrC,aAAa,CAAC,CAAC,EAAE,WAAW,GAAG,IAAI;IAInC,GAAG,CAAC,CAAC,EAAE,WAAW,GAAG,WAAW;IAShC,OAAO,IAAI,aAAa;IAYxB,WAAW,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,MAAM;IAQjD,MAAM,CAAC,CAAC,EAAE,WAAW;CAGtB"}
|
|
@@ -47,6 +47,9 @@ class SpaceVector {
|
|
|
47
47
|
toTex() {
|
|
48
48
|
return `\\overrightarrow{${this.name}}`;
|
|
49
49
|
}
|
|
50
|
+
toCoordsTex() {
|
|
51
|
+
return `\\begin{pmatrix}${this.x.toTex()} \\\\ ${this.y.toTex()} \\\\ ${this.z.toTex()} \\end{pmatrix}`;
|
|
52
|
+
}
|
|
50
53
|
toInlineCoordsTex() {
|
|
51
54
|
return `\\left(${this.x.simplify().toTex()};${this.y
|
|
52
55
|
.simplify()
|
|
@@ -179,14 +179,14 @@ class Trinom extends polynomial_1.Polynomial {
|
|
|
179
179
|
const alpha = this.getAlpha();
|
|
180
180
|
let square;
|
|
181
181
|
if (alpha !== 0) {
|
|
182
|
-
square = new powerNode_1.SquareNode(new addNode_1.AddNode(new variableNode_1.VariableNode(this.variable), new oppositeNode_1.OppositeNode(this.getAlphaNode())));
|
|
182
|
+
square = new powerNode_1.SquareNode(new addNode_1.AddNode(new variableNode_1.VariableNode(this.variable), new oppositeNode_1.OppositeNode(this.getAlphaNode()).simplify()));
|
|
183
183
|
}
|
|
184
184
|
else {
|
|
185
185
|
square = new powerNode_1.SquareNode(new variableNode_1.VariableNode(this.variable));
|
|
186
186
|
}
|
|
187
187
|
const beta = this.getBeta();
|
|
188
188
|
return beta !== 0
|
|
189
|
-
? new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(this.a), square),
|
|
189
|
+
? new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(this.a), square), this.getBetaNode())
|
|
190
190
|
: new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(this.a), square);
|
|
191
191
|
}
|
|
192
192
|
getSommet() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"randTupleInt.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/random/randTupleInt.ts"],"names":[],"mappings":"AAGA,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"randTupleInt.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/random/randTupleInt.ts"],"names":[],"mappings":"AAGA,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,SACjB,MAAM,WACH,mBAAmB,KAC3B,MAAM,EAUR,CAAC;AAEF,eAAO,MAAM,oBAAoB,OAC3B,MAAM,QACJ,MAAM,WACH,mBAAmB,KAC3B,MAAM,EAAE,EAUV,CAAC"}
|
|
@@ -11,7 +11,11 @@ const randint_1 = require("./randint");
|
|
|
11
11
|
const randTupleInt = (size, options) => {
|
|
12
12
|
const res = [];
|
|
13
13
|
for (let i = 0; i < size; i++) {
|
|
14
|
-
|
|
14
|
+
let x;
|
|
15
|
+
do {
|
|
16
|
+
x = (0, randint_1.randint)(options.from, options.to, options.excludes);
|
|
17
|
+
} while (options.allDifferent && res.includes(x));
|
|
18
|
+
res.push(x);
|
|
15
19
|
}
|
|
16
20
|
return res;
|
|
17
21
|
};
|
package/lib/playground.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,UAAU,YAEtB,CAAC"}
|
package/lib/playground.js
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.playground = void 0;
|
|
4
|
-
const
|
|
5
|
-
const addNode_1 = require("./tree/nodes/operators/addNode");
|
|
6
|
-
const multiplyNode_1 = require("./tree/nodes/operators/multiplyNode");
|
|
7
|
-
const random_1 = require("./utils/random");
|
|
8
|
-
const shuffle_1 = require("./utils/shuffle");
|
|
4
|
+
const toSeparatedThousands_1 = require("./utils/numberPrototype/toSeparatedThousands");
|
|
9
5
|
const playground = () => {
|
|
10
|
-
|
|
11
|
-
const permut = [
|
|
12
|
-
(0, shuffle_1.shuffle)([affines[0], affines[1]]),
|
|
13
|
-
(0, shuffle_1.shuffle)([affines[0], affines[2]]),
|
|
14
|
-
];
|
|
15
|
-
const operation = (0, random_1.random)(["add", "substract"]);
|
|
16
|
-
const statementTree = new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(permut[0][0].toTree(), permut[0][1].toTree()), new multiplyNode_1.MultiplyNode(permut[1][0].toTree(), permut[1][1].toTree()));
|
|
17
|
-
console.log(statementTree.simplify().toTex());
|
|
6
|
+
console.log((0, toSeparatedThousands_1.toSeperatedThousands)("12345,6789"));
|
|
18
7
|
};
|
|
19
8
|
exports.playground = playground;
|
package/lib/server.d.ts
CHANGED
package/lib/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAuC3D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;QAC5B,SAAS,EAAE,MAAM,MAAM,CAAC;QACxB,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;KACpD;IACD,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAuC3D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;QAC5B,SAAS,EAAE,MAAM,MAAM,CAAC;QACxB,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;KACpD;IACD,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;QAC5B,WAAW,EAAE,MAAM,MAAM,CAAC;KAC3B;CACF"}
|
package/lib/server.js
CHANGED
|
@@ -37,6 +37,7 @@ const numberNode_1 = require("./tree/nodes/numbers/numberNode");
|
|
|
37
37
|
const infiniteNode_1 = require("./tree/nodes/numbers/infiniteNode");
|
|
38
38
|
const toScientific_1 = require("./utils/numberPrototype/toScientific");
|
|
39
39
|
const variableNode_1 = require("./tree/nodes/variables/variableNode");
|
|
40
|
+
const playground_1 = require("./playground");
|
|
40
41
|
const jsonParser = body_parser_1.default.json();
|
|
41
42
|
const mathExercises = Object.values(MathExercises);
|
|
42
43
|
const pcExercises = Object.values(PCExercises);
|
|
@@ -44,6 +45,9 @@ const allExercises = [...mathExercises, ...pcExercises];
|
|
|
44
45
|
String.prototype.toTree = function () {
|
|
45
46
|
return new variableNode_1.VariableNode(this.valueOf());
|
|
46
47
|
};
|
|
48
|
+
String.prototype.unfrenchify = function () {
|
|
49
|
+
return Number(this.valueOf().replace(",", "."));
|
|
50
|
+
};
|
|
47
51
|
Number.prototype.toTree = function () {
|
|
48
52
|
const value = this.valueOf();
|
|
49
53
|
if (value === Infinity)
|
|
@@ -64,8 +68,8 @@ const runServer = () => {
|
|
|
64
68
|
app.use((0, cors_1.default)());
|
|
65
69
|
console.log("math exos", mathExercises.length);
|
|
66
70
|
console.log("math hints", mathExercises.filter((exo) => exo.hasHintAndCorrection).length);
|
|
67
|
-
console.log("pc exos", pcExercises.length);
|
|
68
|
-
|
|
71
|
+
console.log("pc exos", `${pcExercises.length}`);
|
|
72
|
+
(0, playground_1.playground)();
|
|
69
73
|
app.get("/", (req, res) => {
|
|
70
74
|
res.json(allExercises);
|
|
71
75
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toSeparatedThousands.d.ts","sourceRoot":"","sources":["../../../src/utils/numberPrototype/toSeparatedThousands.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,MAAO,MAAM,WAQ7C,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toSeperatedThousands = void 0;
|
|
4
|
+
const toSeperatedThousands = (t) => {
|
|
5
|
+
const n = t.unfrenchify();
|
|
6
|
+
if (isNaN(n))
|
|
7
|
+
throw Error("NaN passed to toSeperatedThousands");
|
|
8
|
+
const [intPart, fracPart] = t.split(",");
|
|
9
|
+
return (intPart.replace(/\B(?=(\d{3})+(?!\d))/g, "\\ ") +
|
|
10
|
+
(fracPart !== undefined ? "," + fracPart : ""));
|
|
11
|
+
};
|
|
12
|
+
exports.toSeperatedThousands = toSeperatedThousands;
|