prototype-helper 0.1.6 → 0.1.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/.vscode/settings.json +6 -6
- package/LICENSE +21 -21
- package/README.md +206 -203
- package/package.json +80 -79
- package/tsconfig.json +32 -32
- package/dist/extension/array.d.ts +0 -3
- package/dist/extension/array.js +0 -4
- package/dist/extension/array.js.map +0 -1
- package/dist/extension/index.d.ts +0 -3
- package/dist/extension/index.js +0 -6
- package/dist/extension/index.js.map +0 -1
- package/dist/extension/number.d.ts +0 -11
- package/dist/extension/number.js +0 -44
- package/dist/extension/number.js.map +0 -1
- package/dist/extension/number.test.d.ts +0 -3
- package/dist/extension/number.test.js +0 -20
- package/dist/extension/number.test.js.map +0 -1
- package/dist/extension/object.d.ts +0 -4
- package/dist/extension/object.js +0 -13
- package/dist/extension/object.js.map +0 -1
- package/dist/extension/string.d.ts +0 -14
- package/dist/extension/string.js +0 -36
- package/dist/extension/string.js.map +0 -1
- package/dist/extension/string.test.d.ts +0 -2
- package/dist/extension/string.test.js +0 -18
- package/dist/extension/string.test.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -6
- package/dist/index.js.map +0 -1
- package/dist/override/console.d.ts +0 -1
- package/dist/override/console.js +0 -26
- package/dist/override/console.js.map +0 -1
- package/dist/override/index.d.ts +0 -3
- package/dist/override/index.js +0 -6
- package/dist/override/index.js.map +0 -1
- package/dist/override/math.d.ts +0 -10
- package/dist/override/math.js +0 -38
- package/dist/override/math.js.map +0 -1
- package/dist/test.d.ts +0 -1
- package/dist/test.js +0 -54
- package/dist/test.js.map +0 -1
- package/dist/utils/deepCopy.d.ts +0 -2
- package/dist/utils/deepCopy.js +0 -14
- package/dist/utils/deepCopy.js.map +0 -1
package/.vscode/settings.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
{
|
|
2
|
-
"editor.quickSuggestions": {
|
|
3
|
-
"other": true,
|
|
4
|
-
"comments": true,
|
|
5
|
-
"strings": true
|
|
6
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"editor.quickSuggestions": {
|
|
3
|
+
"other": true,
|
|
4
|
+
"comments": true,
|
|
5
|
+
"strings": true
|
|
6
|
+
}
|
|
7
7
|
}
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020 ksPr
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 ksPr
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,203 +1,206 @@
|
|
|
1
|
-
<img src="https://capsule-render.vercel.app/api?type=waving&color=343a40&height=210§ion=header&text=Typescript Prototype Helper&fontSize=50&fontAlignY=35&fontColor=adb5bd" />
|
|
2
|
-
<!-- <h1 align="center">Typescript Prototype Helper</h1> -->
|
|
3
|
-
|
|
4
|
-
<p align="center">
|
|
5
|
-
<a href="https://github.com/prettier/prettier">
|
|
6
|
-
<img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=for-the-badge">
|
|
7
|
-
</a>
|
|
8
|
-
<a href="https://www.npmjs.com/package/prototype-helper">
|
|
9
|
-
<img alt="code style: prettier" src="https://img.shields.io/npm/v/prototype-helper.svg?style=for-the-badge">
|
|
10
|
-
</a>
|
|
11
|
-
<a href="https://github.com/k22pr/prototype-helper/blob/master/LICENSE">
|
|
12
|
-
<img alt="code style: prettier" src="https://img.shields.io/github/license/mashape/apistatus.svg?style=for-the-badge">
|
|
13
|
-
</a>
|
|
14
|
-
<img alt="npm" src="https://img.shields.io/npm/dm/prototype-helper?style=for-the-badge">
|
|
15
|
-
<!-- <img alt="AppVeyor tests (compact)" src="https://img.shields.io/appveyor/tests/k22pr/prototype-helper?compact_message&style=for-the-badge"> -->
|
|
16
|
-
|
|
17
|
-
</p>
|
|
18
|
-
<p align="center">
|
|
19
|
-
Adds a convenient prototype function package.
|
|
20
|
-
</p>
|
|
21
|
-
|
|
22
|
-
# Getting started
|
|
23
|
-
|
|
24
|
-
Import the package to the first file you call.
|
|
25
|
-
|
|
26
|
-
```js
|
|
27
|
-
import "prototype-helper";
|
|
28
|
-
|
|
29
|
-
// and use
|
|
30
|
-
console.log("10000".toComma()); // 10,000
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
# Prototype Helper
|
|
34
|
-
|
|
35
|
-
## Number
|
|
36
|
-
|
|
37
|
-
### toComma()
|
|
38
|
-
|
|
39
|
-
It is a function that attaches a three-digit comma.
|
|
40
|
-
|
|
41
|
-
```ts
|
|
42
|
-
let test = 123;
|
|
43
|
-
test.toComma(); // "123"
|
|
44
|
-
test = 123456;
|
|
45
|
-
test.toComma(); // "123,456"
|
|
46
|
-
//
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### ampersand()
|
|
50
|
-
|
|
51
|
-
Ampsand that safely handles floating point errors.
|
|
52
|
-
|
|
53
|
-
```ts
|
|
54
|
-
console.log(35 % 0.8); // 0.5999999999999981
|
|
55
|
-
console.log((35).ampersand(0.8)); // 0.6
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
test
|
|
135
|
-
//
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
console.log("30222.50380000".fixPoint(
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
1
|
+
<img src="https://capsule-render.vercel.app/api?type=waving&color=343a40&height=210§ion=header&text=Typescript Prototype Helper&fontSize=50&fontAlignY=35&fontColor=adb5bd" />
|
|
2
|
+
<!-- <h1 align="center">Typescript Prototype Helper</h1> -->
|
|
3
|
+
|
|
4
|
+
<p align="center">
|
|
5
|
+
<a href="https://github.com/prettier/prettier">
|
|
6
|
+
<img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=for-the-badge">
|
|
7
|
+
</a>
|
|
8
|
+
<a href="https://www.npmjs.com/package/prototype-helper">
|
|
9
|
+
<img alt="code style: prettier" src="https://img.shields.io/npm/v/prototype-helper.svg?style=for-the-badge">
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://github.com/k22pr/prototype-helper/blob/master/LICENSE">
|
|
12
|
+
<img alt="code style: prettier" src="https://img.shields.io/github/license/mashape/apistatus.svg?style=for-the-badge">
|
|
13
|
+
</a>
|
|
14
|
+
<img alt="npm" src="https://img.shields.io/npm/dm/prototype-helper?style=for-the-badge">
|
|
15
|
+
<!-- <img alt="AppVeyor tests (compact)" src="https://img.shields.io/appveyor/tests/k22pr/prototype-helper?compact_message&style=for-the-badge"> -->
|
|
16
|
+
|
|
17
|
+
</p>
|
|
18
|
+
<p align="center">
|
|
19
|
+
Adds a convenient prototype function package.
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
# Getting started
|
|
23
|
+
|
|
24
|
+
Import the package to the first file you call.
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
import "prototype-helper";
|
|
28
|
+
|
|
29
|
+
// and use
|
|
30
|
+
console.log("10000".toComma()); // 10,000
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
# Prototype Helper
|
|
34
|
+
|
|
35
|
+
## Number
|
|
36
|
+
|
|
37
|
+
### toComma()
|
|
38
|
+
|
|
39
|
+
It is a function that attaches a three-digit comma.
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
let test = 123;
|
|
43
|
+
test.toComma(); // "123"
|
|
44
|
+
test = 123456;
|
|
45
|
+
test.toComma(); // "123,456"
|
|
46
|
+
//
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### ampersand()
|
|
50
|
+
|
|
51
|
+
Ampsand that safely handles floating point errors.
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
console.log(35 % 0.8); // 0.5999999999999981
|
|
55
|
+
console.log((35).ampersand(0.8)); // 0.6
|
|
56
|
+
|
|
57
|
+
console.log(39225.3 % 0.01); // 2.0938424605265737e-12
|
|
58
|
+
console.log((39225.3).ampersand(0.01)); // 0
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### safeAdd()
|
|
62
|
+
|
|
63
|
+
Addition to safely handling floating point errors.
|
|
64
|
+
|
|
65
|
+
Calculate only up to 15 decimal places.
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
console.log(0.1 + 0.2); // 0.30000000000000004
|
|
69
|
+
console.log((0.1).safeAdd(0.2)); // 0.3
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### safeSubtract()
|
|
73
|
+
|
|
74
|
+
Subtraction that safely handles floating point errors.
|
|
75
|
+
|
|
76
|
+
Calculate only up to 15 decimal places.
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
console.log(0.1 - 0.3); // -0.19999999999999998
|
|
80
|
+
console.log((0.1).safeSubtract(0.3)); // 0.2
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### safeDivision()
|
|
84
|
+
|
|
85
|
+
Division that safely handles floating point errors.
|
|
86
|
+
|
|
87
|
+
Calculate only up to 15 decimal places.
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
console.log(0.2 / 0.6); // 0.33333333333333337
|
|
91
|
+
console.log((0.2).safeDivision(0.6)); // 0.3333333333333333
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### safeMultiply()
|
|
95
|
+
|
|
96
|
+
Division that safely handles floating point errors.
|
|
97
|
+
|
|
98
|
+
Calculate only up to 15 decimal places.
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
console.log(0.1 * 0.2); // 0.020000000000000004
|
|
102
|
+
console.log((0.1).safeMultiply(0.2)); // 0.02
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### fixNumber()
|
|
106
|
+
|
|
107
|
+
Fix the number of digits to be marked.
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
console.log("30222.50380000".fixPoint(5)); // 30222.50380
|
|
111
|
+
console.log((30222).fixPoint(3)); // 30222.000
|
|
112
|
+
console.log((30222.12).fixPoint(5).toComma()); // 30,222.12000
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### fixPoint()
|
|
116
|
+
|
|
117
|
+
Fix the decimal place to be marked.
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
console.log("30222.50380000".fixPoint(5)); // 30222.50380
|
|
121
|
+
console.log((30222).fixPoint(3)); // 30222.000
|
|
122
|
+
console.log((30222.12).fixPoint(5).toComma()); // 30,222.12000
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## String
|
|
128
|
+
|
|
129
|
+
### toComma()
|
|
130
|
+
|
|
131
|
+
It is a function that attaches a three-digit comma.
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
let test = "123";
|
|
135
|
+
test.toComma(); // "123"
|
|
136
|
+
test = "123456";
|
|
137
|
+
test.toComma(); // "123,456"
|
|
138
|
+
//
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### fixNumber()
|
|
142
|
+
|
|
143
|
+
Fix the number of digits to be marked.
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
console.log("30222".fixPoint(5)); // 30222
|
|
147
|
+
console.log("30222".fixPoint(5)); // 30222
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### fixPoint()
|
|
151
|
+
|
|
152
|
+
Fix the decimal place to be marked.
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
console.log("30222.50380000".fixPoint(5)); // 30222.50380
|
|
156
|
+
console.log((30222).fixPoint(3)); // 30222.000
|
|
157
|
+
console.log((30222.12).fixPoint(5).toComma()); // 30,222.12000
|
|
158
|
+
console.log("30222.50380000".fixPoint(8).fixNumber(8)); // 00030222.50380000
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Object
|
|
162
|
+
|
|
163
|
+
## Array
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
# Extention Helper
|
|
168
|
+
|
|
169
|
+
## Math
|
|
170
|
+
|
|
171
|
+
### round10(x: number, point?: number)
|
|
172
|
+
|
|
173
|
+
### floor10(x: number, point?: number)
|
|
174
|
+
|
|
175
|
+
### ceil10(x: number, point?: number)
|
|
176
|
+
|
|
177
|
+
A function that allows you to use decimal points for discarding/rounding/round.
|
|
178
|
+
|
|
179
|
+
I used the code of the MDN below.
|
|
180
|
+
|
|
181
|
+
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/ceil#decimal_adjustment
|
|
182
|
+
|
|
183
|
+
```ts
|
|
184
|
+
console.log(Math.round10(112.5345, 3)); //112.535
|
|
185
|
+
console.log(Math.floor10(112.5345, 3)); //112.534
|
|
186
|
+
console.log(Math.ceil10(112.5345, 3)); //112.535
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### randomRange(a: number, b: number, point?: number)
|
|
190
|
+
|
|
191
|
+
Create random numbers within that range.
|
|
192
|
+
|
|
193
|
+
(Includes maximum and minimum values.)
|
|
194
|
+
|
|
195
|
+
```ts
|
|
196
|
+
console.log(Math.randomRange(112.5, 200, 1)); //135.1
|
|
197
|
+
console.log(Math.randomRange(0, 200)); //169
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### clamp(input: number, min: number, max: number)
|
|
201
|
+
|
|
202
|
+
```ts
|
|
203
|
+
console.log(Math.clamp(10, 3, 5)); // 5
|
|
204
|
+
console.log(Math.clamp(1, 3, 5)); // 3
|
|
205
|
+
console.log(Math.clamp(4, 3, 5)); // 4
|
|
206
|
+
```
|
package/package.json
CHANGED
|
@@ -1,79 +1,80 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "prototype-helper",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"private": false,
|
|
5
|
-
"main": "./dist/index.js",
|
|
6
|
-
"types": "./dist/index.d.ts",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/k22pr/prototype-helper.git"
|
|
10
|
-
},
|
|
11
|
-
"keywords": [
|
|
12
|
-
"typescript",
|
|
13
|
-
"prototype",
|
|
14
|
-
"extension",
|
|
15
|
-
"override",
|
|
16
|
-
"helper"
|
|
17
|
-
],
|
|
18
|
-
"author": "서버지기",
|
|
19
|
-
"license": "MIT",
|
|
20
|
-
"bugs": {
|
|
21
|
-
"url": "https://github.com/k22pr/prototype-helper/issues"
|
|
22
|
-
},
|
|
23
|
-
"homepage": "https://github.com/k22pr/prototype-helper#readme",
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"consola": "^2.15.3"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"@types/
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"ts-
|
|
36
|
-
"ts-
|
|
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
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "prototype-helper",
|
|
3
|
+
"version": "0.1.7",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/k22pr/prototype-helper.git"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"typescript",
|
|
13
|
+
"prototype",
|
|
14
|
+
"extension",
|
|
15
|
+
"override",
|
|
16
|
+
"helper"
|
|
17
|
+
],
|
|
18
|
+
"author": "서버지기",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/k22pr/prototype-helper/issues"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/k22pr/prototype-helper#readme",
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"consola": "^2.15.3",
|
|
26
|
+
"decimal.js": "^10.3.1"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/jest": "^26.0.23",
|
|
30
|
+
"@types/node": "^14.6.0",
|
|
31
|
+
"dotenv": "^10.0.0",
|
|
32
|
+
"jest": "^27.0.4",
|
|
33
|
+
"nodemon": "^1.19.1",
|
|
34
|
+
"supertest": "^6.1.3",
|
|
35
|
+
"ts-jest": "^27.0.3",
|
|
36
|
+
"ts-loader": "^6.0.4",
|
|
37
|
+
"ts-node": "^10.0.0",
|
|
38
|
+
"typescript": "^3.5.2"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "jest && tsc",
|
|
42
|
+
"dev": "nodemon --exec ts-node ./src/test.ts",
|
|
43
|
+
"test": "jest --detectOpenHandles --forceExit",
|
|
44
|
+
"publish": "jest && tsc && npm publish"
|
|
45
|
+
},
|
|
46
|
+
"nodemonConfig": {
|
|
47
|
+
"ignore": [
|
|
48
|
+
"**/*.test.ts",
|
|
49
|
+
"**/*.spec.ts",
|
|
50
|
+
".git",
|
|
51
|
+
"node_modules"
|
|
52
|
+
],
|
|
53
|
+
"watch": [
|
|
54
|
+
"src"
|
|
55
|
+
],
|
|
56
|
+
"ext": "ts"
|
|
57
|
+
},
|
|
58
|
+
"jest": {
|
|
59
|
+
"transform": {
|
|
60
|
+
"^.+\\.ts$": "ts-jest"
|
|
61
|
+
},
|
|
62
|
+
"testRegex": "\\.test\\.ts$",
|
|
63
|
+
"moduleFileExtensions": [
|
|
64
|
+
"ts",
|
|
65
|
+
"tsx",
|
|
66
|
+
"js",
|
|
67
|
+
"json"
|
|
68
|
+
],
|
|
69
|
+
"moduleDirectories": [
|
|
70
|
+
"node_modules",
|
|
71
|
+
"bower_components",
|
|
72
|
+
"src"
|
|
73
|
+
],
|
|
74
|
+
"globals": {
|
|
75
|
+
"ts-jest": {
|
|
76
|
+
"diagnostics": true
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"baseUrl": ".",
|
|
4
|
-
"outDir": "./dist",
|
|
5
|
-
"target": "ES2016",
|
|
6
|
-
"module": "commonjs",
|
|
7
|
-
"moduleResolution": "Node",
|
|
8
|
-
"sourceMap": true,
|
|
9
|
-
"lib": ["es2016"],
|
|
10
|
-
"paths": {
|
|
11
|
-
"@/*": ["/src/*"],
|
|
12
|
-
"~/*": ["/src/*"]
|
|
13
|
-
},
|
|
14
|
-
"noImplicitAny": false,
|
|
15
|
-
"esModuleInterop": true,
|
|
16
|
-
"experimentalDecorators": true,
|
|
17
|
-
"emitDecoratorMetadata": true,
|
|
18
|
-
"strict": true,
|
|
19
|
-
"allowSyntheticDefaultImports": true,
|
|
20
|
-
"resolveJsonModule": true,
|
|
21
|
-
"declaration": true
|
|
22
|
-
},
|
|
23
|
-
"include": ["./src/**/*.ts"],
|
|
24
|
-
"exclude": ["node_modules", "**/*.spec.ts"],
|
|
25
|
-
"typeRoots": ["./node_modules/@types"],
|
|
26
|
-
"types": ["@types/node"],
|
|
27
|
-
"repository": {
|
|
28
|
-
"type": "git",
|
|
29
|
-
"url": "git+https://github.com/k22pr/ts-proto"
|
|
30
|
-
},
|
|
31
|
-
"license": "MIT"
|
|
32
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".",
|
|
4
|
+
"outDir": "./dist",
|
|
5
|
+
"target": "ES2016",
|
|
6
|
+
"module": "commonjs",
|
|
7
|
+
"moduleResolution": "Node",
|
|
8
|
+
"sourceMap": true,
|
|
9
|
+
"lib": ["es2016"],
|
|
10
|
+
"paths": {
|
|
11
|
+
"@/*": ["/src/*"],
|
|
12
|
+
"~/*": ["/src/*"]
|
|
13
|
+
},
|
|
14
|
+
"noImplicitAny": false,
|
|
15
|
+
"esModuleInterop": true,
|
|
16
|
+
"experimentalDecorators": true,
|
|
17
|
+
"emitDecoratorMetadata": true,
|
|
18
|
+
"strict": true,
|
|
19
|
+
"allowSyntheticDefaultImports": true,
|
|
20
|
+
"resolveJsonModule": true,
|
|
21
|
+
"declaration": true
|
|
22
|
+
},
|
|
23
|
+
"include": ["./src/**/*.ts"],
|
|
24
|
+
"exclude": ["node_modules", "**/*.spec.ts"],
|
|
25
|
+
"typeRoots": ["./node_modules/@types"],
|
|
26
|
+
"types": ["@types/node"],
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/k22pr/ts-proto"
|
|
30
|
+
},
|
|
31
|
+
"license": "MIT"
|
|
32
|
+
}
|
package/dist/extension/array.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../src/extension/array.ts"],"names":[],"mappings":";AAIA,4CAA4C;AAE5C,kBAAkB"}
|
package/dist/extension/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/extension/index.ts"],"names":[],"mappings":";;AAAA,mBAAiB;AACjB,oBAAkB;AAClB,oBAAkB"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
interface Number {
|
|
2
|
-
toComma(): string;
|
|
3
|
-
ampersand(amp: number): number;
|
|
4
|
-
safeDivision(value: number): number;
|
|
5
|
-
safeMultiply(value: number): number;
|
|
6
|
-
safeAdd(value: number): number;
|
|
7
|
-
safeSubtract(value: number): number;
|
|
8
|
-
fixNumber(length: number): string;
|
|
9
|
-
fixPoint(length: number): string;
|
|
10
|
-
}
|
|
11
|
-
declare function hexfloatNotation(number: number, numberPoint?: number): number;
|
package/dist/extension/number.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Number.prototype.toComma = function () {
|
|
3
|
-
if (`${this}`.length == 0)
|
|
4
|
-
return "0";
|
|
5
|
-
return `${this}`.toComma();
|
|
6
|
-
};
|
|
7
|
-
Number.prototype.ampersand = function (amp) {
|
|
8
|
-
const prepValue = Number(this) % amp;
|
|
9
|
-
const tmp = prepValue.toString().split(".");
|
|
10
|
-
if (tmp[1]) {
|
|
11
|
-
const pointValue = hexfloatNotation(`0.${tmp[1]}`.toNumber());
|
|
12
|
-
return Number(tmp[0] + (pointValue % amp));
|
|
13
|
-
}
|
|
14
|
-
return prepValue;
|
|
15
|
-
};
|
|
16
|
-
function hexfloatNotation(number, numberPoint = 8) {
|
|
17
|
-
const tmp = number.toString().split(".");
|
|
18
|
-
if (tmp[1]) {
|
|
19
|
-
const size = Math.round(number * Math.pow(10, numberPoint)) / Math.pow(10, numberPoint);
|
|
20
|
-
return Number(tmp[0] + size);
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
return Number(tmp);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
Number.prototype.safeDivision = function (value) {
|
|
27
|
-
return Math.round10(Math.floor10(Number(this) / value, 16), 15);
|
|
28
|
-
};
|
|
29
|
-
Number.prototype.safeMultiply = function (value) {
|
|
30
|
-
return Math.round10(Math.floor10(Number(this) * value, 16), 15);
|
|
31
|
-
};
|
|
32
|
-
Number.prototype.safeAdd = function (value) {
|
|
33
|
-
return Math.round10(Math.floor10(Number(this) + value, 16), 15);
|
|
34
|
-
};
|
|
35
|
-
Number.prototype.safeSubtract = function (value) {
|
|
36
|
-
return Math.round10(Math.floor10(Number(this) - value, 16), 15);
|
|
37
|
-
};
|
|
38
|
-
Number.prototype.fixNumber = function (length) {
|
|
39
|
-
return `${this}`.fixNumber(length);
|
|
40
|
-
};
|
|
41
|
-
Number.prototype.fixPoint = function (length) {
|
|
42
|
-
return `${this}`.fixPoint(length);
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=number.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"number.js","sourceRoot":"","sources":["../../src/extension/number.ts"],"names":[],"mappings":";AAWA,MAAM,CAAC,SAAS,CAAC,OAAO,GAAG;IACzB,IAAI,GAAG,IAAI,EAAE,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO,GAAG,CAAC;IACtC,OAAO,GAAG,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;AAC7B,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,SAAS,GAAG,UAAU,GAAW;IAChD,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;IACrC,MAAM,GAAG,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE5C,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE;QACV,MAAM,UAAU,GAAG,gBAAgB,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9D,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC,CAAC;KAC5C;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,SAAS,gBAAgB,CAAC,MAAc,EAAE,WAAW,GAAG,CAAC;IACvD,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE;QACV,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;QACxF,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;KAC9B;SAAM;QACL,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;KACpB;AACH,CAAC;AAED,MAAM,CAAC,SAAS,CAAC,YAAY,GAAG,UAAU,KAAa;IACrD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AAClE,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,YAAY,GAAG,UAAU,KAAa;IACrD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AAClE,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,KAAa;IAChD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AAClE,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,YAAY,GAAG,UAAU,KAAa;IACrD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AAClE,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,SAAS,GAAG,UAAU,MAAc;IACnD,OAAO,GAAG,IAAI,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,QAAQ,GAAG,UAAU,MAAc;IAClD,OAAO,GAAG,IAAI,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
require("../override/math");
|
|
4
|
-
require("./string");
|
|
5
|
-
require("./number");
|
|
6
|
-
test("number - toComma", () => {
|
|
7
|
-
expect((123).toComma()).toBe("123");
|
|
8
|
-
expect((123456).toComma()).toBe("123,456");
|
|
9
|
-
});
|
|
10
|
-
test("number - safe operations", () => {
|
|
11
|
-
expect((35).ampersand(0.8)).toBe(0.6);
|
|
12
|
-
expect((0.1).safeAdd(0.2)).toBe(0.3);
|
|
13
|
-
expect((0.3).safeAdd(-0.2)).toBe(0.1);
|
|
14
|
-
expect((0.1).safeSubtract(0.2)).toBe(-0.1);
|
|
15
|
-
expect((0.1).safeSubtract(0.3)).toBe(-0.2);
|
|
16
|
-
expect((0.1).safeSubtract(-0.3)).toBe(0.4);
|
|
17
|
-
expect((0.1).safeMultiply(0.2)).toBe(0.02);
|
|
18
|
-
expect((0.1).safeDivision(0.2)).toBe(0.5);
|
|
19
|
-
});
|
|
20
|
-
//# sourceMappingURL=number.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"number.test.js","sourceRoot":"","sources":["../../src/extension/number.test.ts"],"names":[],"mappings":";;AAAA,4BAA0B;AAC1B,oBAAkB;AAClB,oBAAkB;AAElB,IAAI,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAC5B,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAC7C,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACpC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEtC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEtC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAC3C,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAC3C,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE3C,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE3C,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5C,CAAC,CAAC,CAAC"}
|
package/dist/extension/object.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
function deepClone(obj) {
|
|
3
|
-
if (obj === null || typeof obj !== "object") {
|
|
4
|
-
return obj;
|
|
5
|
-
}
|
|
6
|
-
const result = Array.isArray(obj) ? [] : {};
|
|
7
|
-
for (let key of Object.keys(obj)) {
|
|
8
|
-
result[key] = deepClone(obj[key]);
|
|
9
|
-
}
|
|
10
|
-
return result;
|
|
11
|
-
}
|
|
12
|
-
Object.prototype.deepClone = deepClone(this);
|
|
13
|
-
//# sourceMappingURL=object.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../src/extension/object.ts"],"names":[],"mappings":";AAIA,SAAS,SAAS,CAAC,GAAQ;IACzB,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3C,OAAO,GAAG,CAAC;KACZ;IAED,MAAM,MAAM,GAAQ,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAEjD,KAAK,IAAI,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAChC,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;KACnC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
interface StringConstructor {
|
|
2
|
-
fixPoint(s: string, length: number): string;
|
|
3
|
-
fixNumber(length: number): string;
|
|
4
|
-
leadingChars(chars: string | number, length: number): string;
|
|
5
|
-
toComma(): string;
|
|
6
|
-
toNumber(): number;
|
|
7
|
-
}
|
|
8
|
-
interface String {
|
|
9
|
-
fixPoint(length: number): string;
|
|
10
|
-
fixNumber(length: number): string;
|
|
11
|
-
leadingChars(chars: string | number, length: number): string;
|
|
12
|
-
toComma(): string;
|
|
13
|
-
toNumber(): number;
|
|
14
|
-
}
|
package/dist/extension/string.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
String.prototype.leadingChars = function (chars, length) {
|
|
3
|
-
return (chars.toString().repeat(length) + this).substr(-length);
|
|
4
|
-
};
|
|
5
|
-
String.prototype.fixPoint = function (length = 0) {
|
|
6
|
-
let base = this.split(".");
|
|
7
|
-
let point = this.split(".");
|
|
8
|
-
if (point.length == 1)
|
|
9
|
-
point[1] = "";
|
|
10
|
-
else if (point.length >= 3)
|
|
11
|
-
throw new Error("Invalid String");
|
|
12
|
-
let result = base[0];
|
|
13
|
-
if (point.length == 2 && length != 0)
|
|
14
|
-
result += `.${point[1].padEnd(length, "0").slice(0, length)}`;
|
|
15
|
-
return result;
|
|
16
|
-
};
|
|
17
|
-
String.prototype.fixNumber = function (length) {
|
|
18
|
-
let point = this.split(".");
|
|
19
|
-
let result = point[0].toNumber().toString().padStart(length, "0");
|
|
20
|
-
if (point.length == 2)
|
|
21
|
-
result += `.${point[1]}`;
|
|
22
|
-
return result;
|
|
23
|
-
};
|
|
24
|
-
String.prototype.toComma = function () {
|
|
25
|
-
if (this.length == 0 || this == "NaN")
|
|
26
|
-
return "0";
|
|
27
|
-
const tmp = this.split(".");
|
|
28
|
-
let result = tmp[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
29
|
-
if (tmp.length != 1)
|
|
30
|
-
result += `.${tmp[1]}`;
|
|
31
|
-
return result;
|
|
32
|
-
};
|
|
33
|
-
String.prototype.toNumber = function () {
|
|
34
|
-
return Number(this.replace(/,/gi, ""));
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=string.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../src/extension/string.ts"],"names":[],"mappings":";AAgBA,MAAM,CAAC,SAAS,CAAC,YAAY,GAAG,UAAU,KAAsB,EAAE,MAAc;IAC9E,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAClE,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,QAAQ,GAAG,UAAU,SAAiB,CAAC;IACtD,IAAI,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC;QAAE,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;SAChC,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAE9D,IAAI,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACrB,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;QAAE,MAAM,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC;IAEpG,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,SAAS,GAAG,UAAU,MAAc;IACnD,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE5B,IAAI,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAClE,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC;QAAE,MAAM,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAEhD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,OAAO,GAAG;IACzB,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK;QAAE,OAAO,GAAG,CAAC;IAClD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE5B,IAAI,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;IAC1D,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC;QAAE,MAAM,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5C,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,QAAQ,GAAG;IAC1B,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;AACzC,CAAC,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
require("./string");
|
|
4
|
-
require("./number");
|
|
5
|
-
test("string - toComma()", () => {
|
|
6
|
-
expect("123".toComma()).toBe("123");
|
|
7
|
-
expect("123456".toComma()).toBe("123,456");
|
|
8
|
-
expect("24816246784".toComma()).toBe("24,816,246,784");
|
|
9
|
-
expect("24,816,246,784".toNumber()).toBe(24816246784);
|
|
10
|
-
});
|
|
11
|
-
test("string - pad extension", () => {
|
|
12
|
-
expect("300".fixPoint(3)).toBe("300.000");
|
|
13
|
-
expect((30222.12).fixPoint(5)).toBe("30222.12000");
|
|
14
|
-
expect("30222.50380000".fixPoint(5)).toBe("30222.50380");
|
|
15
|
-
expect("30222.50380000".fixPoint(5).toComma()).toBe("30,222.50380");
|
|
16
|
-
expect((30222.12).fixPoint(3).toComma()).toBe("30,222.120");
|
|
17
|
-
});
|
|
18
|
-
//# sourceMappingURL=string.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"string.test.js","sourceRoot":"","sources":["../../src/extension/string.test.ts"],"names":[],"mappings":";;AAAA,oBAAkB;AAClB,oBAAkB;AAElB,IAAI,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAC9B,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAE3C,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAEvD,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACxD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,wBAAwB,EAAE,GAAG,EAAE;IAClC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1C,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACnD,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACzD,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACpE,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AAC9D,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;AAC3B,uBAAqB;AACrB,sBAAoB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/override/console.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const consola = require("consola");
|
|
4
|
-
function getTime() {
|
|
5
|
-
const nowDate = new Date();
|
|
6
|
-
return `${nowDate.getHours()}:${nowDate.getMinutes()}:${nowDate.getSeconds()}:${`${nowDate.getMilliseconds()}`.padStart(3, "0")}`;
|
|
7
|
-
}
|
|
8
|
-
function showMessage(type, ...message) {
|
|
9
|
-
consola[type](`\x1b[2m[${getTime()}]\x1b[0m\x1b[37m`, ...message);
|
|
10
|
-
}
|
|
11
|
-
console.log = function (...message) {
|
|
12
|
-
if (process.env.NODE_ENV != "production")
|
|
13
|
-
showMessage("info", ...message);
|
|
14
|
-
};
|
|
15
|
-
console.info = function (...message) {
|
|
16
|
-
if (process.env.NODE_ENV != "production")
|
|
17
|
-
showMessage("info", ...message);
|
|
18
|
-
};
|
|
19
|
-
console.warn = function (...message) {
|
|
20
|
-
showMessage("warn", ...message);
|
|
21
|
-
};
|
|
22
|
-
console.error = function (...message) {
|
|
23
|
-
showMessage("error", ...message);
|
|
24
|
-
};
|
|
25
|
-
globalThis.console = console;
|
|
26
|
-
//# sourceMappingURL=console.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"console.js","sourceRoot":"","sources":["../../src/override/console.ts"],"names":[],"mappings":";;AACA,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAEnC,SAAS,OAAO;IACd,MAAM,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;IAC3B,OAAO,GAAG,OAAO,CAAC,QAAQ,EAAE,IAAI,OAAO,CAAC,UAAU,EAAE,IAAI,OAAO,CAAC,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;AACpI,CAAC;AAED,SAAS,WAAW,CAAC,IAA+B,EAAE,GAAG,OAAY;IACnE,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,OAAO,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,CAAC;AACpE,CAAC;AACD,OAAO,CAAC,GAAG,GAAG,UAAU,GAAG,OAAY;IACrC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,YAAY;QAAE,WAAW,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC;AAC5E,CAAC,CAAC;AACF,OAAO,CAAC,IAAI,GAAG,UAAU,GAAG,OAAY;IACtC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,YAAY;QAAE,WAAW,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC;AAC5E,CAAC,CAAC;AACF,OAAO,CAAC,IAAI,GAAG,UAAU,GAAG,OAAY;IACtC,WAAW,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC;AAClC,CAAC,CAAC;AACF,OAAO,CAAC,KAAK,GAAG,UAAU,GAAG,OAAY;IACvC,WAAW,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC"}
|
package/dist/override/index.d.ts
DELETED
package/dist/override/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/override/index.ts"],"names":[],"mappings":";;AAAA,wBAAsB;AAEtB,qBAAmB;AACnB,kBAAgB"}
|
package/dist/override/math.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
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 = precision == null ? 0 : precision >= 0 ? Math.min(precision, 292) : Math.max(precision, -292);
|
|
26
|
-
if (precision) {
|
|
27
|
-
// Shift with exponential notation to avoid floating-point issues.
|
|
28
|
-
// See [MDN](https://mdn.io/round#Examples) for more details.
|
|
29
|
-
let pair = `${number}e`.split("e");
|
|
30
|
-
const value = func(`${pair[0]}e${+pair[1] + precision}`.toNumber());
|
|
31
|
-
pair = `${value}e`.split("e");
|
|
32
|
-
return +`${pair[0]}e${+pair[1] - precision}`;
|
|
33
|
-
}
|
|
34
|
-
return func(number);
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
globalThis.Math = Math;
|
|
38
|
-
//# sourceMappingURL=math.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"math.js","sourceRoot":"","sources":["../../src/override/math.ts"],"names":[],"mappings":";;AAYA,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;IACjB,IAAI,CAAC,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;CACvC;AACD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;IACjB,IAAI,CAAC,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;CACvC;AACD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;IAChB,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;CACrC;AAED,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;IACrB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAS,EAAE,CAAS,EAAE,QAAgB,CAAC;QAClE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IAC9D,CAAC,CAAC;CACH;AAED,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;IACf,IAAI,CAAC,KAAK,GAAG,UAAU,KAAa,EAAE,GAAW,EAAE,GAAW;QAC5D,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IAC7C,CAAC,CAAC;CACH;AAED,SAAS,aAAa,CAAC,IAAgC;IACrD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,OAAO,CAAC,MAAc,EAAE,YAAoB,CAAC,EAAE,EAAE;QAC/C,SAAS,GAAG,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC;QAC1G,IAAI,SAAS,EAAE;YACb,kEAAkE;YAClE,6DAA6D;YAC7D,IAAI,IAAI,GAAG,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;YAEpE,IAAI,GAAG,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC9B,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC;SAC9C;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC,CAAC;AACJ,CAAC;AAED,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC"}
|
package/dist/test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./index";
|
package/dist/test.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
require("./index");
|
|
4
|
-
// import "../dist";
|
|
5
|
-
// console.log("hello");
|
|
6
|
-
// console.warn("warn log");
|
|
7
|
-
// console.error("error log");
|
|
8
|
-
// console.log("300".pointPad(10));
|
|
9
|
-
// console.log("300".toComma(10));
|
|
10
|
-
// console.log("24816246784".toComma());
|
|
11
|
-
// console.log("24816246784".toNumber());
|
|
12
|
-
// console.log((24816246784).toComma());
|
|
13
|
-
// console.log(35 % 0.8);
|
|
14
|
-
//0.5999999999999981
|
|
15
|
-
// console.log((35).ampersand(0.8));
|
|
16
|
-
//0.6
|
|
17
|
-
// console.log(0.1 * 0.2);
|
|
18
|
-
// console.log((0.1).safeMultiply(0.2));
|
|
19
|
-
// console.log(0.2 / 0.2);
|
|
20
|
-
// console.log((0.1).safeAdd(0.2)); // 0.6
|
|
21
|
-
// console.log((0.3).safeAdd(-0.2));
|
|
22
|
-
// console.log((0.1).safeSubtract(0.3)); // 0.6
|
|
23
|
-
// console.log((35).ampersand(0.8)); // 0.6
|
|
24
|
-
// console.log((0.2).safeDivision(0.6)); // 0.8333333333333334
|
|
25
|
-
// console.log((0.1).safeMultiply(0.2)); // 0.02
|
|
26
|
-
//////////////////////////////////////////////////////////////////////////
|
|
27
|
-
// console.log(Math.round10(112.5345, 3));
|
|
28
|
-
// console.log(Math.floor10(112.5345, 3));
|
|
29
|
-
// console.log(Math.ceil10(112.5345, 3));
|
|
30
|
-
// // console.log(Math.round(112.5));
|
|
31
|
-
// console.log(Math.randomRange(112.5, 200, 1));
|
|
32
|
-
// console.log(Math.randomRange(112.5, 200, 0));
|
|
33
|
-
// for (var i = 0; i < 10; i++) {
|
|
34
|
-
// console.log(Math.randomRange(4, 5));
|
|
35
|
-
// }
|
|
36
|
-
////////////////////////////////////////////////////////////////////////////
|
|
37
|
-
console.log("123".toComma());
|
|
38
|
-
// console.log((1).fixNumber(5));
|
|
39
|
-
// console.log((3022).fixNumber(1));
|
|
40
|
-
// console.log((30222.12).fixNumber(8));
|
|
41
|
-
// console.log((30222.12).fixNumber(8).toComma());
|
|
42
|
-
// console.log("30222.50380000".fixPoint(8).fixNumber(8));
|
|
43
|
-
console.log("30222.50380000".fixPoint(5));
|
|
44
|
-
console.log("30222.50380000".fixPoint(5).toComma());
|
|
45
|
-
// console.log((30222).fixPoint(3));
|
|
46
|
-
// console.log((30222.12).fixPoint(5).toComma());
|
|
47
|
-
// console.log((30222.12).toComma().pointPad(5));
|
|
48
|
-
// console.log("30222.12".pointPad(5));
|
|
49
|
-
// console.log(Math.clamp(10, 3, 5));
|
|
50
|
-
// console.log(Math.clamp(1, 3, 5));
|
|
51
|
-
// console.log(Math.clamp(4, 3, 5));
|
|
52
|
-
const hello = [1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
53
|
-
// hello.findIndex;
|
|
54
|
-
//# sourceMappingURL=test.js.map
|
package/dist/test.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":";;AAAA,mBAAiB;AACjB,oBAAoB;AAEpB,wBAAwB;AACxB,4BAA4B;AAC5B,8BAA8B;AAE9B,mCAAmC;AACnC,kCAAkC;AAClC,wCAAwC;AACxC,yCAAyC;AAEzC,wCAAwC;AAExC,yBAAyB;AACzB,oBAAoB;AACpB,oCAAoC;AACpC,KAAK;AAEL,0BAA0B;AAC1B,wCAAwC;AACxC,0BAA0B;AAC1B,0CAA0C;AAC1C,oCAAoC;AAEpC,+CAA+C;AAC/C,2CAA2C;AAC3C,8DAA8D;AAC9D,gDAAgD;AAEhD,0EAA0E;AAE1E,0CAA0C;AAC1C,0CAA0C;AAC1C,yCAAyC;AACzC,qCAAqC;AACrC,gDAAgD;AAChD,gDAAgD;AAChD,iCAAiC;AACjC,yCAAyC;AACzC,IAAI;AAEJ,4EAA4E;AAE5E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;AAC7B,iCAAiC;AACjC,oCAAoC;AAEpC,wCAAwC;AACxC,kDAAkD;AAElD,0DAA0D;AAC1D,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1C,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAEpD,oCAAoC;AACpC,iDAAiD;AACjD,iDAAiD;AACjD,uCAAuC;AAEvC,qCAAqC;AACrC,oCAAoC;AACpC,oCAAoC;AAEpC,MAAM,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAE1C,mBAAmB"}
|
package/dist/utils/deepCopy.d.ts
DELETED
package/dist/utils/deepCopy.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function deepClone(obj) {
|
|
4
|
-
if (obj === null || typeof obj !== "object") {
|
|
5
|
-
return obj;
|
|
6
|
-
}
|
|
7
|
-
const result = Array.isArray(obj) ? [] : {};
|
|
8
|
-
for (let key of Object.keys(obj)) {
|
|
9
|
-
result[key] = deepClone(obj[key]);
|
|
10
|
-
}
|
|
11
|
-
return result;
|
|
12
|
-
}
|
|
13
|
-
exports.default = deepClone;
|
|
14
|
-
//# sourceMappingURL=deepCopy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deepCopy.js","sourceRoot":"","sources":["../../src/utils/deepCopy.ts"],"names":[],"mappings":";;AAAA,SAAS,SAAS,CAAC,GAAQ;IACzB,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3C,OAAO,GAAG,CAAC;KACZ;IAED,MAAM,MAAM,GAAQ,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAEjD,KAAK,IAAI,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAChC,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;KACnC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,kBAAe,SAAS,CAAC"}
|