umt 1.0.15 → 1.1.1
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/module/Array/arraysJoin.js +1 -10
- package/module/Array/getArraysCommon.d.ts +1 -1
- package/module/Array/getArraysCommon.js +1 -14
- package/module/Array/getArraysDiff.d.ts +3 -3
- package/module/Array/getArraysDiff.js +2 -2
- package/module/Array/index.d.ts +7 -3
- package/module/Array/index.js +10 -28
- package/module/Array/quickSort.js +3 -1
- package/module/Date/DateWrapper.d.ts +4 -0
- package/module/Date/DateWrapper.js +11 -0
- package/module/Date/index.d.ts +8 -3
- package/module/Date/index.js +14 -17
- package/module/Date/new.d.ts +4 -0
- package/module/Date/new.js +12 -0
- package/module/Date/now.d.ts +1 -1
- package/module/Date/now.js +13 -5
- package/module/Math/calculator/core.js +37 -40
- package/module/Math/calculator/exchange.js +2 -2
- package/module/Math/calculator/index.js +5 -4
- package/module/Math/calculator/literalExpression.js +4 -4
- package/module/Math/division.js +13 -9
- package/module/Math/factorial.js +5 -4
- package/module/Math/factorize.js +4 -3
- package/module/Math/gcd.js +14 -10
- package/module/Math/getDecimalLength.js +1 -1
- package/module/Math/index.d.ts +79 -40
- package/module/Math/index.js +81 -125
- package/module/Math/isDouble.js +3 -2
- package/module/Math/isNumber.js +3 -2
- package/module/Math/isPrimeNumber.js +28 -6
- package/module/Math/lcm.js +5 -3
- package/module/Math/mathConverter.js +16 -17
- package/module/Math/multiples.js +1 -1
- package/module/Math/multiplication.js +5 -3
- package/module/Math/nCr.js +2 -1
- package/module/Math/nHr.js +2 -1
- package/module/Math/nPr.js +14 -11
- package/module/Math/primeFactorization.js +5 -4
- package/module/Math/random.d.ts +2 -2
- package/module/Math/random.js +2 -2
- package/module/Math/reduce.js +1 -1
- package/module/Math/repeatedTrial.js +4 -4
- package/module/Math/solveEquation.d.ts +18 -0
- package/module/Math/solveEquation.js +72 -0
- package/module/Math/subtract.js +0 -6
- package/module/Math/valueSwap.js +7 -5
- package/module/Object/index.d.ts +12 -0
- package/module/Object/index.js +15 -0
- package/module/Object/objectUnion.d.ts +5 -0
- package/module/Object/objectUnion.js +7 -0
- package/module/Simple/Date/index.d.ts +1 -1
- package/module/Simple/Date/index.js +2 -16
- package/module/Simple/Date/now.js +7 -7
- package/module/Simple/Tool/birthday.d.ts +1 -1
- package/module/Simple/Tool/birthday.js +6 -6
- package/module/Simple/Tool/dayOfWeekSimple.d.ts +2 -2
- package/module/Simple/Tool/dayOfWeekSimple.js +9 -6
- package/module/Simple/Tool/deviationValueSimple.js +4 -3
- package/module/Simple/Tool/index.d.ts +6 -4
- package/module/Simple/Tool/index.js +6 -22
- package/module/Simple/index.d.ts +4 -3
- package/module/Simple/index.js +6 -21
- package/module/String/index.d.ts +8 -0
- package/module/String/index.js +15 -0
- package/module/String/reverseString.d.ts +1 -0
- package/module/String/reverseString.js +7 -0
- package/module/Tool/birthday.js +1 -2
- package/module/Tool/dayOfWeek.d.ts +1 -1
- package/module/Tool/dayOfWeek.js +2 -2
- package/module/Tool/index.d.ts +8 -3
- package/module/Tool/index.js +12 -31
- package/module/Tool/isBrowser.js +1 -1
- package/module/index.d.ts +14 -6
- package/module/index.js +25 -33
- package/module/tsconfig.tsbuildinfo +1 -1
- package/module/types/clockType.d.ts +9 -0
- package/module/types/dateType.d.ts +11 -0
- package/module/types/dateType.js +2 -0
- package/module/types/int.d.ts +4 -4
- package/module/types/logicType.d.ts +9 -8
- package/package.json +16 -8
- package/.markdownlint.json +0 -6
- package/.nvmrc +0 -1
- package/jest.config.js +0 -16
- package/make_test.py +0 -24
- package/module/Math/softmax.d.ts +0 -5
- package/module/Math/softmax.js +0 -40
- package/module/types/monType.d.ts +0 -8
- /package/module/types/{monType.js → clockType.js} +0 -0
package/module/Math/nCr.js
CHANGED
package/module/Math/nHr.js
CHANGED
package/module/Math/nPr.js
CHANGED
|
@@ -7,31 +7,34 @@ exports.nPr = void 0;
|
|
|
7
7
|
* @param {number} r
|
|
8
8
|
*/
|
|
9
9
|
const nPr = (n, r) => {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
let copyN = n;
|
|
11
|
+
let copyR = r;
|
|
12
|
+
// nPr;
|
|
13
|
+
if (copyN === 0 || copyR === 0) {
|
|
12
14
|
return NaN;
|
|
13
15
|
}
|
|
14
|
-
let y =
|
|
16
|
+
let y = copyN;
|
|
15
17
|
let x = 0;
|
|
16
18
|
while (x === 0) {
|
|
17
|
-
if (
|
|
18
|
-
y *=
|
|
19
|
+
if (copyR === 1) {
|
|
20
|
+
y *= copyR;
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
if (
|
|
22
|
+
copyR--;
|
|
23
|
+
if (copyR === 0) {
|
|
22
24
|
x++;
|
|
23
25
|
}
|
|
24
26
|
else {
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
+
copyN--;
|
|
28
|
+
if (copyN === 0) {
|
|
27
29
|
x++;
|
|
28
30
|
break;
|
|
29
31
|
}
|
|
30
|
-
y *=
|
|
32
|
+
y *= copyN;
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
|
-
if (1 > y)
|
|
35
|
+
if (1 > y) {
|
|
34
36
|
return 0;
|
|
37
|
+
}
|
|
35
38
|
return y;
|
|
36
39
|
};
|
|
37
40
|
exports.nPr = nPr;
|
|
@@ -7,13 +7,14 @@ exports.primeFactorization = void 0;
|
|
|
7
7
|
*/
|
|
8
8
|
const primeFactorization = (x) => {
|
|
9
9
|
let n = 0;
|
|
10
|
+
let cooyX = x;
|
|
10
11
|
const out = [];
|
|
11
|
-
for (let i = 2; i <=
|
|
12
|
-
if (
|
|
12
|
+
for (let i = 2; i <= cooyX; i++) {
|
|
13
|
+
if (cooyX % i === 0) {
|
|
13
14
|
n = 0;
|
|
14
|
-
while (
|
|
15
|
+
while (cooyX % i === 0) {
|
|
15
16
|
n++;
|
|
16
|
-
|
|
17
|
+
cooyX /= i;
|
|
17
18
|
}
|
|
18
19
|
out.push({ number: i, count: n });
|
|
19
20
|
}
|
package/module/Math/random.d.ts
CHANGED
package/module/Math/random.js
CHANGED
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.random = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* 整数の乱数
|
|
6
|
-
* @param {number}
|
|
6
|
+
* @param {number} max 最大値
|
|
7
7
|
* @param {number} min 最小値
|
|
8
8
|
* @return {number}
|
|
9
9
|
*/
|
|
10
|
-
const random = (
|
|
10
|
+
const random = (max, min = 0) => Math.floor(Math.random() * (max - min + 1)) + min;
|
|
11
11
|
exports.random = random;
|
package/module/Math/reduce.js
CHANGED
|
@@ -11,10 +11,10 @@ const nCr_1 = require("./nCr");
|
|
|
11
11
|
* @return {number[]}
|
|
12
12
|
*/
|
|
13
13
|
const repeatedTrial = (n, r, p) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
const x = (0, nCr_1.nCr)(n, r);
|
|
15
|
+
const answer1 = x * Math.pow(p.x, r) * Math.pow(p.y - p.x, n - r);
|
|
16
|
+
const answer2 = Math.pow(p.y, r) * Math.pow(p.y, n - r);
|
|
17
|
+
const greatest_common_divisor = (0, gcd_1.gcd)(answer1, answer2);
|
|
18
18
|
return [
|
|
19
19
|
answer1 / greatest_common_divisor,
|
|
20
20
|
answer2 / greatest_common_divisor,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Solve a system of linear equations using Gauss-Jordan elimination
|
|
3
|
+
* @param {Equation} equation - The system of linear equations
|
|
4
|
+
* @returns {number[]} The solution to the system of linear equations
|
|
5
|
+
* @example
|
|
6
|
+
* x + y = 4
|
|
7
|
+
* x + 2y = 10
|
|
8
|
+
* solveEquation(
|
|
9
|
+
* {
|
|
10
|
+
* coefficients: [
|
|
11
|
+
* [1, 1],
|
|
12
|
+
* [1, 2],
|
|
13
|
+
* ],
|
|
14
|
+
* constants: [4, 10],
|
|
15
|
+
* },
|
|
16
|
+
* ); // [-2, 6]
|
|
17
|
+
*/
|
|
18
|
+
export declare const solveEquation: (coefficients: number[][], constants: number[]) => number[];
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.solveEquation = void 0;
|
|
4
|
+
const addition_1 = require("./addition");
|
|
5
|
+
const division_1 = require("./division");
|
|
6
|
+
const multiplication_1 = require("./multiplication");
|
|
7
|
+
const roundOf_1 = require("./roundOf");
|
|
8
|
+
const subtract_1 = require("./subtract");
|
|
9
|
+
/**
|
|
10
|
+
* Solve a system of linear equations using Gauss-Jordan elimination
|
|
11
|
+
* @param {Equation} equation - The system of linear equations
|
|
12
|
+
* @returns {number[]} The solution to the system of linear equations
|
|
13
|
+
* @example
|
|
14
|
+
* x + y = 4
|
|
15
|
+
* x + 2y = 10
|
|
16
|
+
* solveEquation(
|
|
17
|
+
* {
|
|
18
|
+
* coefficients: [
|
|
19
|
+
* [1, 1],
|
|
20
|
+
* [1, 2],
|
|
21
|
+
* ],
|
|
22
|
+
* constants: [4, 10],
|
|
23
|
+
* },
|
|
24
|
+
* ); // [-2, 6]
|
|
25
|
+
*/
|
|
26
|
+
const solveEquation = (coefficients, constants) => {
|
|
27
|
+
const n = constants.length;
|
|
28
|
+
for (let i = 0; i < n; i++) {
|
|
29
|
+
// Find the max element in the column
|
|
30
|
+
let maxElement = Math.abs(coefficients[i][i]);
|
|
31
|
+
let maxRow = i;
|
|
32
|
+
for (let j = i + 1; j < n; j++) {
|
|
33
|
+
if (Math.abs(coefficients[j][i]) > maxElement) {
|
|
34
|
+
maxElement = Math.abs(coefficients[j][i]);
|
|
35
|
+
maxRow = j;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Swap the row with the max element to the top of the matrix
|
|
39
|
+
for (let j = i; j < n; j++) {
|
|
40
|
+
const tmp = coefficients[maxRow][j];
|
|
41
|
+
coefficients[maxRow][j] = coefficients[i][j];
|
|
42
|
+
coefficients[i][j] = tmp;
|
|
43
|
+
}
|
|
44
|
+
const tmp = constants[maxRow];
|
|
45
|
+
constants[maxRow] = constants[i];
|
|
46
|
+
constants[i] = tmp;
|
|
47
|
+
// Perform elimination on the rows below
|
|
48
|
+
for (let j = i + 1; j < n; j++) {
|
|
49
|
+
// const factor = coefficients[j][i] / coefficients[i][i];
|
|
50
|
+
const factor = (0, division_1.division)(coefficients[j][i], coefficients[i][i]);
|
|
51
|
+
// constants[j] -= factor * constants[i];
|
|
52
|
+
constants[j] = (0, subtract_1.subtract)(constants[j], (0, multiplication_1.multiplication)(factor, constants[i]));
|
|
53
|
+
for (let k = i; k < n; k++) {
|
|
54
|
+
// coefficients[j][k] -= factor * coefficients[i][k];
|
|
55
|
+
coefficients[j][k] = (0, subtract_1.subtract)(coefficients[j][k], (0, multiplication_1.multiplication)(factor, coefficients[i][k]));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const solution = [];
|
|
60
|
+
// Back substitute to find the solution
|
|
61
|
+
for (let i = n - 1; i >= 0; i--) {
|
|
62
|
+
let sum = 0;
|
|
63
|
+
for (let j = i + 1; j < n; j++) {
|
|
64
|
+
// sum += coefficients[i][j] * solution[n - j - 1];
|
|
65
|
+
sum = (0, addition_1.addition)(sum, (0, multiplication_1.multiplication)(coefficients[i][j], solution[(0, subtract_1.subtract)((0, subtract_1.subtract)(n, j), 1)]));
|
|
66
|
+
}
|
|
67
|
+
// solution.push((constants[i] - sum) / coefficients[i][i]);
|
|
68
|
+
solution.push((0, division_1.division)((0, subtract_1.subtract)(constants[i], sum), coefficients[i][i]));
|
|
69
|
+
}
|
|
70
|
+
return solution.reverse().map((x) => (0, roundOf_1.roundOf)(x, 1));
|
|
71
|
+
};
|
|
72
|
+
exports.solveEquation = solveEquation;
|
package/module/Math/subtract.js
CHANGED
|
@@ -10,12 +10,6 @@ const multiplication_1 = require("./multiplication");
|
|
|
10
10
|
* @param {number} y
|
|
11
11
|
*/
|
|
12
12
|
const subtract = (x, y) => {
|
|
13
|
-
if (isNaN(x) || isNaN(y)) {
|
|
14
|
-
throw new Error('x または y が数値ではありません。');
|
|
15
|
-
}
|
|
16
|
-
if (!isFinite(x) || !isFinite(y)) {
|
|
17
|
-
throw new Error('x または y が有限ではありません。');
|
|
18
|
-
}
|
|
19
13
|
// 10の何乗かを取得
|
|
20
14
|
const z = Math.pow(10, (0, max_1.max)((0, getDecimalLength_1.getDecimalLength)(x), (0, getDecimalLength_1.getDecimalLength)(y)));
|
|
21
15
|
// 小数点を揃えてから引き算
|
package/module/Math/valueSwap.js
CHANGED
|
@@ -9,11 +9,13 @@ exports.valueSwap = void 0;
|
|
|
9
9
|
*/
|
|
10
10
|
const valueSwap = (x, y) => {
|
|
11
11
|
let tmp;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
let copyX = x;
|
|
13
|
+
let copyY = y;
|
|
14
|
+
if (copyY < copyX) {
|
|
15
|
+
tmp = copyY;
|
|
16
|
+
copyY = copyX;
|
|
17
|
+
copyX = tmp;
|
|
16
18
|
}
|
|
17
|
-
return [
|
|
19
|
+
return [copyX, copyY];
|
|
18
20
|
};
|
|
19
21
|
exports.valueSwap = valueSwap;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { objectUnion } from "./objectUnion";
|
|
2
|
+
export { objectUnion };
|
|
3
|
+
export declare class UMTObjectClass {
|
|
4
|
+
private localObjectUnion;
|
|
5
|
+
constructor();
|
|
6
|
+
get objectUnion(): <A extends {
|
|
7
|
+
[x: string]: any;
|
|
8
|
+
}, B extends {
|
|
9
|
+
[x: string]: any;
|
|
10
|
+
}, C extends A & B>(array: A, ...arrays: B[]) => C;
|
|
11
|
+
}
|
|
12
|
+
export declare const UMT_Object: UMTObjectClass;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UMT_Object = exports.UMTObjectClass = exports.objectUnion = void 0;
|
|
4
|
+
const objectUnion_1 = require("./objectUnion");
|
|
5
|
+
Object.defineProperty(exports, "objectUnion", { enumerable: true, get: function () { return objectUnion_1.objectUnion; } });
|
|
6
|
+
class UMTObjectClass {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.localObjectUnion = objectUnion_1.objectUnion;
|
|
9
|
+
}
|
|
10
|
+
get objectUnion() {
|
|
11
|
+
return this.localObjectUnion;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.UMTObjectClass = UMTObjectClass;
|
|
15
|
+
exports.UMT_Object = new UMTObjectClass();
|
|
@@ -1,27 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
-
};
|
|
8
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
-
};
|
|
13
|
-
var _UMTSimpleDateClass_Local_now;
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
exports.UMTSimpleDateClass = void 0;
|
|
16
4
|
const now_1 = require("./now");
|
|
17
5
|
class UMTSimpleDateClass {
|
|
18
6
|
constructor() {
|
|
19
|
-
|
|
20
|
-
__classPrivateFieldSet(this, _UMTSimpleDateClass_Local_now, now_1.nowSimple, "f");
|
|
7
|
+
this.localNow = now_1.nowSimple;
|
|
21
8
|
}
|
|
22
9
|
get now() {
|
|
23
|
-
return
|
|
10
|
+
return this.localNow;
|
|
24
11
|
}
|
|
25
12
|
}
|
|
26
13
|
exports.UMTSimpleDateClass = UMTSimpleDateClass;
|
|
27
|
-
_UMTSimpleDateClass_Local_now = new WeakMap();
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.nowSimple = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const now_1 = require("../../Date/now");
|
|
5
|
+
const isNumber_1 = require("../../Math/isNumber");
|
|
6
6
|
const nowSimple = (timeDifference = 9) => {
|
|
7
|
-
if (typeof timeDifference ===
|
|
8
|
-
return (0,
|
|
7
|
+
if (typeof timeDifference === "number") {
|
|
8
|
+
return (0, now_1.now)(timeDifference);
|
|
9
9
|
}
|
|
10
|
-
else if ((0,
|
|
11
|
-
return (0,
|
|
10
|
+
else if ((0, isNumber_1.isNumber)(timeDifference)) {
|
|
11
|
+
return (0, now_1.now)(Number(timeDifference));
|
|
12
12
|
}
|
|
13
13
|
else {
|
|
14
|
-
return (0,
|
|
14
|
+
return (0, now_1.now)();
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
exports.nowSimple = nowSimple;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MonthsWihout31Days, MonthsWith31Days, dayType } from "../../types/dateType";
|
|
2
2
|
export interface BIRTHDAYSIMPLE {
|
|
3
3
|
<T extends MonthsWith31Days | MonthsWihout31Days>(birthdays: Date | `${number}-${T}-${dayType<T>}` | `${number}:${T}:${dayType<T>}` | `${number}/${T}/${dayType<T>}` | {
|
|
4
4
|
yer: number;
|
|
@@ -3,17 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.birthdaySimple = void 0;
|
|
4
4
|
const birthday_1 = require("../../Tool/birthday");
|
|
5
5
|
exports.birthdaySimple = ((birthdays, timeDifference = 9) => {
|
|
6
|
-
if (typeof birthdays ===
|
|
7
|
-
if (birthdays.includes(
|
|
8
|
-
const [yer, mon, day] = birthdays.split(
|
|
6
|
+
if (typeof birthdays === "string") {
|
|
7
|
+
if (birthdays.includes(":")) {
|
|
8
|
+
const [yer, mon, day] = birthdays.split(":").map(Number);
|
|
9
9
|
return (0, birthday_1.birthday)(yer, mon, day, timeDifference);
|
|
10
10
|
}
|
|
11
|
-
else if (birthdays.includes(
|
|
12
|
-
const [yer, mon, day] = birthdays.split(
|
|
11
|
+
else if (birthdays.includes("/")) {
|
|
12
|
+
const [yer, mon, day] = birthdays.split("/").map(Number);
|
|
13
13
|
return (0, birthday_1.birthday)(yer, mon, day, timeDifference);
|
|
14
14
|
}
|
|
15
15
|
else {
|
|
16
|
-
const [yer, mon, day] = birthdays.split(
|
|
16
|
+
const [yer, mon, day] = birthdays.split("-").map(Number);
|
|
17
17
|
return (0, birthday_1.birthday)(yer, mon, day, timeDifference);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { dayType
|
|
2
|
-
export declare const dayOfWeekSimple: <T extends
|
|
1
|
+
import { dayType } from "../../types/dateType";
|
|
2
|
+
export declare const dayOfWeekSimple: <T extends "01" | "02" | "03" | "04" | "05" | "06" | "07" | "08" | "09" | "10" | "11" | "12" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "0">(props?: Date | {
|
|
3
3
|
yer?: number | undefined;
|
|
4
4
|
mon?: T | undefined;
|
|
5
5
|
day?: dayType<T> | undefined;
|
|
@@ -3,22 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.dayOfWeekSimple = void 0;
|
|
4
4
|
const dayOfWeek_1 = require("../../Tool/dayOfWeek");
|
|
5
5
|
const dayOfWeekSimple = (props, timeDifference = 9) => {
|
|
6
|
-
if (typeof props ===
|
|
7
|
-
if (props.includes(
|
|
6
|
+
if (typeof props === "string") {
|
|
7
|
+
if (props.includes(":")) {
|
|
8
8
|
const [yer, mon, day] = props
|
|
9
|
-
.split(
|
|
9
|
+
.split(":")
|
|
10
|
+
// rome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
10
11
|
.map(Number);
|
|
11
12
|
return (0, dayOfWeek_1.dayOfWeek)({ yer, mon, day }, timeDifference);
|
|
12
13
|
}
|
|
13
|
-
else if (props.includes(
|
|
14
|
+
else if (props.includes("/")) {
|
|
14
15
|
const [yer, mon, day] = props
|
|
15
|
-
.split(
|
|
16
|
+
.split("/")
|
|
17
|
+
// rome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
16
18
|
.map(Number);
|
|
17
19
|
return (0, dayOfWeek_1.dayOfWeek)({ yer, mon, day }, timeDifference);
|
|
18
20
|
}
|
|
19
21
|
else {
|
|
20
22
|
const [yer, mon, day] = props
|
|
21
|
-
.split(
|
|
23
|
+
.split("-")
|
|
24
|
+
// rome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
22
25
|
.map(Number);
|
|
23
26
|
return (0, dayOfWeek_1.dayOfWeek)({ yer, mon, day }, timeDifference);
|
|
24
27
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deviationValueSimple = void 0;
|
|
4
|
-
const
|
|
4
|
+
const average_1 = require("../../Math/average");
|
|
5
5
|
const deviationValue_1 = require("../../Math/deviationValue");
|
|
6
|
+
const standardDeviation_1 = require("../../Math/standardDeviation");
|
|
6
7
|
exports.deviationValueSimple = ((value, averageValue, standardDeviationValue) => {
|
|
7
8
|
if (Array.isArray(averageValue)) {
|
|
8
|
-
const x = (0,
|
|
9
|
-
return (0, deviationValue_1.deviationValue)(value, x, (0,
|
|
9
|
+
const x = (0, average_1.average)(averageValue);
|
|
10
|
+
return (0, deviationValue_1.deviationValue)(value, x, (0, standardDeviation_1.standardDeviation)(averageValue));
|
|
10
11
|
}
|
|
11
12
|
else {
|
|
12
13
|
return (0, deviationValue_1.deviationValue)(value, averageValue, standardDeviationValue);
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export declare class UMTSimpleToolClass {
|
|
2
|
-
|
|
2
|
+
private localBirthday;
|
|
3
|
+
private localDayOfWeek;
|
|
4
|
+
private localDeviationValue;
|
|
3
5
|
constructor();
|
|
4
6
|
get birthday(): import("./birthday").BIRTHDAYSIMPLE;
|
|
5
|
-
get dayOfWeek(): <T extends
|
|
7
|
+
get dayOfWeek(): <T extends "01" | "02" | "03" | "04" | "05" | "06" | "07" | "08" | "09" | "10" | "11" | "12" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "0">(props?: Date | {
|
|
6
8
|
yer?: number | undefined;
|
|
7
9
|
mon?: T | undefined;
|
|
8
|
-
day?: import("../../types/
|
|
9
|
-
} | `${number}-${T}-${import("../../types/
|
|
10
|
+
day?: import("../../types/dateType").dayType<T> | undefined;
|
|
11
|
+
} | `${number}-${T}-${import("../../types/dateType").dayType<T>}` | `${number}:${T}:${import("../../types/dateType").dayType<T>}` | `${number}/${T}/${import("../../types/dateType").dayType<T>}` | undefined, timeDifference?: number) => number;
|
|
10
12
|
get deviationValue(): import("./deviationValueSimple").DeviationValueSimple;
|
|
11
13
|
}
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
-
};
|
|
8
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
-
};
|
|
13
|
-
var _UMTSimpleToolClass_Local_birthday, _UMTSimpleToolClass_Local_dayOfWeek, _UMTSimpleToolClass_Local_deviationValue;
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
exports.UMTSimpleToolClass = void 0;
|
|
16
4
|
const birthday_1 = require("./birthday");
|
|
@@ -18,22 +6,18 @@ const dayOfWeekSimple_1 = require("./dayOfWeekSimple");
|
|
|
18
6
|
const deviationValueSimple_1 = require("./deviationValueSimple");
|
|
19
7
|
class UMTSimpleToolClass {
|
|
20
8
|
constructor() {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
__classPrivateFieldSet(this, _UMTSimpleToolClass_Local_dayOfWeek, dayOfWeekSimple_1.dayOfWeekSimple, "f");
|
|
25
|
-
__classPrivateFieldSet(this, _UMTSimpleToolClass_Local_deviationValue, deviationValueSimple_1.deviationValueSimple, "f");
|
|
26
|
-
__classPrivateFieldSet(this, _UMTSimpleToolClass_Local_birthday, birthday_1.birthdaySimple, "f");
|
|
9
|
+
this.localDayOfWeek = dayOfWeekSimple_1.dayOfWeekSimple;
|
|
10
|
+
this.localDeviationValue = deviationValueSimple_1.deviationValueSimple;
|
|
11
|
+
this.localBirthday = birthday_1.birthdaySimple;
|
|
27
12
|
}
|
|
28
13
|
get birthday() {
|
|
29
|
-
return
|
|
14
|
+
return this.localBirthday;
|
|
30
15
|
}
|
|
31
16
|
get dayOfWeek() {
|
|
32
|
-
return
|
|
17
|
+
return this.localDayOfWeek;
|
|
33
18
|
}
|
|
34
19
|
get deviationValue() {
|
|
35
|
-
return
|
|
20
|
+
return this.localDeviationValue;
|
|
36
21
|
}
|
|
37
22
|
}
|
|
38
23
|
exports.UMTSimpleToolClass = UMTSimpleToolClass;
|
|
39
|
-
_UMTSimpleToolClass_Local_birthday = new WeakMap(), _UMTSimpleToolClass_Local_dayOfWeek = new WeakMap(), _UMTSimpleToolClass_Local_deviationValue = new WeakMap();
|
package/module/Simple/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { UMTSimpleDateClass } from './Date/index';
|
|
2
2
|
import { UMTSimpleToolClass } from './Tool';
|
|
3
3
|
export declare class UMTSimpleClass<LOCALDATE, LOCALTOOL> {
|
|
4
|
-
|
|
4
|
+
private localDate;
|
|
5
|
+
private localTool;
|
|
5
6
|
constructor(constructorLocalDateValue: LOCALDATE, constructorLocalToolValue: LOCALTOOL);
|
|
6
|
-
get
|
|
7
|
-
get
|
|
7
|
+
get getDate(): LOCALDATE;
|
|
8
|
+
get getTool(): LOCALTOOL;
|
|
8
9
|
}
|
|
9
10
|
export declare const UMT_Simple: UMTSimpleClass<UMTSimpleDateClass, UMTSimpleToolClass>;
|
package/module/Simple/index.js
CHANGED
|
@@ -1,34 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
-
};
|
|
8
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
-
};
|
|
13
|
-
var _UMTSimpleClass_Local_Date, _UMTSimpleClass_Local_Tool;
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
exports.UMT_Simple = exports.UMTSimpleClass = void 0;
|
|
16
4
|
const index_1 = require("./Date/index");
|
|
17
5
|
const Tool_1 = require("./Tool");
|
|
18
6
|
class UMTSimpleClass {
|
|
19
7
|
constructor(constructorLocalDateValue, constructorLocalToolValue) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
__classPrivateFieldSet(this, _UMTSimpleClass_Local_Date, constructorLocalDateValue, "f");
|
|
23
|
-
__classPrivateFieldSet(this, _UMTSimpleClass_Local_Tool, constructorLocalToolValue, "f");
|
|
8
|
+
this.localDate = constructorLocalDateValue;
|
|
9
|
+
this.localTool = constructorLocalToolValue;
|
|
24
10
|
}
|
|
25
|
-
get
|
|
26
|
-
return
|
|
11
|
+
get getDate() {
|
|
12
|
+
return this.localDate;
|
|
27
13
|
}
|
|
28
|
-
get
|
|
29
|
-
return
|
|
14
|
+
get getTool() {
|
|
15
|
+
return this.localTool;
|
|
30
16
|
}
|
|
31
17
|
}
|
|
32
18
|
exports.UMTSimpleClass = UMTSimpleClass;
|
|
33
|
-
_UMTSimpleClass_Local_Date = new WeakMap(), _UMTSimpleClass_Local_Tool = new WeakMap();
|
|
34
19
|
exports.UMT_Simple = new UMTSimpleClass(new index_1.UMTSimpleDateClass(), new Tool_1.UMTSimpleToolClass());
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { reverseString } from "./reverseString";
|
|
2
|
+
export { reverseString };
|
|
3
|
+
export declare class UMTStringClass {
|
|
4
|
+
private localReverseString;
|
|
5
|
+
constructor();
|
|
6
|
+
get reverseString(): (str: string) => string;
|
|
7
|
+
}
|
|
8
|
+
export declare const UMT_String: UMTStringClass;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UMT_String = exports.UMTStringClass = exports.reverseString = void 0;
|
|
4
|
+
const reverseString_1 = require("./reverseString");
|
|
5
|
+
Object.defineProperty(exports, "reverseString", { enumerable: true, get: function () { return reverseString_1.reverseString; } });
|
|
6
|
+
class UMTStringClass {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.localReverseString = reverseString_1.reverseString;
|
|
9
|
+
}
|
|
10
|
+
get reverseString() {
|
|
11
|
+
return this.localReverseString;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.UMTStringClass = UMTStringClass;
|
|
15
|
+
exports.UMT_String = new UMTStringClass();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const reverseString: (str: string) => string;
|