@simplysm/core-common 14.0.100 → 14.0.102
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/dist/common.types.d.ts +0 -24
- package/dist/common.types.d.ts.map +1 -1
- package/dist/common.types.js.map +1 -1
- package/dist/errors/argument-error.d.ts +0 -10
- package/dist/errors/argument-error.d.ts.map +1 -1
- package/dist/errors/argument-error.js +0 -10
- package/dist/errors/argument-error.js.map +1 -1
- package/dist/errors/not-implemented-error.d.ts +0 -15
- package/dist/errors/not-implemented-error.d.ts.map +1 -1
- package/dist/errors/not-implemented-error.js +0 -15
- package/dist/errors/not-implemented-error.js.map +1 -1
- package/dist/errors/sd-error.d.ts +0 -14
- package/dist/errors/sd-error.d.ts.map +1 -1
- package/dist/errors/sd-error.js +0 -14
- package/dist/errors/sd-error.js.map +1 -1
- package/dist/errors/timeout-error.d.ts +0 -16
- package/dist/errors/timeout-error.d.ts.map +1 -1
- package/dist/errors/timeout-error.js +0 -16
- package/dist/errors/timeout-error.js.map +1 -1
- package/dist/extensions/arr-ext.types.d.ts +0 -24
- package/dist/extensions/arr-ext.types.d.ts.map +1 -1
- package/dist/extensions/arr-ext.types.js.map +1 -1
- package/dist/extensions/map-ext.d.ts +0 -27
- package/dist/extensions/map-ext.d.ts.map +1 -1
- package/dist/extensions/map-ext.js.map +1 -1
- package/dist/extensions/set-ext.d.ts +0 -12
- package/dist/extensions/set-ext.d.ts.map +1 -1
- package/dist/extensions/set-ext.js.map +1 -1
- package/dist/features/debounce-queue.d.ts +0 -10
- package/dist/features/debounce-queue.d.ts.map +1 -1
- package/dist/features/debounce-queue.js +0 -10
- package/dist/features/debounce-queue.js.map +1 -1
- package/dist/features/event-emitter.d.ts +0 -14
- package/dist/features/event-emitter.d.ts.map +1 -1
- package/dist/features/event-emitter.js +0 -14
- package/dist/features/event-emitter.js.map +1 -1
- package/dist/features/serial-queue.d.ts +0 -10
- package/dist/features/serial-queue.d.ts.map +1 -1
- package/dist/features/serial-queue.js +0 -10
- package/dist/features/serial-queue.js.map +1 -1
- package/dist/types/date-only.d.ts +0 -32
- package/dist/types/date-only.d.ts.map +1 -1
- package/dist/types/date-only.js +0 -32
- package/dist/types/date-only.js.map +1 -1
- package/dist/types/date-time.d.ts +0 -12
- package/dist/types/date-time.d.ts.map +1 -1
- package/dist/types/date-time.js +0 -12
- package/dist/types/date-time.js.map +1 -1
- package/dist/types/lazy-gc-map.d.ts +0 -8
- package/dist/types/lazy-gc-map.d.ts.map +1 -1
- package/dist/types/lazy-gc-map.js +0 -8
- package/dist/types/lazy-gc-map.js.map +1 -1
- package/dist/types/time.d.ts +0 -11
- package/dist/types/time.d.ts.map +1 -1
- package/dist/types/time.js +0 -11
- package/dist/types/time.js.map +1 -1
- package/dist/types/uuid.d.ts +0 -4
- package/dist/types/uuid.d.ts.map +1 -1
- package/dist/types/uuid.js +0 -4
- package/dist/types/uuid.js.map +1 -1
- package/dist/utils/bytes.d.ts +0 -17
- package/dist/utils/bytes.d.ts.map +1 -1
- package/dist/utils/bytes.js +0 -17
- package/dist/utils/bytes.js.map +1 -1
- package/dist/utils/date-format.d.ts +0 -16
- package/dist/utils/date-format.d.ts.map +1 -1
- package/dist/utils/date-format.js +0 -16
- package/dist/utils/date-format.js.map +1 -1
- package/dist/utils/num.d.ts +0 -12
- package/dist/utils/num.d.ts.map +1 -1
- package/dist/utils/num.js +0 -9
- package/dist/utils/num.js.map +1 -1
- package/dist/utils/obj.d.ts +0 -39
- package/dist/utils/obj.d.ts.map +1 -1
- package/dist/utils/obj.js +0 -35
- package/dist/utils/obj.js.map +1 -1
- package/dist/utils/primitive.d.ts +0 -6
- package/dist/utils/primitive.d.ts.map +1 -1
- package/dist/utils/primitive.js +0 -6
- package/dist/utils/primitive.js.map +1 -1
- package/dist/utils/str.d.ts +0 -43
- package/dist/utils/str.d.ts.map +1 -1
- package/dist/utils/str.js +0 -43
- package/dist/utils/str.js.map +1 -1
- package/dist/utils/template-strings.d.ts +0 -37
- package/dist/utils/template-strings.d.ts.map +1 -1
- package/dist/utils/template-strings.js +0 -37
- package/dist/utils/template-strings.js.map +1 -1
- package/dist/utils/transferable.d.ts +0 -8
- package/dist/utils/transferable.d.ts.map +1 -1
- package/dist/utils/transferable.js +0 -8
- package/dist/utils/transferable.js.map +1 -1
- package/dist/utils/wait.d.ts +0 -3
- package/dist/utils/wait.d.ts.map +1 -1
- package/dist/utils/wait.js +0 -3
- package/dist/utils/wait.js.map +1 -1
- package/dist/utils/xml.d.ts +0 -11
- package/dist/utils/xml.d.ts.map +1 -1
- package/dist/utils/xml.js +0 -11
- package/dist/utils/xml.js.map +1 -1
- package/dist/utils/zip.d.ts +0 -31
- package/dist/utils/zip.d.ts.map +1 -1
- package/dist/utils/zip.js +0 -31
- package/dist/utils/zip.js.map +1 -1
- package/package.json +1 -1
- package/src/common.types.ts +0 -24
- package/src/errors/argument-error.ts +0 -10
- package/src/errors/not-implemented-error.ts +0 -15
- package/src/errors/sd-error.ts +0 -14
- package/src/errors/timeout-error.ts +0 -16
- package/src/extensions/arr-ext.types.ts +0 -24
- package/src/extensions/map-ext.ts +0 -27
- package/src/extensions/set-ext.ts +0 -12
- package/src/features/debounce-queue.ts +0 -10
- package/src/features/event-emitter.ts +0 -14
- package/src/features/serial-queue.ts +0 -10
- package/src/types/date-only.ts +0 -32
- package/src/types/date-time.ts +0 -12
- package/src/types/lazy-gc-map.ts +0 -8
- package/src/types/time.ts +0 -11
- package/src/types/uuid.ts +0 -4
- package/src/utils/bytes.ts +0 -17
- package/src/utils/date-format.ts +0 -16
- package/src/utils/num.ts +0 -12
- package/src/utils/obj.ts +0 -39
- package/src/utils/primitive.ts +0 -6
- package/src/utils/str.ts +0 -43
- package/src/utils/template-strings.ts +0 -37
- package/src/utils/transferable.ts +0 -8
- package/src/utils/wait.ts +0 -3
- package/src/utils/xml.ts +0 -11
- package/src/utils/zip.ts +0 -31
package/src/utils/str.ts
CHANGED
|
@@ -26,10 +26,6 @@ const suffixTable = {
|
|
|
26
26
|
* - `"랑"`: 이랑/랑 (접속 조사)
|
|
27
27
|
* - `"로"`: 으로/로 (도구격 조사)
|
|
28
28
|
* - `"라"`: 이라/라 (서술격 조사)
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* getKoreanSuffix("Apple", "을") // "를"
|
|
32
|
-
* getKoreanSuffix("책", "이") // "이"
|
|
33
29
|
*/
|
|
34
30
|
export function getKoreanSuffix(
|
|
35
31
|
text: string,
|
|
@@ -145,10 +141,6 @@ const fullWidthCharRegex = new RegExp(`[${Object.keys(fullWidthCharMap).join("")
|
|
|
145
141
|
* - 전각 숫자 (0-9 → 0-9)
|
|
146
142
|
* - 전각 공백 ( → 일반 공백)
|
|
147
143
|
* - 전각 괄호 (() → ())
|
|
148
|
-
*
|
|
149
|
-
* @example
|
|
150
|
-
* replaceFullWidth("A123") // "A123"
|
|
151
|
-
* replaceFullWidth("(株)") // "(株)"
|
|
152
144
|
*/
|
|
153
145
|
export function replaceFullWidth(str: string): string {
|
|
154
146
|
return str.replace(fullWidthCharRegex, (char) => fullWidthCharMap[char] ?? char);
|
|
@@ -160,9 +152,6 @@ export function replaceFullWidth(str: string): string {
|
|
|
160
152
|
|
|
161
153
|
/**
|
|
162
154
|
* PascalCase로 변환
|
|
163
|
-
* @example "hello-world" → "HelloWorld"
|
|
164
|
-
* @example "hello_world" → "HelloWorld"
|
|
165
|
-
* @example "hello.world" → "HelloWorld"
|
|
166
155
|
*/
|
|
167
156
|
export function toPascalCase(str: string): string {
|
|
168
157
|
return str
|
|
@@ -172,9 +161,6 @@ export function toPascalCase(str: string): string {
|
|
|
172
161
|
|
|
173
162
|
/**
|
|
174
163
|
* camelCase로 변환
|
|
175
|
-
* @example "hello-world" → "helloWorld"
|
|
176
|
-
* @example "hello_world" → "helloWorld"
|
|
177
|
-
* @example "HelloWorld" → "helloWorld"
|
|
178
164
|
*/
|
|
179
165
|
export function toCamelCase(str: string): string {
|
|
180
166
|
return str
|
|
@@ -184,13 +170,6 @@ export function toCamelCase(str: string): string {
|
|
|
184
170
|
|
|
185
171
|
/**
|
|
186
172
|
* kebab-case로 변환
|
|
187
|
-
*
|
|
188
|
-
* @example "HelloWorld" → "hello-world"
|
|
189
|
-
* @example "helloWorld" → "hello-world"
|
|
190
|
-
* @example "hello_world" → "hello_world" (소문자만이면 변환 없음)
|
|
191
|
-
* @example "Hello_World" → "hello-_world" (기존 구분자 유지)
|
|
192
|
-
* @example "Hello-World" → "hello--world" (기존 구분자 유지)
|
|
193
|
-
* @example "XMLParser" → "x-m-l-parser" (연속 대문자 분리)
|
|
194
173
|
*/
|
|
195
174
|
export function toKebabCase(str: string): string {
|
|
196
175
|
return toCaseWithSeparator(str, "-");
|
|
@@ -198,13 +177,6 @@ export function toKebabCase(str: string): string {
|
|
|
198
177
|
|
|
199
178
|
/**
|
|
200
179
|
* snake_case로 변환
|
|
201
|
-
*
|
|
202
|
-
* @example "HelloWorld" → "hello_world"
|
|
203
|
-
* @example "helloWorld" → "hello_world"
|
|
204
|
-
* @example "hello-world" → "hello-world" (소문자만이면 변환 없음)
|
|
205
|
-
* @example "Hello-World" → "hello_-world" (기존 구분자 유지)
|
|
206
|
-
* @example "Hello_World" → "hello__world" (기존 구분자 유지)
|
|
207
|
-
* @example "XMLParser" → "x_m_l_parser" (연속 대문자 분리)
|
|
208
180
|
*/
|
|
209
181
|
export function toSnakeCase(str: string): string {
|
|
210
182
|
return toCaseWithSeparator(str, "_");
|
|
@@ -225,16 +197,6 @@ function toCaseWithSeparator(str: string, separator: string): string {
|
|
|
225
197
|
*
|
|
226
198
|
* @param str 검사할 문자열
|
|
227
199
|
* @returns undefined, null, 또는 빈 문자열이면 true
|
|
228
|
-
*
|
|
229
|
-
* @example
|
|
230
|
-
* const name: string | undefined = getValue();
|
|
231
|
-
* if (isNullOrEmpty(name)) {
|
|
232
|
-
* // name: "" | undefined
|
|
233
|
-
* console.log("Name is empty");
|
|
234
|
-
* } else {
|
|
235
|
-
* // name: string (non-empty string)
|
|
236
|
-
* console.log(`Name: ${name}`);
|
|
237
|
-
* }
|
|
238
200
|
*/
|
|
239
201
|
export function isNullOrEmpty(str: string | undefined): str is "" | undefined {
|
|
240
202
|
return str == null || str === "";
|
|
@@ -247,11 +209,6 @@ export function isNullOrEmpty(str: string | undefined): str is "" | undefined {
|
|
|
247
209
|
* @param index 삽입할 위치 (0부터 시작)
|
|
248
210
|
* @param insertString 삽입할 문자열
|
|
249
211
|
* @returns 삽입이 적용된 새 문자열
|
|
250
|
-
*
|
|
251
|
-
* @example
|
|
252
|
-
* insert("Hello World", 5, ","); // "Hello, World"
|
|
253
|
-
* insert("abc", 0, "X"); // "Xabc"
|
|
254
|
-
* insert("abc", 3, "X"); // "abcX"
|
|
255
212
|
*/
|
|
256
213
|
export function insert(str: string, index: number, insertString: string): string {
|
|
257
214
|
return str.substring(0, index) + insertString + str.substring(index);
|
|
@@ -8,12 +8,6 @@
|
|
|
8
8
|
* @param strings 템플릿 문자열 배열
|
|
9
9
|
* @param values 보간된 값들
|
|
10
10
|
* @returns 들여쓰기가 정규화된 문자열
|
|
11
|
-
* @example
|
|
12
|
-
* const code = js`
|
|
13
|
-
* function hello() {
|
|
14
|
-
* return "world";
|
|
15
|
-
* }
|
|
16
|
-
* `;
|
|
17
11
|
*/
|
|
18
12
|
export function js(strings: TemplateStringsArray, ...values: unknown[]): string {
|
|
19
13
|
return _combine(strings, values);
|
|
@@ -24,13 +18,6 @@ export function js(strings: TemplateStringsArray, ...values: unknown[]): string
|
|
|
24
18
|
* @param strings 템플릿 문자열 배열
|
|
25
19
|
* @param values 보간된 값들
|
|
26
20
|
* @returns 들여쓰기가 정규화된 문자열
|
|
27
|
-
* @example
|
|
28
|
-
* const code = ts`
|
|
29
|
-
* interface User {
|
|
30
|
-
* name: string;
|
|
31
|
-
* age: number;
|
|
32
|
-
* }
|
|
33
|
-
* `;
|
|
34
21
|
*/
|
|
35
22
|
export function ts(strings: TemplateStringsArray, ...values: unknown[]): string {
|
|
36
23
|
return _combine(strings, values);
|
|
@@ -41,12 +28,6 @@ export function ts(strings: TemplateStringsArray, ...values: unknown[]): string
|
|
|
41
28
|
* @param strings 템플릿 문자열 배열
|
|
42
29
|
* @param values 보간된 값들
|
|
43
30
|
* @returns 들여쓰기가 정규화된 문자열
|
|
44
|
-
* @example
|
|
45
|
-
* const markup = html`
|
|
46
|
-
* <div class="container">
|
|
47
|
-
* <span>${name}</span>
|
|
48
|
-
* </div>
|
|
49
|
-
* `;
|
|
50
31
|
*/
|
|
51
32
|
export function html(strings: TemplateStringsArray, ...values: unknown[]): string {
|
|
52
33
|
return _combine(strings, values);
|
|
@@ -57,12 +38,6 @@ export function html(strings: TemplateStringsArray, ...values: unknown[]): strin
|
|
|
57
38
|
* @param strings 템플릿 문자열 배열
|
|
58
39
|
* @param values 보간된 값들
|
|
59
40
|
* @returns 들여쓰기가 정규화된 문자열
|
|
60
|
-
* @example
|
|
61
|
-
* const query = tsql`
|
|
62
|
-
* SELECT TOP 10 *
|
|
63
|
-
* FROM Users
|
|
64
|
-
* WHERE Name LIKE '%${keyword}%'
|
|
65
|
-
* `;
|
|
66
41
|
*/
|
|
67
42
|
export function tsql(strings: TemplateStringsArray, ...values: unknown[]): string {
|
|
68
43
|
return _combine(strings, values);
|
|
@@ -73,12 +48,6 @@ export function tsql(strings: TemplateStringsArray, ...values: unknown[]): strin
|
|
|
73
48
|
* @param strings 템플릿 문자열 배열
|
|
74
49
|
* @param values 보간된 값들
|
|
75
50
|
* @returns 들여쓰기가 정규화된 문자열
|
|
76
|
-
* @example
|
|
77
|
-
* const query = mysql`
|
|
78
|
-
* SELECT *
|
|
79
|
-
* FROM users
|
|
80
|
-
* LIMIT 10
|
|
81
|
-
* `;
|
|
82
51
|
*/
|
|
83
52
|
export function mysql(strings: TemplateStringsArray, ...values: unknown[]): string {
|
|
84
53
|
return _combine(strings, values);
|
|
@@ -89,12 +58,6 @@ export function mysql(strings: TemplateStringsArray, ...values: unknown[]): stri
|
|
|
89
58
|
* @param strings 템플릿 문자열 배열
|
|
90
59
|
* @param values 보간된 값들
|
|
91
60
|
* @returns 들여쓰기가 정규화된 문자열
|
|
92
|
-
* @example
|
|
93
|
-
* const query = pgsql`
|
|
94
|
-
* SELECT *
|
|
95
|
-
* FROM users
|
|
96
|
-
* OFFSET 0 LIMIT 10
|
|
97
|
-
* `;
|
|
98
61
|
*/
|
|
99
62
|
export function pgsql(strings: TemplateStringsArray, ...values: unknown[]): string {
|
|
100
63
|
return _combine(strings, values);
|
|
@@ -25,14 +25,6 @@ type Transferable = ArrayBuffer;
|
|
|
25
25
|
*
|
|
26
26
|
* @note 순환 참조 시 transferableEncode에서 TypeError 발생 (경로 정보 포함)
|
|
27
27
|
* @note 같은 객체가 여러 곳에서 참조되면 캐싱된 인코딩 결과를 재사용
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* // Worker로 데이터 전송
|
|
31
|
-
* const { result, transferList } = transferableEncode(data);
|
|
32
|
-
* worker.postMessage(result, transferList);
|
|
33
|
-
*
|
|
34
|
-
* // Worker에서 데이터 수신
|
|
35
|
-
* const decoded = decode(event.data);
|
|
36
28
|
*/
|
|
37
29
|
|
|
38
30
|
//#region encode
|
package/src/utils/wait.ts
CHANGED
|
@@ -10,9 +10,6 @@ import { TimeoutError } from "../errors/timeout-error";
|
|
|
10
10
|
* @param maxCount 최대 시도 횟수 (undefined이면 무제한)
|
|
11
11
|
*
|
|
12
12
|
* @note 첫 번째 호출에서 조건이 true이면 즉시 반환.
|
|
13
|
-
* @example
|
|
14
|
-
* // maxCount=3: 최대 3번 조건 확인, 모두 false이면 TimeoutError 발생
|
|
15
|
-
* await waitUntil(() => someCondition, 100, 3);
|
|
16
13
|
* @throws TimeoutError 최대 시도 횟수를 초과했을 때
|
|
17
14
|
*/
|
|
18
15
|
export async function until(
|
package/src/utils/xml.ts
CHANGED
|
@@ -15,9 +15,6 @@ import { XMLBuilder, XMLParser } from "fast-xml-parser";
|
|
|
15
15
|
* - 속성: `$` 객체에 그룹화
|
|
16
16
|
* - 텍스트 노드: `_` key에 저장
|
|
17
17
|
* - 자식 요소: array로 변환 (루트 요소 제외)
|
|
18
|
-
* @example
|
|
19
|
-
* xmlParse('<root id="1"><item>hello</item></root>');
|
|
20
|
-
* // { root: { $: { id: "1" }, item: [{ _: "hello" }] } }
|
|
21
18
|
*/
|
|
22
19
|
export function parse(str: string, options?: { stripTagPrefix?: boolean }): unknown {
|
|
23
20
|
const result = new XMLParser({
|
|
@@ -44,14 +41,6 @@ export function parse(str: string, options?: { stripTagPrefix?: boolean }): unkn
|
|
|
44
41
|
* @param obj 직렬화할 객체
|
|
45
42
|
* @param options fast-xml-parser XmlBuilderOptions (선택사항)
|
|
46
43
|
* @returns XML 문자열
|
|
47
|
-
* @example
|
|
48
|
-
* xmlStringify({
|
|
49
|
-
* root: {
|
|
50
|
-
* $: { id: "1" },
|
|
51
|
-
* item: [{ _: "hello" }, { _: "world" }],
|
|
52
|
-
* },
|
|
53
|
-
* });
|
|
54
|
-
* // '<root id="1"><item>hello</item><item>world</item></root>'
|
|
55
44
|
*/
|
|
56
45
|
export function stringify(obj: unknown, options?: XmlBuilderOptions): string {
|
|
57
46
|
return new XMLBuilder({
|
package/src/utils/zip.ts
CHANGED
|
@@ -22,37 +22,6 @@ export interface ZipArchiveProgress {
|
|
|
22
22
|
*
|
|
23
23
|
* ZIP 파일의 읽기, 쓰기, 압축, 해제를 처리.
|
|
24
24
|
* 동일 파일의 중복 해제를 방지하기 위해 내부 캐싱 사용.
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* // ZIP 파일 읽기
|
|
28
|
-
* const archive = new ZipArchive(zipBytes);
|
|
29
|
-
* try {
|
|
30
|
-
* const content = await archive.get("file.txt");
|
|
31
|
-
* } finally {
|
|
32
|
-
* await archive.close();
|
|
33
|
-
* }
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* // ZIP 파일 생성
|
|
37
|
-
* const archive = new ZipArchive();
|
|
38
|
-
* try {
|
|
39
|
-
* archive.write("file.txt", textBytes);
|
|
40
|
-
* archive.write("data.json", jsonBytes);
|
|
41
|
-
* const zipBytes = await archive.compress();
|
|
42
|
-
* } finally {
|
|
43
|
-
* await archive.close();
|
|
44
|
-
* }
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* // 모든 파일 추출 (진행률 보고 포함)
|
|
48
|
-
* const archive = new ZipArchive(zipBytes);
|
|
49
|
-
* try {
|
|
50
|
-
* const files = await archive.extractAll((progress) => {
|
|
51
|
-
* console.log(`${progress.fileName}: ${progress.extractedSize}/${progress.totalSize}`);
|
|
52
|
-
* });
|
|
53
|
-
* } finally {
|
|
54
|
-
* await archive.close();
|
|
55
|
-
* }
|
|
56
25
|
*/
|
|
57
26
|
export class ZipArchive {
|
|
58
27
|
private readonly _reader?: ZipReader<Blob | Bytes>;
|