umt 1.0.10 → 1.0.11
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/.markdownlint.json +4 -1
- package/README.md +11 -4
- package/lib/.clang-format +200 -0
- package/lib/1.s +259 -0
- package/lib/Makefile +5 -0
- package/lib/index.cpp +10 -0
- package/lib/index.s +238 -0
- package/module/Array/arraysJoin.d.ts +1 -2
- package/module/Array/arraysJoin.js +2 -1
- package/module/Array/getArraysCommon.d.ts +6 -0
- package/module/Array/getArraysCommon.js +25 -0
- package/module/Array/getArraysDiff.d.ts +1 -2
- package/module/Array/getArraysDiff.js +15 -7
- package/module/Array/index.d.ts +16 -5
- package/module/Array/index.js +54 -11
- package/module/Array/quickSort.d.ts +1 -2
- package/module/Array/quickSort.js +4 -3
- package/module/Array/sum.d.ts +1 -0
- package/module/Array/sum.js +8 -0
- package/module/Compiler/core.d.ts +5 -0
- package/module/Compiler/core.js +19 -0
- package/module/Compiler/token.d.ts +10 -0
- package/module/Compiler/token.js +120 -0
- package/module/Date/index.d.ts +7 -1
- package/module/Date/index.js +26 -5
- package/module/Date/now.d.ts +5 -2
- package/module/Date/now.js +10 -3
- package/module/Math/addition.d.ts +2 -2
- package/module/Math/addition.js +8 -9
- package/module/Math/average.d.ts +2 -2
- package/module/Math/average.js +3 -1
- package/module/Math/calculator/core.d.ts +1 -5
- package/module/Math/calculator/core.js +76 -55
- package/module/Math/calculator/exchange.d.ts +1 -5
- package/module/Math/calculator/exchange.js +16 -12
- package/module/Math/calculator/index.d.ts +2 -5
- package/module/Math/calculator/index.js +13 -8
- package/module/Math/calculator/literalExpression.d.ts +2 -2
- package/module/Math/calculator/literalExpression.js +20 -13
- package/module/Math/degToRad.d.ts +2 -2
- package/module/Math/degToRad.js +3 -1
- package/module/Math/deviationValue.d.ts +8 -0
- package/module/Math/deviationValue.js +14 -0
- package/module/Math/division.d.ts +7 -2
- package/module/Math/division.js +20 -9
- package/module/Math/factorial.d.ts +2 -2
- package/module/Math/factorial.js +10 -4
- package/module/Math/factorize.d.ts +2 -2
- package/module/Math/factorize.js +3 -1
- package/module/Math/gcd.d.ts +2 -2
- package/module/Math/gcd.js +6 -7
- package/module/Math/getDecimalLength.d.ts +2 -2
- package/module/Math/getDecimalLength.js +3 -1
- package/module/Math/index.d.ts +94 -33
- package/module/Math/index.js +278 -67
- package/module/Math/isDouble.d.ts +3 -2
- package/module/Math/isDouble.js +4 -1
- package/module/Math/isNumber.d.ts +3 -3
- package/module/Math/isNumber.js +4 -2
- package/module/Math/isPrimeNumber.d.ts +2 -2
- package/module/Math/isPrimeNumber.js +5 -6
- package/module/Math/lcm.d.ts +2 -2
- package/module/Math/lcm.js +7 -8
- package/module/Math/mathConverter.d.ts +5 -0
- package/module/Math/mathConverter.js +48 -0
- package/module/Math/mathSeparator.d.ts +5 -0
- package/module/Math/mathSeparator.js +21 -0
- package/module/Math/max.d.ts +1 -2
- package/module/Math/max.js +3 -2
- package/module/Math/min.d.ts +1 -2
- package/module/Math/min.js +3 -2
- package/module/Math/multiples.d.ts +1 -2
- package/module/Math/multiples.js +2 -1
- package/module/Math/multiplication.d.ts +1 -2
- package/module/Math/multiplication.js +4 -6
- package/module/Math/nCr.d.ts +1 -2
- package/module/Math/nCr.js +4 -6
- package/module/Math/nHr.d.ts +1 -2
- package/module/Math/nHr.js +4 -6
- package/module/Math/nPr.d.ts +1 -2
- package/module/Math/nPr.js +2 -1
- package/module/Math/primeFactorization.d.ts +1 -2
- package/module/Math/primeFactorization.js +2 -1
- package/module/Math/quotient.d.ts +1 -2
- package/module/Math/quotient.js +2 -1
- package/module/Math/radToDeg.d.ts +1 -2
- package/module/Math/radToDeg.js +2 -1
- package/module/Math/random.d.ts +3 -2
- package/module/Math/random.js +5 -2
- package/module/Math/reduce.d.ts +1 -2
- package/module/Math/reduce.js +5 -7
- package/module/Math/repeatedTrial.d.ts +2 -2
- package/module/Math/repeatedTrial.js +7 -8
- package/module/Math/roundOff.d.ts +7 -0
- package/module/Math/roundOff.js +14 -0
- package/module/Math/softmax.d.ts +5 -0
- package/module/Math/softmax.js +40 -0
- package/module/Math/standardDeviation.d.ts +1 -2
- package/module/Math/standardDeviation.js +5 -7
- package/module/Math/subtract.d.ts +1 -2
- package/module/Math/subtract.js +9 -9
- package/module/Math/toBinary.d.ts +5 -2
- package/module/Math/toBinary.js +4 -4
- package/module/Math/toCelsius.d.ts +1 -2
- package/module/Math/toCelsius.js +4 -6
- package/module/Math/toKelvin.d.ts +1 -2
- package/module/Math/toKelvin.js +4 -6
- package/module/Math/valueSwap.d.ts +2 -2
- package/module/Math/valueSwap.js +3 -1
- package/module/Simple/Date/index.d.ts +5 -0
- package/module/Simple/Date/index.js +27 -0
- package/module/Simple/Date/now.d.ts +1 -0
- package/module/Simple/Date/now.js +17 -0
- package/module/Simple/Math/dayOfWeek.d.ts +6 -0
- package/module/Simple/Math/dayOfWeek.js +31 -0
- package/module/Simple/Math/deviationValue.d.ts +5 -0
- package/module/Simple/Math/deviationValue.js +14 -0
- package/module/Simple/Math/index.d.ts +10 -0
- package/module/Simple/Math/index.js +33 -0
- package/module/Simple/Tool/birthday.d.ts +9 -0
- package/module/Simple/Tool/birthday.js +26 -0
- package/module/Simple/Tool/index.d.ts +5 -0
- package/module/Simple/Tool/index.js +27 -0
- package/module/Simple/index.d.ts +11 -0
- package/module/Simple/index.js +40 -0
- package/module/Tool/birthday.d.ts +8 -2
- package/module/Tool/birthday.js +15 -10
- package/module/Tool/dayOfWeek.d.ts +5 -6
- package/module/Tool/dayOfWeek.js +12 -2
- package/module/Tool/index.d.ts +18 -3
- package/module/Tool/index.js +58 -9
- package/module/Tool/isBrowser.d.ts +1 -0
- package/module/Tool/isBrowser.js +4 -0
- package/module/Tool/isNode.d.ts +1 -0
- package/module/Tool/isNode.js +4 -0
- package/module/Tool/isNodeWebkit.d.ts +1 -0
- package/module/Tool/isNodeWebkit.js +6 -0
- package/module/Tool/pipeFunction.d.ts +1 -2
- package/module/Tool/pipeFunction.js +3 -2
- package/module/index.d.ts +10 -11
- package/module/index.js +49 -33
- package/module/tsconfig.tsbuildinfo +1 -1
- package/module/types/int.d.ts +4 -0
- package/module/{Math/value.js → types/int.js} +0 -2
- package/module/types/logicType.d.ts +8 -0
- package/module/types/logicType.js +2 -0
- package/module/types/monType.d.ts +4 -0
- package/module/types/monType.js +2 -0
- package/package.json +18 -18
- package/.env +0 -1
- package/.github/dependabot.yml +0 -11
- package/.github/workflows/node.js.yml +0 -30
- package/module/Array/getArraysIntersect.d.ts +0 -7
- package/module/Array/getArraysIntersect.js +0 -15
- package/module/Math/euclideanAlgorithm.d.ts +0 -8
- package/module/Math/euclideanAlgorithm.js +0 -31
- package/module/Math/value.d.ts +0 -2
- package/sider.yml +0 -60
- package/test.js +0 -5
package/module/Math/subtract.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
3
|
+
exports.subtract = void 0;
|
|
4
|
+
const getDecimalLength_1 = require("./getDecimalLength");
|
|
5
|
+
const max_1 = require("./max");
|
|
6
|
+
const multiplication_1 = require("./multiplication");
|
|
9
7
|
/**
|
|
10
8
|
* 誤差のない引き算
|
|
11
9
|
* @param {number} x
|
|
12
10
|
* @param {number} y
|
|
13
11
|
*/
|
|
14
12
|
const subtract = (x, y) => {
|
|
15
|
-
const z = Math.pow(10, (0, max_1.
|
|
16
|
-
return ((0, multiplication_1.
|
|
13
|
+
const z = Math.pow(10, (0, max_1.max)((0, getDecimalLength_1.getDecimalLength)(x), (0, getDecimalLength_1.getDecimalLength)(y)));
|
|
14
|
+
return (((0, multiplication_1.multiplication)(x, z) -
|
|
15
|
+
(0, multiplication_1.multiplication)(y, z)) /
|
|
16
|
+
z);
|
|
17
17
|
};
|
|
18
|
-
exports.
|
|
18
|
+
exports.subtract = subtract;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
export interface TOBINARY {
|
|
2
|
+
(): (x: number, radix?: number) => string;
|
|
3
|
+
(x: number, radix?: number): string;
|
|
4
|
+
}
|
|
1
5
|
/**
|
|
2
6
|
* n進数に変換
|
|
3
7
|
* @param {number} x
|
|
4
8
|
* @param {number} [radix=2] n進数
|
|
5
9
|
*/
|
|
6
|
-
declare const toBinary:
|
|
7
|
-
export default toBinary;
|
|
10
|
+
export declare const toBinary: TOBINARY;
|
package/module/Math/toBinary.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toBinary = void 0;
|
|
3
4
|
/**
|
|
4
5
|
* n進数に変換
|
|
5
6
|
* @param {number} x
|
|
6
7
|
* @param {number} [radix=2] n進数
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
+
exports.toBinary = ((x, radix = 2) => {
|
|
9
10
|
if (typeof x === 'undefined') {
|
|
10
|
-
return (x, radix = 2) => toBinary(x, radix);
|
|
11
|
+
return (x, radix = 2) => (0, exports.toBinary)(x, radix);
|
|
11
12
|
}
|
|
12
13
|
return x.toString(radix);
|
|
13
|
-
};
|
|
14
|
-
exports.default = toBinary;
|
|
14
|
+
});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare const toCelsius: (kelvin: number) => number;
|
|
2
|
-
export default toCelsius;
|
|
1
|
+
export declare const toCelsius: (kelvin: number) => number;
|
package/module/Math/toCelsius.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
3
|
+
exports.toCelsius = void 0;
|
|
4
|
+
const subtract_1 = require("./subtract");
|
|
5
|
+
const toCelsius = (kelvin) => (0, subtract_1.subtract)(kelvin, 273.15);
|
|
6
|
+
exports.toCelsius = toCelsius;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare const toKelvin: (celsius: number) => number;
|
|
2
|
-
export default toKelvin;
|
|
1
|
+
export declare const toKelvin: (celsius: number) => number;
|
package/module/Math/toKelvin.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
3
|
+
exports.toKelvin = void 0;
|
|
4
|
+
const addition_1 = require("./addition");
|
|
5
|
+
const toKelvin = (celsius) => (0, addition_1.addition)(celsius, 273.15);
|
|
6
|
+
exports.toKelvin = toKelvin;
|
package/module/Math/valueSwap.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.valueSwap = void 0;
|
|
3
4
|
/**
|
|
4
5
|
* x < yになるように入れ替える
|
|
5
6
|
* @param {number} x
|
|
6
7
|
* @param {number} y
|
|
8
|
+
* @return {number[]}
|
|
7
9
|
*/
|
|
8
10
|
const valueSwap = (x, y) => {
|
|
9
11
|
let tmp;
|
|
@@ -14,4 +16,4 @@ const valueSwap = (x, y) => {
|
|
|
14
16
|
}
|
|
15
17
|
return [x, y];
|
|
16
18
|
};
|
|
17
|
-
exports.
|
|
19
|
+
exports.valueSwap = valueSwap;
|
|
@@ -0,0 +1,27 @@
|
|
|
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_Localnow;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.UMTSimpleDateClass = void 0;
|
|
16
|
+
const now_1 = require("./now");
|
|
17
|
+
class UMTSimpleDateClass {
|
|
18
|
+
constructor() {
|
|
19
|
+
_UMTSimpleDateClass_Localnow.set(this, void 0);
|
|
20
|
+
__classPrivateFieldSet(this, _UMTSimpleDateClass_Localnow, now_1.nowSimple, "f");
|
|
21
|
+
}
|
|
22
|
+
get now() {
|
|
23
|
+
return __classPrivateFieldGet(this, _UMTSimpleDateClass_Localnow, "f");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.UMTSimpleDateClass = UMTSimpleDateClass;
|
|
27
|
+
_UMTSimpleDateClass_Localnow = new WeakMap();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const nowSimple: (timeDifference?: number | string) => Date;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nowSimple = void 0;
|
|
4
|
+
const Date_1 = require("../../Date");
|
|
5
|
+
const Math_1 = require("../../Math");
|
|
6
|
+
const nowSimple = (timeDifference = 9) => {
|
|
7
|
+
if (typeof timeDifference === 'number') {
|
|
8
|
+
return (0, Date_1.now)(timeDifference);
|
|
9
|
+
}
|
|
10
|
+
else if ((0, Math_1.isNumber)(timeDifference)) {
|
|
11
|
+
return (0, Date_1.now)(Number(timeDifference));
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
return (0, Date_1.now)();
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
exports.nowSimple = nowSimple;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { dayType, MonthsWihout31Days, MonthsWith31Days } from '../../types/monType';
|
|
2
|
+
export declare const dayOfWeekSimple: <T extends MonthsWith31Days | MonthsWihout31Days>(props?: Date | {
|
|
3
|
+
yer?: number | undefined;
|
|
4
|
+
mon?: number | undefined;
|
|
5
|
+
day?: number | undefined;
|
|
6
|
+
} | `${number}-${T}-${dayType<T>}` | `${number}:${T}:${dayType<T>}` | `${number}/${T}/${dayType<T>}` | undefined, timeDifference?: number) => number;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dayOfWeekSimple = void 0;
|
|
4
|
+
const dayOfWeek_1 = require("../../Tool/dayOfWeek");
|
|
5
|
+
const dayOfWeekSimple = (props, timeDifference = 9) => {
|
|
6
|
+
if (typeof props === 'string') {
|
|
7
|
+
if (props.includes(':')) {
|
|
8
|
+
const [yer, mon, day] = props.split(':').map(Number);
|
|
9
|
+
return (0, dayOfWeek_1.dayOfWeek)({ yer, mon, day }, timeDifference);
|
|
10
|
+
}
|
|
11
|
+
else if (props.includes('/')) {
|
|
12
|
+
const [yer, mon, day] = props.split('/').map(Number);
|
|
13
|
+
return (0, dayOfWeek_1.dayOfWeek)({ yer, mon, day }, timeDifference);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
const [yer, mon, day] = props.split('-').map(Number);
|
|
17
|
+
return (0, dayOfWeek_1.dayOfWeek)({ yer, mon, day }, timeDifference);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else if (props instanceof Date) {
|
|
21
|
+
return (0, dayOfWeek_1.dayOfWeek)({
|
|
22
|
+
yer: props.getFullYear(),
|
|
23
|
+
mon: props.getMonth(),
|
|
24
|
+
day: props.getDate(),
|
|
25
|
+
}, timeDifference);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return (0, dayOfWeek_1.dayOfWeek)(props, timeDifference);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.dayOfWeekSimple = dayOfWeekSimple;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deviationValueSimple = void 0;
|
|
4
|
+
const Math_1 = require("../../Math");
|
|
5
|
+
const deviationValue_1 = require("../../Math/deviationValue");
|
|
6
|
+
exports.deviationValueSimple = ((value, averageValue, standardDeviationValue) => {
|
|
7
|
+
if (Array.isArray(averageValue)) {
|
|
8
|
+
const x = (0, Math_1.average)(averageValue);
|
|
9
|
+
return (0, deviationValue_1.deviationValue)(value, x, (0, Math_1.standardDeviation)(averageValue));
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
return (0, deviationValue_1.deviationValue)(value, averageValue, standardDeviationValue);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class UMTSimpleMathClass {
|
|
2
|
+
#private;
|
|
3
|
+
constructor();
|
|
4
|
+
get dayOfWeek(): <T extends import("../../types/monType").MonthsWith31Days | import("../../types/monType").MonthsWihout31Days>(props?: Date | {
|
|
5
|
+
yer?: number | undefined;
|
|
6
|
+
mon?: number | undefined;
|
|
7
|
+
day?: number | undefined;
|
|
8
|
+
} | `${number}-${T}-${import("../../types/monType").dayType<T>}` | `${number}:${T}:${import("../../types/monType").dayType<T>}` | `${number}/${T}/${import("../../types/monType").dayType<T>}` | undefined, timeDifference?: number) => number;
|
|
9
|
+
get deviationValue(): import("./deviationValue").DeviationValueSimple;
|
|
10
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
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 _UMTSimpleMathClass_LocaldayOfWeek, _UMTSimpleMathClass_LocaldeviationValue;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.UMTSimpleMathClass = void 0;
|
|
16
|
+
const dayOfWeek_1 = require("./dayOfWeek");
|
|
17
|
+
const deviationValue_1 = require("./deviationValue");
|
|
18
|
+
class UMTSimpleMathClass {
|
|
19
|
+
constructor() {
|
|
20
|
+
_UMTSimpleMathClass_LocaldayOfWeek.set(this, void 0);
|
|
21
|
+
_UMTSimpleMathClass_LocaldeviationValue.set(this, void 0);
|
|
22
|
+
__classPrivateFieldSet(this, _UMTSimpleMathClass_LocaldayOfWeek, dayOfWeek_1.dayOfWeekSimple, "f");
|
|
23
|
+
__classPrivateFieldSet(this, _UMTSimpleMathClass_LocaldeviationValue, deviationValue_1.deviationValueSimple, "f");
|
|
24
|
+
}
|
|
25
|
+
get dayOfWeek() {
|
|
26
|
+
return __classPrivateFieldGet(this, _UMTSimpleMathClass_LocaldayOfWeek, "f");
|
|
27
|
+
}
|
|
28
|
+
get deviationValue() {
|
|
29
|
+
return __classPrivateFieldGet(this, _UMTSimpleMathClass_LocaldeviationValue, "f");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.UMTSimpleMathClass = UMTSimpleMathClass;
|
|
33
|
+
_UMTSimpleMathClass_LocaldayOfWeek = new WeakMap(), _UMTSimpleMathClass_LocaldeviationValue = new WeakMap();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { dayType, MonthsWihout31Days, MonthsWith31Days } from '../../types/monType';
|
|
2
|
+
export interface BIRTHDAYSIMPLE {
|
|
3
|
+
<T extends MonthsWith31Days | MonthsWihout31Days>(birthdays: Date | `${number}-${T}-${dayType<T>}` | `${number}:${T}:${dayType<T>}` | `${number}/${T}/${dayType<T>}` | {
|
|
4
|
+
yer: number;
|
|
5
|
+
mon: number;
|
|
6
|
+
day: number;
|
|
7
|
+
}, timeDifference?: number): number;
|
|
8
|
+
}
|
|
9
|
+
export declare const birthdaySimple: BIRTHDAYSIMPLE;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.birthdaySimple = void 0;
|
|
4
|
+
const birthday_1 = require("../../Tool/birthday");
|
|
5
|
+
exports.birthdaySimple = ((birthdays, timeDifference = 9) => {
|
|
6
|
+
if (typeof birthdays === 'string') {
|
|
7
|
+
if (birthdays.includes(':')) {
|
|
8
|
+
const [yer, mon, day] = birthdays.split(':').map(Number);
|
|
9
|
+
return (0, birthday_1.birthday)(yer, mon, day, timeDifference);
|
|
10
|
+
}
|
|
11
|
+
else if (birthdays.includes('/')) {
|
|
12
|
+
const [yer, mon, day] = birthdays.split('/').map(Number);
|
|
13
|
+
return (0, birthday_1.birthday)(yer, mon, day, timeDifference);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
const [yer, mon, day] = birthdays.split('-').map(Number);
|
|
17
|
+
return (0, birthday_1.birthday)(yer, mon, day, timeDifference);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else if (birthdays instanceof Date) {
|
|
21
|
+
return (0, birthday_1.birthday)(birthdays.getFullYear(), birthdays.getMonth(), birthdays.getDate(), timeDifference);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return (0, birthday_1.birthday)(birthdays.yer, birthdays.mon, birthdays.day, timeDifference);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
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_Localbirthday;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.UMTSimpleToolClass = void 0;
|
|
16
|
+
const birthday_1 = require("./birthday");
|
|
17
|
+
class UMTSimpleToolClass {
|
|
18
|
+
constructor() {
|
|
19
|
+
_UMTSimpleToolClass_Localbirthday.set(this, void 0);
|
|
20
|
+
__classPrivateFieldSet(this, _UMTSimpleToolClass_Localbirthday, birthday_1.birthdaySimple, "f");
|
|
21
|
+
}
|
|
22
|
+
get birthday() {
|
|
23
|
+
return __classPrivateFieldGet(this, _UMTSimpleToolClass_Localbirthday, "f");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.UMTSimpleToolClass = UMTSimpleToolClass;
|
|
27
|
+
_UMTSimpleToolClass_Localbirthday = new WeakMap();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UMTSimpleDateClass } from './Date/index';
|
|
2
|
+
import { UMTSimpleMathClass } from './Math';
|
|
3
|
+
import { UMTSimpleToolClass } from './Tool';
|
|
4
|
+
export declare class UMTSimpleClass<LOCALDATE, LOCALMATH, LOCALTOOL> {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(constructorLocalDateValue: LOCALDATE, constructorLocalMathValue: LOCALMATH, constructorLocalToolValue: LOCALTOOL);
|
|
7
|
+
get Date(): LOCALDATE;
|
|
8
|
+
get Math(): LOCALMATH;
|
|
9
|
+
get Tool(): LOCALTOOL;
|
|
10
|
+
}
|
|
11
|
+
export declare const UMT_Simple: UMTSimpleClass<typeof UMTSimpleDateClass, typeof UMTSimpleMathClass, typeof UMTSimpleToolClass>;
|
|
@@ -0,0 +1,40 @@
|
|
|
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_LocalDate, _UMTSimpleClass_LocalMath, _UMTSimpleClass_LocalTool;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.UMT_Simple = exports.UMTSimpleClass = void 0;
|
|
16
|
+
const index_1 = require("./Date/index");
|
|
17
|
+
const Math_1 = require("./Math");
|
|
18
|
+
const Tool_1 = require("./Tool");
|
|
19
|
+
class UMTSimpleClass {
|
|
20
|
+
constructor(constructorLocalDateValue, constructorLocalMathValue, constructorLocalToolValue) {
|
|
21
|
+
_UMTSimpleClass_LocalDate.set(this, void 0);
|
|
22
|
+
_UMTSimpleClass_LocalMath.set(this, void 0);
|
|
23
|
+
_UMTSimpleClass_LocalTool.set(this, void 0);
|
|
24
|
+
__classPrivateFieldSet(this, _UMTSimpleClass_LocalDate, constructorLocalDateValue, "f");
|
|
25
|
+
__classPrivateFieldSet(this, _UMTSimpleClass_LocalMath, constructorLocalMathValue, "f");
|
|
26
|
+
__classPrivateFieldSet(this, _UMTSimpleClass_LocalTool, constructorLocalToolValue, "f");
|
|
27
|
+
}
|
|
28
|
+
get Date() {
|
|
29
|
+
return __classPrivateFieldGet(this, _UMTSimpleClass_LocalDate, "f");
|
|
30
|
+
}
|
|
31
|
+
get Math() {
|
|
32
|
+
return __classPrivateFieldGet(this, _UMTSimpleClass_LocalMath, "f");
|
|
33
|
+
}
|
|
34
|
+
get Tool() {
|
|
35
|
+
return __classPrivateFieldGet(this, _UMTSimpleClass_LocalTool, "f");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.UMTSimpleClass = UMTSimpleClass;
|
|
39
|
+
_UMTSimpleClass_LocalDate = new WeakMap(), _UMTSimpleClass_LocalMath = new WeakMap(), _UMTSimpleClass_LocalTool = new WeakMap();
|
|
40
|
+
exports.UMT_Simple = new UMTSimpleClass(index_1.UMTSimpleDateClass, Math_1.UMTSimpleMathClass, Tool_1.UMTSimpleToolClass);
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @param {number} yer
|
|
3
|
+
* @param {number} mon
|
|
4
|
+
* @param {number} day
|
|
5
|
+
* @param {number} [timeDifference=9] 時差
|
|
6
|
+
* @returns number 年齢
|
|
7
|
+
*/
|
|
8
|
+
export declare const birthday: (yer: number, mon: number, day: number, timeDifference?: number) => number;
|
package/module/Tool/birthday.js
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
exports.birthday = void 0;
|
|
4
|
+
const now_1 = require("../Date/now");
|
|
5
|
+
/**
|
|
6
|
+
* @param {number} yer
|
|
7
|
+
* @param {number} mon
|
|
8
|
+
* @param {number} day
|
|
9
|
+
* @param {number} [timeDifference=9] 時差
|
|
10
|
+
* @returns number 年齢
|
|
11
|
+
*/
|
|
12
|
+
const birthday = (yer, mon, day, timeDifference = 9) => {
|
|
13
|
+
const Bday = new Date(yer < 0 ? -yer : yer, mon < 0 ? -mon - 1 : mon - 1, day < 0 ? -day : day);
|
|
14
|
+
const nowTime = (0, now_1.now)(timeDifference);
|
|
15
|
+
const y = nowTime.getFullYear() - Bday.getFullYear();
|
|
11
16
|
const r = nowTime <
|
|
12
|
-
new Date(nowTime.getFullYear(),
|
|
17
|
+
new Date(nowTime.getFullYear(), Bday.getMonth(), Bday.getDate())
|
|
13
18
|
? y - 1
|
|
14
19
|
: y;
|
|
15
20
|
return yer < 100 ? 1900 + y : r;
|
|
16
21
|
};
|
|
17
|
-
exports.
|
|
22
|
+
exports.birthday = birthday;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
declare const dayOfWeek: (
|
|
2
|
-
yer
|
|
3
|
-
mon
|
|
4
|
-
day
|
|
5
|
-
}) => number;
|
|
6
|
-
export default dayOfWeek;
|
|
1
|
+
export declare const dayOfWeek: (props?: {
|
|
2
|
+
yer?: number;
|
|
3
|
+
mon?: number;
|
|
4
|
+
day?: number;
|
|
5
|
+
}, timeDifference?: number) => number;
|
package/module/Tool/dayOfWeek.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
exports.dayOfWeek = void 0;
|
|
4
|
+
const Date_1 = require("../Date");
|
|
5
|
+
const dayOfWeek = (props, timeDifference = 9) => {
|
|
6
|
+
const nowTime = (0, Date_1.now)(timeDifference);
|
|
7
|
+
if (props) {
|
|
8
|
+
return new Date(props.yer || nowTime.getFullYear(), props.mon ? props.mon - 1 : nowTime.getMonth(), props.day || nowTime.getDate()).getDay();
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
return nowTime.getDay();
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
exports.dayOfWeek = dayOfWeek;
|
package/module/Tool/index.d.ts
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
import birthday from './birthday';
|
|
2
|
-
import dayOfWeek from './dayOfWeek';
|
|
3
|
-
import pipeFunction from './pipeFunction';
|
|
1
|
+
import { birthday } from './birthday';
|
|
2
|
+
import { dayOfWeek } from './dayOfWeek';
|
|
3
|
+
import { pipeFunction } from './pipeFunction';
|
|
4
4
|
export { birthday, dayOfWeek, pipeFunction };
|
|
5
|
+
export declare class UMTToolClass {
|
|
6
|
+
#private;
|
|
7
|
+
constructor();
|
|
8
|
+
get birthday(): (yer: number, mon: number, day: number, timeDifference?: number) => number;
|
|
9
|
+
get dayOfWeek(): (props?: {
|
|
10
|
+
yer?: number | undefined;
|
|
11
|
+
mon?: number | undefined;
|
|
12
|
+
day?: number | undefined;
|
|
13
|
+
} | undefined, timeDifference?: number) => number;
|
|
14
|
+
get pipeFunction(): <T>(x: T) => import("./pipeFunction").Pipe<T>;
|
|
15
|
+
get isBrowser(): boolean;
|
|
16
|
+
get isNode(): boolean;
|
|
17
|
+
get isNodeWebkit(): boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const UMT_Tool: UMTToolClass;
|
package/module/Tool/index.js
CHANGED
|
@@ -1,12 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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;
|
|
4
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 _UMTToolClass_Localbirthday, _UMTToolClass_LocaldayOfWeek, _UMTToolClass_LocalpipeFunction, _UMTToolClass_LocalisBrowser, _UMTToolClass_LocalisNode, _UMTToolClass_LocalisNodeWebkit;
|
|
5
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.pipeFunction = exports.dayOfWeek = exports.birthday = void 0;
|
|
7
|
-
const birthday_1 =
|
|
8
|
-
exports
|
|
9
|
-
const dayOfWeek_1 =
|
|
10
|
-
exports
|
|
11
|
-
const
|
|
12
|
-
|
|
15
|
+
exports.UMT_Tool = exports.UMTToolClass = exports.pipeFunction = exports.dayOfWeek = exports.birthday = void 0;
|
|
16
|
+
const birthday_1 = require("./birthday");
|
|
17
|
+
Object.defineProperty(exports, "birthday", { enumerable: true, get: function () { return birthday_1.birthday; } });
|
|
18
|
+
const dayOfWeek_1 = require("./dayOfWeek");
|
|
19
|
+
Object.defineProperty(exports, "dayOfWeek", { enumerable: true, get: function () { return dayOfWeek_1.dayOfWeek; } });
|
|
20
|
+
const isBrowser_1 = require("./isBrowser");
|
|
21
|
+
const isNode_1 = require("./isNode");
|
|
22
|
+
const isNodeWebkit_1 = require("./isNodeWebkit");
|
|
23
|
+
const pipeFunction_1 = require("./pipeFunction");
|
|
24
|
+
Object.defineProperty(exports, "pipeFunction", { enumerable: true, get: function () { return pipeFunction_1.pipeFunction; } });
|
|
25
|
+
class UMTToolClass {
|
|
26
|
+
constructor() {
|
|
27
|
+
_UMTToolClass_Localbirthday.set(this, void 0);
|
|
28
|
+
_UMTToolClass_LocaldayOfWeek.set(this, void 0);
|
|
29
|
+
_UMTToolClass_LocalpipeFunction.set(this, void 0);
|
|
30
|
+
_UMTToolClass_LocalisBrowser.set(this, void 0);
|
|
31
|
+
_UMTToolClass_LocalisNode.set(this, void 0);
|
|
32
|
+
_UMTToolClass_LocalisNodeWebkit.set(this, void 0);
|
|
33
|
+
__classPrivateFieldSet(this, _UMTToolClass_Localbirthday, birthday_1.birthday, "f");
|
|
34
|
+
__classPrivateFieldSet(this, _UMTToolClass_LocaldayOfWeek, dayOfWeek_1.dayOfWeek, "f");
|
|
35
|
+
__classPrivateFieldSet(this, _UMTToolClass_LocalpipeFunction, pipeFunction_1.pipeFunction, "f");
|
|
36
|
+
__classPrivateFieldSet(this, _UMTToolClass_LocalisBrowser, isBrowser_1.isBrowser, "f");
|
|
37
|
+
__classPrivateFieldSet(this, _UMTToolClass_LocalisNode, isNode_1.isNode, "f");
|
|
38
|
+
__classPrivateFieldSet(this, _UMTToolClass_LocalisNodeWebkit, isNodeWebkit_1.isNodeWebkit, "f");
|
|
39
|
+
}
|
|
40
|
+
get birthday() {
|
|
41
|
+
return __classPrivateFieldGet(this, _UMTToolClass_Localbirthday, "f");
|
|
42
|
+
}
|
|
43
|
+
get dayOfWeek() {
|
|
44
|
+
return __classPrivateFieldGet(this, _UMTToolClass_LocaldayOfWeek, "f");
|
|
45
|
+
}
|
|
46
|
+
get pipeFunction() {
|
|
47
|
+
return __classPrivateFieldGet(this, _UMTToolClass_LocalpipeFunction, "f");
|
|
48
|
+
}
|
|
49
|
+
get isBrowser() {
|
|
50
|
+
return __classPrivateFieldGet(this, _UMTToolClass_LocalisBrowser, "f");
|
|
51
|
+
}
|
|
52
|
+
get isNode() {
|
|
53
|
+
return __classPrivateFieldGet(this, _UMTToolClass_LocalisNode, "f");
|
|
54
|
+
}
|
|
55
|
+
get isNodeWebkit() {
|
|
56
|
+
return __classPrivateFieldGet(this, _UMTToolClass_LocalisNodeWebkit, "f");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.UMTToolClass = UMTToolClass;
|
|
60
|
+
_UMTToolClass_Localbirthday = new WeakMap(), _UMTToolClass_LocaldayOfWeek = new WeakMap(), _UMTToolClass_LocalpipeFunction = new WeakMap(), _UMTToolClass_LocalisBrowser = new WeakMap(), _UMTToolClass_LocalisNode = new WeakMap(), _UMTToolClass_LocalisNodeWebkit = new WeakMap();
|
|
61
|
+
exports.UMT_Tool = new UMTToolClass();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isBrowser: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isNode: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isNodeWebkit: boolean;
|