@simplysm/core-common 13.0.100 → 14.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/dist/common.types.d.ts +14 -14
  2. package/dist/common.types.js +2 -1
  3. package/dist/common.types.js.map +1 -6
  4. package/dist/env.d.ts +5 -0
  5. package/dist/env.d.ts.map +1 -1
  6. package/dist/env.js +12 -8
  7. package/dist/env.js.map +1 -6
  8. package/dist/errors/argument-error.d.ts +10 -10
  9. package/dist/errors/argument-error.d.ts.map +1 -1
  10. package/dist/errors/argument-error.js +31 -14
  11. package/dist/errors/argument-error.js.map +1 -6
  12. package/dist/errors/not-implemented-error.d.ts +8 -8
  13. package/dist/errors/not-implemented-error.js +30 -12
  14. package/dist/errors/not-implemented-error.js.map +1 -6
  15. package/dist/errors/sd-error.d.ts +10 -10
  16. package/dist/errors/sd-error.d.ts.map +1 -1
  17. package/dist/errors/sd-error.js +45 -24
  18. package/dist/errors/sd-error.js.map +1 -6
  19. package/dist/errors/timeout-error.d.ts +10 -10
  20. package/dist/errors/timeout-error.js +34 -15
  21. package/dist/errors/timeout-error.js.map +1 -6
  22. package/dist/extensions/arr-ext.d.ts +2 -2
  23. package/dist/extensions/arr-ext.helpers.d.ts +10 -10
  24. package/dist/extensions/arr-ext.helpers.js +112 -89
  25. package/dist/extensions/arr-ext.helpers.js.map +1 -6
  26. package/dist/extensions/arr-ext.js +458 -422
  27. package/dist/extensions/arr-ext.js.map +1 -6
  28. package/dist/extensions/arr-ext.types.d.ts +57 -57
  29. package/dist/extensions/arr-ext.types.d.ts.map +1 -1
  30. package/dist/extensions/arr-ext.types.js +6 -1
  31. package/dist/extensions/arr-ext.types.js.map +1 -6
  32. package/dist/extensions/map-ext.d.ts +16 -16
  33. package/dist/extensions/map-ext.js +27 -22
  34. package/dist/extensions/map-ext.js.map +1 -6
  35. package/dist/extensions/set-ext.d.ts +11 -11
  36. package/dist/extensions/set-ext.js +32 -25
  37. package/dist/extensions/set-ext.js.map +1 -6
  38. package/dist/features/debounce-queue.d.ts +17 -17
  39. package/dist/features/debounce-queue.js +98 -70
  40. package/dist/features/debounce-queue.js.map +1 -6
  41. package/dist/features/event-emitter.d.ts +20 -20
  42. package/dist/features/event-emitter.js +101 -78
  43. package/dist/features/event-emitter.js.map +1 -6
  44. package/dist/features/serial-queue.d.ts +11 -11
  45. package/dist/features/serial-queue.js +78 -57
  46. package/dist/features/serial-queue.js.map +1 -6
  47. package/dist/globals.d.ts +4 -4
  48. package/dist/globals.js +9 -1
  49. package/dist/globals.js.map +1 -6
  50. package/dist/index.js +28 -27
  51. package/dist/index.js.map +1 -6
  52. package/dist/types/date-only.d.ts +64 -64
  53. package/dist/types/date-only.d.ts.map +1 -1
  54. package/dist/types/date-only.js +263 -252
  55. package/dist/types/date-only.js.map +1 -6
  56. package/dist/types/date-time.d.ts +36 -36
  57. package/dist/types/date-time.d.ts.map +1 -1
  58. package/dist/types/date-time.js +196 -288
  59. package/dist/types/date-time.js.map +1 -6
  60. package/dist/types/lazy-gc-map.d.ts +26 -26
  61. package/dist/types/lazy-gc-map.d.ts.map +1 -1
  62. package/dist/types/lazy-gc-map.js +202 -159
  63. package/dist/types/lazy-gc-map.js.map +1 -6
  64. package/dist/types/time.d.ts +23 -23
  65. package/dist/types/time.d.ts.map +1 -1
  66. package/dist/types/time.js +169 -158
  67. package/dist/types/time.js.map +1 -6
  68. package/dist/types/uuid.d.ts +11 -11
  69. package/dist/types/uuid.d.ts.map +1 -1
  70. package/dist/types/uuid.js +95 -70
  71. package/dist/types/uuid.js.map +1 -6
  72. package/dist/utils/bytes.d.ts +17 -17
  73. package/dist/utils/bytes.js +137 -81
  74. package/dist/utils/bytes.js.map +1 -6
  75. package/dist/utils/date-format.d.ts +40 -40
  76. package/dist/utils/date-format.js +187 -101
  77. package/dist/utils/date-format.js.map +1 -6
  78. package/dist/utils/error.d.ts +4 -4
  79. package/dist/utils/error.js +11 -6
  80. package/dist/utils/error.js.map +1 -6
  81. package/dist/utils/json.d.ts +19 -19
  82. package/dist/utils/json.js +187 -135
  83. package/dist/utils/json.js.map +1 -6
  84. package/dist/utils/num.d.ts +20 -20
  85. package/dist/utils/num.js +76 -34
  86. package/dist/utils/num.js.map +1 -6
  87. package/dist/utils/obj.d.ts +111 -111
  88. package/dist/utils/obj.d.ts.map +1 -1
  89. package/dist/utils/obj.js +706 -496
  90. package/dist/utils/obj.js.map +1 -6
  91. package/dist/utils/path.d.ts +10 -10
  92. package/dist/utils/path.js +35 -18
  93. package/dist/utils/path.js.map +1 -6
  94. package/dist/utils/primitive.d.ts +5 -5
  95. package/dist/utils/primitive.js +34 -14
  96. package/dist/utils/primitive.js.map +1 -6
  97. package/dist/utils/str.d.ts +38 -38
  98. package/dist/utils/str.js +217 -113
  99. package/dist/utils/str.js.map +1 -6
  100. package/dist/utils/template-strings.d.ts +26 -26
  101. package/dist/utils/template-strings.js +113 -40
  102. package/dist/utils/template-strings.js.map +1 -6
  103. package/dist/utils/transferable.d.ts +18 -18
  104. package/dist/utils/transferable.js +218 -151
  105. package/dist/utils/transferable.js.map +1 -6
  106. package/dist/utils/wait.d.ts +9 -9
  107. package/dist/utils/wait.js +30 -15
  108. package/dist/utils/wait.js.map +1 -6
  109. package/dist/utils/xml.d.ts +13 -13
  110. package/dist/utils/xml.js +84 -46
  111. package/dist/utils/xml.js.map +1 -6
  112. package/dist/utils/zip.d.ts +22 -22
  113. package/dist/utils/zip.js +172 -148
  114. package/dist/utils/zip.js.map +1 -6
  115. package/package.json +5 -7
  116. package/src/common.types.ts +14 -14
  117. package/src/env.ts +9 -1
  118. package/src/errors/argument-error.ts +15 -15
  119. package/src/errors/not-implemented-error.ts +9 -9
  120. package/src/errors/sd-error.ts +12 -12
  121. package/src/errors/timeout-error.ts +12 -12
  122. package/src/extensions/arr-ext.helpers.ts +16 -16
  123. package/src/extensions/arr-ext.ts +35 -35
  124. package/src/extensions/arr-ext.types.ts +57 -57
  125. package/src/extensions/map-ext.ts +16 -16
  126. package/src/extensions/set-ext.ts +11 -11
  127. package/src/features/debounce-queue.ts +23 -23
  128. package/src/features/event-emitter.ts +25 -25
  129. package/src/features/serial-queue.ts +13 -13
  130. package/src/globals.ts +4 -4
  131. package/src/index.ts +5 -5
  132. package/src/types/date-only.ts +84 -83
  133. package/src/types/date-time.ts +43 -42
  134. package/src/types/lazy-gc-map.ts +44 -44
  135. package/src/types/time.ts +29 -29
  136. package/src/types/uuid.ts +15 -15
  137. package/src/utils/bytes.ts +35 -35
  138. package/src/utils/date-format.ts +59 -59
  139. package/src/utils/error.ts +4 -4
  140. package/src/utils/json.ts +41 -41
  141. package/src/utils/num.ts +20 -20
  142. package/src/utils/obj.ts +138 -138
  143. package/src/utils/path.ts +10 -10
  144. package/src/utils/primitive.ts +6 -6
  145. package/src/utils/str.ts +48 -48
  146. package/src/utils/template-strings.ts +29 -29
  147. package/src/utils/transferable.ts +38 -38
  148. package/src/utils/wait.ts +10 -10
  149. package/src/utils/xml.ts +19 -19
  150. package/src/utils/zip.ts +25 -25
  151. package/README.md +0 -160
  152. package/docs/errors.md +0 -119
  153. package/docs/extensions.md +0 -387
  154. package/docs/features.md +0 -143
  155. package/docs/types.md +0 -287
  156. package/docs/utils.md +0 -757
  157. package/tests/errors/errors.spec.ts +0 -80
  158. package/tests/extensions/array-extension.spec.ts +0 -654
  159. package/tests/extensions/map-extension.spec.ts +0 -117
  160. package/tests/extensions/set-extension.spec.ts +0 -67
  161. package/tests/types/date-only.spec.ts +0 -533
  162. package/tests/types/date-time.spec.ts +0 -246
  163. package/tests/types/lazy-gc-map.spec.ts +0 -606
  164. package/tests/types/time.spec.ts +0 -428
  165. package/tests/types/uuid.spec.ts +0 -74
  166. package/tests/utils/bytes-utils.spec.ts +0 -197
  167. package/tests/utils/date-format.spec.ts +0 -350
  168. package/tests/utils/debounce-queue.spec.ts +0 -226
  169. package/tests/utils/json.spec.ts +0 -400
  170. package/tests/utils/number.spec.ts +0 -136
  171. package/tests/utils/object.spec.ts +0 -810
  172. package/tests/utils/path.spec.ts +0 -70
  173. package/tests/utils/primitive.spec.ts +0 -43
  174. package/tests/utils/sd-event-emitter.spec.ts +0 -189
  175. package/tests/utils/serial-queue.spec.ts +0 -305
  176. package/tests/utils/string.spec.ts +0 -265
  177. package/tests/utils/template-strings.spec.ts +0 -48
  178. package/tests/utils/transferable.spec.ts +0 -639
  179. package/tests/utils/wait.spec.ts +0 -123
  180. package/tests/utils/xml.spec.ts +0 -146
  181. package/tests/utils/zip.spec.ts +0 -221
@@ -6,7 +6,7 @@ import { Uuid } from "./types/uuid";
6
6
  //#region Bytes Type
7
7
 
8
8
  /**
9
- * Binary type used instead of Buffer
9
+ * Buffer 대신 사용하는 바이너리 타입
10
10
  */
11
11
  export type Bytes = Uint8Array;
12
12
 
@@ -15,8 +15,8 @@ export type Bytes = Uint8Array;
15
15
  //#region Primitive Type
16
16
 
17
17
  /**
18
- * Primitive type mapping
19
- * Shared with orm-common
18
+ * 원시 타입 매핑
19
+ * orm-common과 공유
20
20
  */
21
21
  export type PrimitiveTypeMap = {
22
22
  string: string;
@@ -30,12 +30,12 @@ export type PrimitiveTypeMap = {
30
30
  };
31
31
 
32
32
  /**
33
- * Primitive type string key
33
+ * 원시 타입 문자열 key
34
34
  */
35
35
  export type PrimitiveTypeStr = keyof PrimitiveTypeMap;
36
36
 
37
37
  /**
38
- * Primitive type union
38
+ * 원시 타입 union
39
39
  */
40
40
  export type PrimitiveType = PrimitiveTypeMap[PrimitiveTypeStr] | undefined;
41
41
 
@@ -44,11 +44,11 @@ export type PrimitiveType = PrimitiveTypeMap[PrimitiveTypeStr] | undefined;
44
44
  //#region Utility Types
45
45
 
46
46
  /**
47
- * Deep Partial type
47
+ * Deep Partial 타입
48
48
  *
49
- * Recursively makes all properties of an object optional.
50
- * Primitive types (string, number, boolean, etc.) are kept as-is,
51
- * only object/array types have Partial applied recursively.
49
+ * 객체의 모든 속성을 재귀적으로 optional로 만든다.
50
+ * 원시 타입(string, number, boolean ) 그대로 유지하고,
51
+ * object/array 타입에만 재귀적으로 Partial 적용한다.
52
52
  *
53
53
  * @example
54
54
  * ```typescript
@@ -60,7 +60,7 @@ export type PrimitiveType = PrimitiveTypeMap[PrimitiveTypeStr] | undefined;
60
60
  * };
61
61
  * }
62
62
  *
63
- * // All properties at every depth become optional
63
+ * // 모든 깊이의 속성이 optional이
64
64
  * const partial: DeepPartial<User> = {
65
65
  * profile: { address: {} }
66
66
  * };
@@ -71,10 +71,10 @@ export type DeepPartial<TObject> = Partial<{
71
71
  }>;
72
72
 
73
73
  /**
74
- * Constructor type
74
+ * 생성자 타입
75
75
  *
76
- * Used to represent a class constructor as a type.
77
- * Primarily used in dependency injection, factory patterns, and instanceof checks.
76
+ * 클래스 생성자를 타입으로 표현할 사용한다.
77
+ * 주로 의존성 주입, 팩토리 패턴, instanceof 체크에 활용된다.
78
78
  *
79
79
  * @example
80
80
  * function create<T>(ctor: Type<T>): T {
@@ -82,7 +82,7 @@ export type DeepPartial<TObject> = Partial<{
82
82
  * }
83
83
  *
84
84
  * class MyClass { name = "test"; }
85
- * const instance = create(MyClass); // MyClass instance
85
+ * const instance = create(MyClass); // MyClass 인스턴스
86
86
  */
87
87
  export interface Type<TInstance> extends Function {
88
88
  new (...args: unknown[]): TInstance;
package/src/env.ts CHANGED
@@ -6,6 +6,14 @@ declare global {
6
6
  }
7
7
  }
8
8
 
9
+ /**
10
+ * 환경변수 값을 boolean으로 파싱
11
+ * "true", "1", "yes", "on" (대소문자 무시) → true, 그 외 → false
12
+ */
13
+ export function parseBoolEnv(value: unknown): boolean {
14
+ return ["true", "1", "yes", "on"].includes(String(value ?? "").toLowerCase());
15
+ }
16
+
9
17
  const _metaEnv: Record<string, unknown> = import.meta.env ?? {};
10
18
  const _processEnv: Record<string, unknown> = typeof process !== "undefined" ? process.env : {};
11
19
  const _raw: Record<string, unknown> = { ..._metaEnv, ..._processEnv };
@@ -16,6 +24,6 @@ export const env: {
16
24
  [key: string]: unknown;
17
25
  } = {
18
26
  ..._raw,
19
- DEV: JSON.parse(String(_raw["DEV"] != null && String(_raw["DEV"]) !== "" ? _raw["DEV"] : false)),
27
+ DEV: parseBoolEnv(_raw["DEV"]),
20
28
  VER: _raw["VER"] as string | undefined,
21
29
  };
@@ -1,29 +1,29 @@
1
- // Why we use the yaml library:
2
- // To represent nested object structures in a readable format.
3
- // Tree structure is more clearly visible than JSON.stringify.
1
+ // yaml 라이브러리를 사용하는 이유:
2
+ // 중첩된 객체 구조를 읽기 쉬운 형식으로 표현하기 위함.
3
+ // JSON.stringify보다 트리 구조가 명확하게 보임.
4
4
  import YAML from "yaml";
5
5
  import { SdError } from "./sd-error";
6
6
 
7
7
  /**
8
- * Argument error
8
+ * 인자 오류
9
9
  *
10
- * An error thrown when invalid arguments are received.
11
- * Includes the argument object in YAML format in the message to facilitate debugging.
10
+ * 유효하지 않은 인자를 전달받았을 발생하는 에러.
11
+ * 디버깅을 용이하게 하기 위해 인자 객체를 YAML 형식으로 메시지에 포함한다.
12
12
  *
13
13
  * @example
14
- * // Passing only the argument object
14
+ * // 인자 객체만 전달
15
15
  * throw new ArgumentError({ userId: 123, name: null });
16
- * // Result message: "Invalid arguments.\n\nuserId: 123\nname: null"
16
+ * // 결과 메시지: "잘못된 인자입니다.\n\nuserId: 123\nname: null"
17
17
  *
18
18
  * @example
19
- * // Passing a custom message and argument object
20
- * throw new ArgumentError("Invalid user", { userId: 123 });
21
- * // Result message: "Invalid user\n\nuserId: 123"
19
+ * // 커스텀 메시지와 인자 객체를 전달
20
+ * throw new ArgumentError("잘못된 사용자", { userId: 123 });
21
+ * // 결과 메시지: "잘못된 사용자\n\nuserId: 123"
22
22
  */
23
23
  export class ArgumentError extends SdError {
24
- /** Output argument object in YAML format with default message ("Invalid arguments.") */
24
+ /** 기본 메시지("잘못된 인자입니다.")와 함께 인자 객체를 YAML 형식으로 출력 */
25
25
  constructor(argObj: Record<string, unknown>);
26
- /** Output argument object in YAML format with a custom message */
26
+ /** 커스텀 메시지와 함께 인자 객체를 YAML 형식으로 출력 */
27
27
  constructor(message: string, argObj: Record<string, unknown>);
28
28
  constructor(arg1: Record<string, unknown> | string, arg2?: Record<string, unknown>);
29
29
  constructor(arg1: Record<string, unknown> | string, arg2?: Record<string, unknown>) {
@@ -31,9 +31,9 @@ export class ArgumentError extends SdError {
31
31
  const argObj = typeof arg1 === "string" ? arg2 : arg1;
32
32
 
33
33
  if (argObj != null) {
34
- super((message ?? "Invalid arguments.") + "\n\n" + YAML.stringify(argObj));
34
+ super((message ?? "잘못된 인자입니다.") + "\n\n" + YAML.stringify(argObj));
35
35
  } else {
36
- super(message ?? "Invalid arguments.");
36
+ super(message ?? "잘못된 인자입니다.");
37
37
  }
38
38
  this.name = "ArgumentError";
39
39
  }
@@ -1,32 +1,32 @@
1
1
  import { SdError } from "./sd-error";
2
2
 
3
3
  /**
4
- * Not implemented error
4
+ * 미구현 오류
5
5
  *
6
- * An error thrown when a feature that has not yet been implemented is called.
7
- * Used for abstract method stubs, branches planned for future implementation, etc.
6
+ * 아직 구현되지 않은 기능이 호출되었을 발생하는 에러.
7
+ * 추상 메서드 스텁, 향후 구현 예정인 분기 등에 사용된다.
8
8
  *
9
9
  * @example
10
- * // Before abstract method implementation
10
+ * // 추상 메서드 구현
11
11
  * class BaseService {
12
12
  * process(): void {
13
- * throw new NotImplementedError("Implementation required in subclass");
13
+ * throw new NotImplementedError("서브클래스에서 구현 필요");
14
14
  * }
15
15
  * }
16
16
  *
17
17
  * @example
18
- * // Branch planned for future implementation
18
+ * // 향후 구현 예정인 분기
19
19
  * switch (type) {
20
20
  * case "A": return handleA();
21
- * case "B": throw new NotImplementedError(`Handling for type ${type}`);
21
+ * case "B": throw new NotImplementedError(`타입 ${type} 처리`);
22
22
  * }
23
23
  */
24
24
  export class NotImplementedError extends SdError {
25
25
  /**
26
- * @param message Additional description message
26
+ * @param message 추가 설명 메시지
27
27
  */
28
28
  constructor(message?: string) {
29
- super("Not implemented" + (message != null ? ": " + message : ""));
29
+ super("미구현" + (message != null ? ": " + message : ""));
30
30
  this.name = "NotImplementedError";
31
31
  }
32
32
  }
@@ -1,27 +1,27 @@
1
1
  /**
2
- * Error class supporting Tree structure composition
3
- * Utilizes ES2024 cause property
2
+ * 트리 구조 조합을 지원하는 에러 클래스
3
+ * ES2024 cause 속성을 활용
4
4
  *
5
5
  * @example
6
- * // Wrap a cause error
6
+ * // 원인 에러를 감싸기
7
7
  * try {
8
8
  * await fetch(url);
9
9
  * } catch (err) {
10
- * throw new SdError(err, "API call failed", "User load failed");
10
+ * throw new SdError(err, "API 호출 실패", "사용자 로드 실패");
11
11
  * }
12
- * // Result message: "User load failed => API call failed => original error message"
12
+ * // 결과 메시지: "사용자 로드 실패 => API 호출 실패 => 원본 에러 메시지"
13
13
  *
14
14
  * @example
15
- * // Create with message only
16
- * throw new SdError("invalid state", "processing not possible");
17
- * // Result message: "processing not possible => invalid state"
15
+ * // 메시지만으로 생성
16
+ * throw new SdError("잘못된 상태", "처리 불가");
17
+ * // 결과 메시지: "처리 불가 => 잘못된 상태"
18
18
  */
19
19
  export class SdError extends Error {
20
20
  override cause?: Error;
21
21
 
22
- /** Create by wrapping a cause error. Messages are joined in reverse order (upper message => lower message => cause message) */
22
+ /** 원인 에러를 감싸서 생성. 메시지는 역순으로 결합됨 (상위 메시지 => 하위 메시지 => 원인 메시지) */
23
23
  constructor(cause: Error, ...messages: string[]);
24
- /** Create with messages only. Messages are joined in reverse order (upper message => lower message) */
24
+ /** 메시지만으로 생성. 메시지는 역순으로 결합됨 (상위 메시지 => 하위 메시지) */
25
25
  constructor(...messages: string[]);
26
26
  constructor(arg1?: unknown, ...messages: string[]);
27
27
  constructor(arg1?: unknown, ...messages: string[]) {
@@ -46,7 +46,7 @@ export class SdError extends Error {
46
46
  Object.setPrototypeOf(this, new.target.prototype);
47
47
  this.name = "SdError";
48
48
 
49
- // captureStackTrace available only on V8 engine (Node.js, Chrome)
49
+ // captureStackTrace V8 엔진(Node.js, Chrome)에서만 사용 가능
50
50
  if ("captureStackTrace" in Error) {
51
51
  (Error.captureStackTrace as (targetObject: object, constructorOpt?: Function) => void)(
52
52
  this,
@@ -54,7 +54,7 @@ export class SdError extends Error {
54
54
  );
55
55
  }
56
56
 
57
- // Add cause chain stack to current stack
57
+ // 원인 체인 stack 현재 stack에 추가
58
58
  if (cause?.stack != null) {
59
59
  this.stack += `\n---- cause stack ----\n${cause.stack}`;
60
60
  }
@@ -1,36 +1,36 @@
1
1
  import { SdError } from "./sd-error";
2
2
 
3
3
  /**
4
- * Timeout error
4
+ * 타임아웃 오류
5
5
  *
6
- * An error that occurs when the waiting time is exceeded.
7
- * Automatically thrown when the maximum number of attempts is exceeded in async waiting functions like Wait.until().
6
+ * 대기 시간이 초과되었을 발생하는 에러.
7
+ * Wait.until() 같은 비동기 대기 함수에서 최대 시도 횟수를 초과하면 자동으로 발생한다.
8
8
  *
9
9
  * @example
10
- * // Automatically thrown from Wait.until
10
+ * // Wait.until에서 자동 발생
11
11
  * try {
12
- * await Wait.until(() => isReady, 100, 50); // 100ms interval, max 50 attempts
12
+ * await Wait.until(() => isReady, 100, 50); // 100ms 간격, 최대 50 시도
13
13
  * } catch (err) {
14
14
  * if (err instanceof TimeoutError) {
15
- * console.log("Timeout exceeded");
15
+ * console.log("타임아웃 초과");
16
16
  * }
17
17
  * }
18
18
  *
19
19
  * @example
20
- * // Thrown directly
20
+ * // 직접 발생
21
21
  * if (elapsed > maxTime) {
22
- * throw new TimeoutError(undefined, "Waiting for API response exceeded");
22
+ * throw new TimeoutError(undefined, "API 응답 대기 초과");
23
23
  * }
24
24
  */
25
25
  export class TimeoutError extends SdError {
26
26
  /**
27
- * @param count Number of attempts
28
- * @param message Additional message
27
+ * @param count 시도 횟수
28
+ * @param message 추가 메시지
29
29
  */
30
30
  constructor(count?: number, message?: string) {
31
31
  super(
32
- "Waiting time exceeded" +
33
- (count != null ? `(${count} attempts)` : "") +
32
+ "대기 시간 초과" +
33
+ (count != null ? `(${count} 시도)` : "") +
34
34
  (message != null ? `: ${message}` : ""),
35
35
  );
36
36
  this.name = "TimeoutError";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Array extension helper functions
2
+ * Array 확장 헬퍼 함수
3
3
  */
4
4
 
5
5
  import { DateTime } from "../types/date-time";
@@ -10,7 +10,7 @@ import { equal } from "../utils/obj";
10
10
  import type { ComparableType } from "./arr-ext.types";
11
11
 
12
12
  /**
13
- * Convert DateTime, DateOnly, Time to comparable primitive values
13
+ * DateTime, DateOnly, Time 비교 가능한 원시 값으로 변환
14
14
  */
15
15
  export function toComparable(value: ComparableType): string | number | boolean | undefined {
16
16
  if (value instanceof DateOnly || value instanceof DateTime || value instanceof Time) {
@@ -20,13 +20,13 @@ export function toComparable(value: ComparableType): string | number | boolean |
20
20
  }
21
21
 
22
22
  /**
23
- * Comparison function for sorting
23
+ * 정렬용 비교 함수
24
24
  *
25
- * @param pp comparison target 1
26
- * @param pn comparison target 2
27
- * @param desc true: descending, false: ascending
28
- * @returns negative: pp comes first, 0: equal, positive: pn comes first
29
- * @note null/undefined values are sorted first in ascending, last in descending
25
+ * @param pp 비교 대상 1
26
+ * @param pn 비교 대상 2
27
+ * @param desc true: 내림차순, false: 오름차순
28
+ * @returns 음수: pp 앞, 0: 같음, 양수: pn
29
+ * @note null/undefined 값은 오름차순에서 앞, 내림차순에서 뒤로 정렬됨
30
30
  */
31
31
  export function compareForOrder(pp: ComparableType, pn: ComparableType, desc: boolean): number {
32
32
  const cpp = toComparable(pp);
@@ -46,19 +46,19 @@ export function compareForOrder(pp: ComparableType, pn: ComparableType, desc: bo
46
46
  return cpp < cpn ? -1 : cpp > cpn ? 1 : 0;
47
47
  }
48
48
  if (typeof cpn === "boolean" && typeof cpp === "boolean") {
49
- // true > false: true comes last in ascending, first in descending
49
+ // true > false: 오름차순에서 true 뒤, 내림차순에서 true가
50
50
  return cpn ? (desc ? 1 : -1) : desc ? -1 : 1;
51
51
  }
52
52
 
53
- throw new ArgumentError("Cannot use orderBy with this type.", {
53
+ throw new ArgumentError(" 타입으로는 orderBy 사용할 없습니다.", {
54
54
  type1: typeof cpp,
55
55
  type2: typeof cpn,
56
56
  });
57
57
  }
58
58
 
59
59
  /**
60
- * Returns a Set of indices to KEEP (i.e., first occurrence of each unique item).
61
- * Handles all deduplication strategies: matchAddress, keyFn, and default type-based.
60
+ * 유지할 index의 Set 반환 (즉, 고유 항목의 번째 등장 위치).
61
+ * matchAddress, keyFn, 기본 타입 기반 등 모든 중복 제거 전략을 처리한다.
62
62
  */
63
63
  export function getDistinctIndices<TItem>(
64
64
  items: readonly TItem[],
@@ -67,7 +67,7 @@ export function getDistinctIndices<TItem>(
67
67
  const opts = typeof options === "boolean" ? { matchAddress: options } : (options ?? {});
68
68
  const result = new Set<number>();
69
69
 
70
- // matchAddress: Set-based O(n)
70
+ // matchAddress: Set 기반 O(n)
71
71
  if (opts.matchAddress === true) {
72
72
  const seen = new Set<TItem>();
73
73
  for (let i = 0; i < items.length; i++) {
@@ -79,7 +79,7 @@ export function getDistinctIndices<TItem>(
79
79
  return result;
80
80
  }
81
81
 
82
- // keyFn provided: custom key-based O(n)
82
+ // keyFn 제공됨: 커스텀 key 기반 O(n)
83
83
  if (opts.keyFn) {
84
84
  const seen = new Set<string | number>();
85
85
  for (let i = 0; i < items.length; i++) {
@@ -92,7 +92,7 @@ export function getDistinctIndices<TItem>(
92
92
  return result;
93
93
  }
94
94
 
95
- // Default: type-based processing with edge cases
95
+ // 기본: 엣지 케이스를 포함한 타입 기반 처리
96
96
  const seen = new Map<string, TItem>();
97
97
  const seenRefs = new Set<symbol | ((...args: unknown[]) => unknown)>();
98
98
 
@@ -125,7 +125,7 @@ export function getDistinctIndices<TItem>(
125
125
  continue;
126
126
  }
127
127
 
128
- // Objects: deep comparison (O(n²) — only add if no duplicate found in already-kept items)
128
+ // 객체: 깊은 비교 (O(n²) — 이미 유지된 항목에서 중복이 없을 때만 추가)
129
129
  let hasDuplicate = false;
130
130
  for (const keptIdx of result) {
131
131
  if (equal(items[keptIdx], item)) {