prototype-helper 0.2.6 → 0.3.3
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/.vscode/settings.json +6 -6
- package/LICENSE +21 -21
- package/README.md +206 -206
- package/dist/extension/array.d.ts +1 -0
- package/dist/extension/array.js +98 -84
- package/dist/extension/array.js.map +1 -1
- package/dist/extension/index.d.ts +4 -3
- package/dist/extension/index.js +6 -5
- package/dist/extension/index.js.map +1 -1
- package/dist/extension/number.d.ts +1 -1
- package/dist/extension/number.js +75 -63
- package/dist/extension/number.js.map +1 -1
- package/dist/extension/number.test.d.ts +3 -3
- package/dist/extension/number.test.js +21 -21
- package/dist/extension/object.d.ts +1 -4
- package/dist/extension/object.js +12 -12
- package/dist/extension/object.js.map +1 -1
- package/dist/extension/string.d.ts +18 -16
- package/dist/extension/string.js +38 -38
- package/dist/extension/string.js.map +1 -1
- package/dist/extension/string.test.d.ts +2 -2
- package/dist/extension/string.test.js +17 -17
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -5
- package/dist/interface/array.d.ts +19 -17
- package/dist/interface/array.js +1 -1
- package/dist/interface/index.d.ts +3 -2
- package/dist/interface/index.js +5 -4
- package/dist/interface/index.js.map +1 -1
- package/dist/interface/number.d.ts +21 -17
- package/dist/interface/number.js +1 -1
- package/dist/interface/object.d.ts +4 -0
- package/dist/interface/object.js +2 -0
- package/dist/interface/object.js.map +1 -0
- package/dist/override/console.d.ts +17 -0
- package/dist/override/console.js +70 -73
- package/dist/override/console.js.map +1 -1
- package/dist/override/index.d.ts +3 -3
- package/dist/override/index.js +5 -5
- package/dist/override/linq.d.ts +1 -1
- package/dist/override/linq.js +2 -2
- package/dist/override/math.d.ts +10 -10
- package/dist/override/math.js +38 -38
- package/dist/test.d.ts +1 -1
- package/dist/test.js +105 -86
- package/dist/test.js.map +1 -1
- package/package.json +79 -78
- package/tsconfig.json +32 -32
- package/dist/utils/deepCopy.d.ts +0 -2
- package/dist/utils/deepCopy.js +0 -14
- package/dist/utils/deepCopy.js.map +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface ConsoleShowOption {
|
|
2
|
+
log: boolean;
|
|
3
|
+
info: boolean;
|
|
4
|
+
warn: boolean;
|
|
5
|
+
error: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface ConsoleOption {
|
|
8
|
+
development: ConsoleShowOption;
|
|
9
|
+
production: ConsoleShowOption;
|
|
10
|
+
}
|
|
11
|
+
declare global {
|
|
12
|
+
interface Console {
|
|
13
|
+
show(message?: any, ...optionalParams: any[]): void;
|
|
14
|
+
useTheme(consoleOption?: ConsoleOption): void;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export {};
|
package/dist/override/console.js
CHANGED
|
@@ -1,74 +1,71 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
// )
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
// showMessage("error", ...message);
|
|
72
|
-
// };
|
|
73
|
-
// globalThis.console = console;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const TH = this;
|
|
4
|
+
const temp = {
|
|
5
|
+
log: console.log.bind(TH),
|
|
6
|
+
info: console.log.bind(TH),
|
|
7
|
+
warn: console.log.bind(TH),
|
|
8
|
+
error: console.log.bind(TH),
|
|
9
|
+
};
|
|
10
|
+
// let leftLogList: any[] = [];
|
|
11
|
+
// let rightLogList: any[] = [];
|
|
12
|
+
function getTime() {
|
|
13
|
+
const nowDate = new Date();
|
|
14
|
+
return `${nowDate.getHours()}:${nowDate.getMinutes()}:${nowDate.getSeconds()}:${`${nowDate.getMilliseconds()}`.padStart(3, "0")}`;
|
|
15
|
+
}
|
|
16
|
+
function showMessage(type, message, ...optionalParams) {
|
|
17
|
+
let color = ["\x1b[2m"];
|
|
18
|
+
if (type == "info")
|
|
19
|
+
color[0] = "\x1b[34m";
|
|
20
|
+
else if (type == "warn")
|
|
21
|
+
color[0] = "\x1b[33m";
|
|
22
|
+
else if (type == "error")
|
|
23
|
+
color[0] = "\x1b[31m";
|
|
24
|
+
// if (type == "info")
|
|
25
|
+
// leftLogList.push([message, ...optionalParams]);
|
|
26
|
+
// else if (type == "warn" || type == "error")
|
|
27
|
+
// rightLogList.push([message, ...optionalParams]);
|
|
28
|
+
temp[type](`${color[0]}[${getTime()}]\x1b[0m\x1b[37m`, message, ...optionalParams);
|
|
29
|
+
}
|
|
30
|
+
console.useTheme = useTheme;
|
|
31
|
+
function useTheme(consoleOption = {
|
|
32
|
+
development: {
|
|
33
|
+
log: true,
|
|
34
|
+
info: true,
|
|
35
|
+
warn: true,
|
|
36
|
+
error: true,
|
|
37
|
+
},
|
|
38
|
+
production: {
|
|
39
|
+
log: false,
|
|
40
|
+
info: false,
|
|
41
|
+
warn: true,
|
|
42
|
+
error: true,
|
|
43
|
+
},
|
|
44
|
+
}) {
|
|
45
|
+
console.log = function (message, ...optionalParams) {
|
|
46
|
+
if ((process.env.NODE_ENV === "development" && consoleOption.development.log) ||
|
|
47
|
+
(process.env.NODE_ENV === "production" && consoleOption.production.log) ||
|
|
48
|
+
!process.env.NODE_ENV)
|
|
49
|
+
showMessage("log", message, ...optionalParams);
|
|
50
|
+
};
|
|
51
|
+
console.info = function (message, ...optionalParams) {
|
|
52
|
+
if ((process.env.NODE_ENV === "development" && consoleOption.development.info) ||
|
|
53
|
+
(process.env.NODE_ENV === "production" && consoleOption.production.info) ||
|
|
54
|
+
!process.env.NODE_ENV)
|
|
55
|
+
showMessage("info", message, ...optionalParams);
|
|
56
|
+
};
|
|
57
|
+
console.warn = function (message, ...optionalParams) {
|
|
58
|
+
if ((process.env.NODE_ENV === "development" && consoleOption.development.warn) ||
|
|
59
|
+
(process.env.NODE_ENV === "production" && consoleOption.production.warn) ||
|
|
60
|
+
!process.env.NODE_ENV)
|
|
61
|
+
showMessage("warn", message, ...optionalParams);
|
|
62
|
+
};
|
|
63
|
+
console.error = function (message, ...optionalParams) {
|
|
64
|
+
if ((process.env.NODE_ENV === "development" && consoleOption.development.error) ||
|
|
65
|
+
(process.env.NODE_ENV === "production" && consoleOption.production.error) ||
|
|
66
|
+
!process.env.NODE_ENV)
|
|
67
|
+
showMessage("error", message, ...optionalParams);
|
|
68
|
+
};
|
|
69
|
+
globalThis.console = console;
|
|
70
|
+
}
|
|
74
71
|
//# sourceMappingURL=console.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console.js","sourceRoot":"","sources":["../../src/override/console.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"console.js","sourceRoot":"","sources":["../../src/override/console.ts"],"names":[],"mappings":";;AAqBA,MAAM,E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O,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,IAAI,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC;YACxE,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ;YAErB,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC,CAAC;IACpD,CAAC,CAAC;IACF,OAAO,CAAC,KAAK,GAAG,UAAU,OAAa,EAAE,GAAG,cAAqB;QAC/D,IACE,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,IAAI,aAAa,CAAC,WAAW,CAAC,KAAK,CAAC;YAC3E,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,IAAI,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC;YACzE,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ;YAErB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC,CAAC;IACrD,CAAC,CAAC;IAEF,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC;AAC/B,CAAC"}
|
package/dist/override/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "../extension";
|
|
2
|
-
import "./console";
|
|
3
|
-
import "./math";
|
|
1
|
+
import "../extension";
|
|
2
|
+
import "./console";
|
|
3
|
+
import "./math";
|
package/dist/override/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
require("../extension");
|
|
4
|
-
require("./console");
|
|
5
|
-
require("./math");
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
require("../extension");
|
|
4
|
+
require("./console");
|
|
5
|
+
require("./math");
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/dist/override/linq.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/dist/override/linq.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=linq.js.map
|
package/dist/override/math.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
declare global {
|
|
3
|
-
interface Math {
|
|
4
|
-
round10(x: number, point?: number): number;
|
|
5
|
-
floor10(x: number, point?: number): number;
|
|
6
|
-
ceil10(x: number, point?: number): number;
|
|
7
|
-
randomRange(a: number, b: number, point?: number): number;
|
|
8
|
-
clamp(input: number, min: number, max: number): number;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
1
|
+
export {};
|
|
2
|
+
declare global {
|
|
3
|
+
interface Math {
|
|
4
|
+
round10(x: number, point?: number): number;
|
|
5
|
+
floor10(x: number, point?: number): number;
|
|
6
|
+
ceil10(x: number, point?: number): number;
|
|
7
|
+
randomRange(a: number, b: number, point?: number): number;
|
|
8
|
+
clamp(input: number, min: number, max: number): number;
|
|
9
|
+
}
|
|
10
|
+
}
|
package/dist/override/math.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
if (!Math.round10) {
|
|
4
|
-
Math.round10 = decimalAdjust("round");
|
|
5
|
-
}
|
|
6
|
-
if (!Math.floor10) {
|
|
7
|
-
Math.floor10 = decimalAdjust("floor");
|
|
8
|
-
}
|
|
9
|
-
if (!Math.ceil10) {
|
|
10
|
-
Math.ceil10 = decimalAdjust("ceil");
|
|
11
|
-
}
|
|
12
|
-
if (!Math.randomRange) {
|
|
13
|
-
Math.randomRange = function (a, b, point = 0) {
|
|
14
|
-
return Math.floor10(Math.random() * (b - a + 1) + a, point);
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
if (!Math.clamp) {
|
|
18
|
-
Math.clamp = function (input, min, max) {
|
|
19
|
-
return Math.min(Math.max(input, min), max);
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function decimalAdjust(type) {
|
|
23
|
-
const func = Math[type];
|
|
24
|
-
return (number, precision = 0) => {
|
|
25
|
-
precision =
|
|
26
|
-
precision == null ? 0 : precision >= 0 ? Math.min(precision, 292) : Math.max(precision, -292);
|
|
27
|
-
if (precision) {
|
|
28
|
-
// Shift with exponential notation to avoid floating-point issues.
|
|
29
|
-
// See [MDN](https://mdn.io/round#Examples) for more details.
|
|
30
|
-
let pair = `${number}e`.split("e");
|
|
31
|
-
const value = func(`${pair[0]}e${+pair[1] + precision}`.toNumber());
|
|
32
|
-
pair = `${value}e`.split("e");
|
|
33
|
-
return +`${pair[0]}e${+pair[1] - precision}`;
|
|
34
|
-
}
|
|
35
|
-
return func(number);
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
globalThis.Math = Math;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
if (!Math.round10) {
|
|
4
|
+
Math.round10 = decimalAdjust("round");
|
|
5
|
+
}
|
|
6
|
+
if (!Math.floor10) {
|
|
7
|
+
Math.floor10 = decimalAdjust("floor");
|
|
8
|
+
}
|
|
9
|
+
if (!Math.ceil10) {
|
|
10
|
+
Math.ceil10 = decimalAdjust("ceil");
|
|
11
|
+
}
|
|
12
|
+
if (!Math.randomRange) {
|
|
13
|
+
Math.randomRange = function (a, b, point = 0) {
|
|
14
|
+
return Math.floor10(Math.random() * (b - a + 1) + a, point);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
if (!Math.clamp) {
|
|
18
|
+
Math.clamp = function (input, min, max) {
|
|
19
|
+
return Math.min(Math.max(input, min), max);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function decimalAdjust(type) {
|
|
23
|
+
const func = Math[type];
|
|
24
|
+
return (number, precision = 0) => {
|
|
25
|
+
precision =
|
|
26
|
+
precision == null ? 0 : precision >= 0 ? Math.min(precision, 292) : Math.max(precision, -292);
|
|
27
|
+
if (precision) {
|
|
28
|
+
// Shift with exponential notation to avoid floating-point issues.
|
|
29
|
+
// See [MDN](https://mdn.io/round#Examples) for more details.
|
|
30
|
+
let pair = `${number}e`.split("e");
|
|
31
|
+
const value = func(`${pair[0]}e${+pair[1] + precision}`.toNumber());
|
|
32
|
+
pair = `${value}e`.split("e");
|
|
33
|
+
return +`${pair[0]}e${+pair[1] - precision}`;
|
|
34
|
+
}
|
|
35
|
+
return func(number);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
globalThis.Math = Math;
|
|
39
39
|
//# sourceMappingURL=math.js.map
|
package/dist/test.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import "./index";
|
|
1
|
+
import "./index";
|
package/dist/test.js
CHANGED
|
@@ -1,87 +1,106 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
require("./index");
|
|
4
|
-
|
|
5
|
-
//
|
|
6
|
-
// console.
|
|
7
|
-
// console.
|
|
8
|
-
console.
|
|
9
|
-
|
|
10
|
-
// console.log("
|
|
11
|
-
// console.log("24816246784".
|
|
12
|
-
// console.log(
|
|
13
|
-
// console.log(
|
|
14
|
-
//0.
|
|
15
|
-
//
|
|
16
|
-
//0.
|
|
17
|
-
//
|
|
18
|
-
// console.log(
|
|
19
|
-
// console.log(0.
|
|
20
|
-
// console.log(
|
|
21
|
-
// console.log((0.
|
|
22
|
-
// console.log((0.
|
|
23
|
-
console.log((
|
|
24
|
-
console.log((
|
|
25
|
-
console.log((39225.3).mod(0.
|
|
26
|
-
|
|
27
|
-
// console.log((0.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// console.log(Math.
|
|
31
|
-
// console.log(Math.
|
|
32
|
-
//
|
|
33
|
-
// console.log(Math.
|
|
34
|
-
// console.log(Math.randomRange(112.5, 200,
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// console.log((
|
|
42
|
-
// console.log((
|
|
43
|
-
// console.log((30222.12).fixNumber(8)
|
|
44
|
-
// console.log(
|
|
45
|
-
console.log("30222.50380000".fixPoint(
|
|
46
|
-
console.log("30222.50380000".fixPoint(5)
|
|
47
|
-
|
|
48
|
-
// console.log((30222
|
|
49
|
-
// console.log((30222.12).
|
|
50
|
-
// console.log(
|
|
51
|
-
// console.log(
|
|
52
|
-
// console.log(Math.clamp(
|
|
53
|
-
// console.log(Math.clamp(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
console.log(hello.
|
|
57
|
-
console.log(hello.skip(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
console.log(
|
|
67
|
-
console.log(
|
|
68
|
-
console.log(test.
|
|
69
|
-
console.log(test.
|
|
70
|
-
console.log(test.
|
|
71
|
-
console.log(test.
|
|
72
|
-
console.log(test.
|
|
73
|
-
console.log(test.
|
|
74
|
-
|
|
75
|
-
console.log(
|
|
76
|
-
console.log((
|
|
77
|
-
console.log((
|
|
78
|
-
console.log((
|
|
79
|
-
console.log((134.5).addSymbol("
|
|
80
|
-
console.log((134.5).
|
|
81
|
-
console.log((134.5).
|
|
82
|
-
console.log((134.5).
|
|
83
|
-
console.log((
|
|
84
|
-
console.log((100).
|
|
85
|
-
console.log((
|
|
86
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
require("./index");
|
|
4
|
+
console.useTheme();
|
|
5
|
+
// import "../dist";
|
|
6
|
+
// console.log("hello");
|
|
7
|
+
// console.warn("warn log");
|
|
8
|
+
// console.error("error log");
|
|
9
|
+
console.log("300".fixPoint(10));
|
|
10
|
+
// console.log("300".toComma(10));
|
|
11
|
+
// console.log("24816246784".toComma());
|
|
12
|
+
// console.log("24816246784".toNumber());
|
|
13
|
+
// console.log((24816246784).toComma());
|
|
14
|
+
// console.log(35 % 0.8);
|
|
15
|
+
//0.5999999999999981
|
|
16
|
+
// console.log((35).ampersand(0.8));
|
|
17
|
+
//0.6
|
|
18
|
+
// console.log(0.1 * 0.2);
|
|
19
|
+
// console.log((0.1).safeMultiply(0.2));
|
|
20
|
+
// console.log(0.2 / 0.2);
|
|
21
|
+
// console.log((0.1).safeAdd(0.2)); // 0.6
|
|
22
|
+
// console.log((0.3).safeAdd(-0.2));
|
|
23
|
+
// console.log((0.1).safeSubtract(0.3)); // 0.6
|
|
24
|
+
console.log((35).mod(0.8)); // 0.6
|
|
25
|
+
console.log((39225.3).mod(0.1), 0); // 0
|
|
26
|
+
console.log((39225.3).mod(0.01), 0); // 0
|
|
27
|
+
// console.log((0.2).safeDivision(0.6)); // 0.8333333333333334
|
|
28
|
+
// console.log((0.1).safeMultiply(0.2)); // 0.02
|
|
29
|
+
//////////////////////////////////////////////////////////////////////////
|
|
30
|
+
// console.log(Math.round10(112.5345, 3));
|
|
31
|
+
// console.log(Math.floor10(112.5345, 3));
|
|
32
|
+
// console.log(Math.ceil10(112.5345, 3));
|
|
33
|
+
// // console.log(Math.round(112.5));
|
|
34
|
+
// console.log(Math.randomRange(112.5, 200, 1));
|
|
35
|
+
// console.log(Math.randomRange(112.5, 200, 0));
|
|
36
|
+
// for (var i = 0; i < 10; i++) {
|
|
37
|
+
// console.log(Math.randomRange(4, 5));
|
|
38
|
+
// }
|
|
39
|
+
////////////////////////////////////////////////////////////////////////////
|
|
40
|
+
console.log("123".toComma());
|
|
41
|
+
// console.log((1).fixNumber(5));
|
|
42
|
+
// console.log((3022).fixNumber(1));
|
|
43
|
+
// console.log((30222.12).fixNumber(8));
|
|
44
|
+
// console.log((30222.12).fixNumber(8).toComma());
|
|
45
|
+
// console.log("30222.50380000".fixPoint(8).fixNumber(8));
|
|
46
|
+
console.log("30222.50380000".fixPoint(5));
|
|
47
|
+
console.log("30222.50380000".fixPoint(5).toComma());
|
|
48
|
+
// console.log((30222).fixPoint(3));
|
|
49
|
+
// console.log((30222.12).fixPoint(5).toComma());
|
|
50
|
+
// console.log((30222.12).toComma().pointPad(5));
|
|
51
|
+
// console.log("30222.12".pointPad(5));
|
|
52
|
+
// console.log(Math.clamp(10, 3, 5));
|
|
53
|
+
// console.log(Math.clamp(1, 3, 5));
|
|
54
|
+
// console.log(Math.clamp(4, 3, 5));
|
|
55
|
+
const hello = [1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
56
|
+
console.log(hello.singleOrDefault((e) => e == 99));
|
|
57
|
+
console.log(hello.skip(3).take(5));
|
|
58
|
+
console.log(hello.skip(1).skip(1));
|
|
59
|
+
const test = hello.take(9).select((now, index) => {
|
|
60
|
+
return {
|
|
61
|
+
id: now,
|
|
62
|
+
index,
|
|
63
|
+
name: "test",
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
console.log(test);
|
|
67
|
+
console.log(hello.skip(1).count());
|
|
68
|
+
console.log(test.max((now) => now.id));
|
|
69
|
+
console.log(test.min((now) => now.id));
|
|
70
|
+
console.log(test.sum((now) => now.id));
|
|
71
|
+
console.log(test.first((now) => now.id % 3 == 0));
|
|
72
|
+
console.log(test.firstOrDefault((now) => now.id % 99 == 0, 991));
|
|
73
|
+
console.log(test.last((now) => now.id % 3 == 0));
|
|
74
|
+
console.log(test.lastOrDefault((now) => now.id % 3 == 4, 991));
|
|
75
|
+
// console.log(hello.single((now) => now == 3));
|
|
76
|
+
console.log((134.5).addSymbol());
|
|
77
|
+
console.log((0).addSymbol());
|
|
78
|
+
console.log((-1.345).addSymbol());
|
|
79
|
+
console.log((134.5).addSymbol(" "));
|
|
80
|
+
console.log((134.5).addSymbol(" "));
|
|
81
|
+
console.log((134.5).fromPer(50));
|
|
82
|
+
console.log((134.5).fromPer(33));
|
|
83
|
+
console.log((134.5).fromPer(72));
|
|
84
|
+
console.log((100).fromPer(50));
|
|
85
|
+
console.log((100).fromPer(1250));
|
|
86
|
+
console.log((300).fromPer(10));
|
|
87
|
+
console.log((300).toPer(10));
|
|
88
|
+
console.log((2 ** 256 + 0.213445).toComma().fixPoint(10));
|
|
89
|
+
console.info("test1");
|
|
90
|
+
console.warn("test2");
|
|
91
|
+
console.error("test3");
|
|
92
|
+
const aaa = [1, 2, 3, 4, 5];
|
|
93
|
+
console.log(aaa.toJson());
|
|
94
|
+
const bbb = aaa.deepClone();
|
|
95
|
+
const ccc = `[1,2,3,4,5]`;
|
|
96
|
+
console.log(aaa, bbb, aaa === bbb);
|
|
97
|
+
console.log(ccc.fromJson());
|
|
98
|
+
console.log({ a: 1, b: 3 }.stringify());
|
|
99
|
+
console.log((1234.1234).round(2));
|
|
100
|
+
console.log((1234.1234).floor(2));
|
|
101
|
+
console.log((1234.1234).ceil(2));
|
|
102
|
+
console.log("3022.50380000".fixNumber(5)); // 03022.50380000
|
|
103
|
+
console.log((3022).fixNumber(7)); // 30222
|
|
104
|
+
console.log((3222.12).fixNumber(5).toComma()); // 03,222.12
|
|
105
|
+
// hello.findIndex;
|
|
87
106
|
//# sourceMappingURL=test.js.map
|
package/dist/test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":";;AAAA,mBAAiB;
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":";;AAAA,mBAAiB;AAEjB,OAAO,CAAC,QAAQ,EAAE,CAAC;AACnB,oBAAoB;AAEpB,wBAAwB;AACxB,4BAA4B;AAC5B,8BAA8B;AAE9B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;AAChC,kCAAkC;AAClC,wCAAwC;AACxC,yCAAyC;AAEzC,wCAAwC;AAExC,yBAAyB;AAC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