@simplysm/core-common 13.0.85 → 13.0.86

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.
@@ -1,201 +0,0 @@
1
- # Extensions
2
-
3
- Prototype extensions for `Array`, `Map`, and `Set`. These are activated as side effects when importing from `@simplysm/core-common`.
4
-
5
- ## Array Extensions (ReadonlyArray)
6
-
7
- ### Query
8
-
9
- ```typescript
10
- interface ReadonlyArray<T> {
11
- single(predicate?: (item: T, index: number) => boolean): T | undefined;
12
- first(predicate?: (item: T, index: number) => boolean): T | undefined;
13
- last(predicate?: (item: T, index: number) => boolean): T | undefined;
14
- filterExists(): NonNullable<T>[];
15
- ofType<K extends PrimitiveTypeStr>(type: K): Extract<T, PrimitiveTypeMap[K]>[];
16
- ofType<N extends T>(type: Type<N>): N[];
17
- }
18
- ```
19
-
20
- - `single` - Returns the only matching element; throws `ArgumentError` if more than one match.
21
- - `first` / `last` - Returns the first/last matching element, or `undefined`.
22
- - `filterExists` - Removes `null` and `undefined` values.
23
- - `ofType` - Filters elements by primitive type string or constructor type.
24
-
25
- ### Async Operations
26
-
27
- ```typescript
28
- interface ReadonlyArray<T> {
29
- filterAsync(predicate: (item: T, index: number) => Promise<boolean>): Promise<T[]>;
30
- mapAsync<R>(selector: (item: T, index: number) => Promise<R>): Promise<R[]>;
31
- mapManyAsync<R>(selector: (item: T, index: number) => Promise<R[]>): Promise<R[]>;
32
- parallelAsync<R>(fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
33
- }
34
- ```
35
-
36
- - `filterAsync` / `mapAsync` / `mapManyAsync` - Sequential async operations (one at a time).
37
- - `parallelAsync` - Parallel async via `Promise.all`.
38
-
39
- ### Transformation
40
-
41
- ```typescript
42
- interface ReadonlyArray<T> {
43
- mapMany<R>(selector?: (item: T, index: number) => R[]): R[];
44
- groupBy<K>(keySelector: (item: T, index: number) => K): { key: K; values: T[] }[];
45
- groupBy<K, V>(keySelector: ..., valueSelector: ...): { key: K; values: V[] }[];
46
- toMap<K>(keySelector: ...): Map<K, T>;
47
- toMap<K, V>(keySelector: ..., valueSelector: ...): Map<K, V>;
48
- toMapAsync<K>(keySelector: ...): Promise<Map<K, T>>;
49
- toArrayMap<K>(keySelector: ...): Map<K, T[]>;
50
- toSetMap<K>(keySelector: ...): Map<K, Set<T>>;
51
- toMapValues<K, V>(keySelector: ..., valueSelector: ...): Map<K, V>;
52
- toObject(keySelector: ...): Record<string, T>;
53
- toObject<V>(keySelector: ..., valueSelector: ...): Record<string, V>;
54
- toTree<K extends keyof T, P extends keyof T>(keyProp: K, parentKey: P): TreeArray<T>[];
55
- }
56
- ```
57
-
58
- - `groupBy` - Groups by key. O(n) for primitive keys, O(n^2) for object keys.
59
- - `toMap` - Converts to `Map` (throws on duplicate keys).
60
- - `toArrayMap` / `toSetMap` - Converts to `Map<K, T[]>` or `Map<K, Set<T>>`.
61
- - `toTree` - Converts flat array to tree structure using key/parent-key properties.
62
-
63
- ### Ordering and Deduplication
64
-
65
- ```typescript
66
- interface ReadonlyArray<T> {
67
- distinct(options?: boolean | { matchAddress?: boolean; keyFn?: (item: T) => string | number }): T[];
68
- orderBy(selector?: (item: T) => ComparableType): T[];
69
- orderByDesc(selector?: (item: T) => ComparableType): T[];
70
- shuffle(): T[];
71
- }
72
- ```
73
-
74
- These return new arrays without modifying the original.
75
-
76
- ### Aggregation
77
-
78
- ```typescript
79
- interface ReadonlyArray<T> {
80
- sum(selector?: (item: T, index: number) => number): number;
81
- min(selector?: ...): number | string | undefined;
82
- max(selector?: ...): number | string | undefined;
83
- }
84
- ```
85
-
86
- ### Diff and Merge
87
-
88
- ```typescript
89
- interface ReadonlyArray<T> {
90
- diffs<P>(target: P[], options?: { keys?: string[]; excludes?: string[] }): ArrayDiffsResult<T, P>[];
91
- oneWayDiffs<K extends keyof T>(orgItems: T[] | Map<T[K], T>, keyPropNameOrGetValFn: K | ((item: T) => ...), options?: ...): ArrayOneWayDiffResult<T>[];
92
- merge<P>(target: P[], options?: { keys?: string[]; excludes?: string[] }): (T | P | (T & P))[];
93
- }
94
- ```
95
-
96
- - `diffs` - Computes INSERT/DELETE/UPDATE differences between two arrays.
97
- - `oneWayDiffs` - One-way diff returning `create` / `update` / `same` results.
98
- - `merge` - Deep merges matching elements from target into source.
99
-
100
- ---
101
-
102
- ## Array Extensions (Mutable)
103
-
104
- These methods modify the original array in-place and return `this` for chaining.
105
-
106
- ```typescript
107
- interface Array<T> {
108
- distinctThis(options?: ...): T[];
109
- orderByThis(selector?: ...): T[];
110
- orderByDescThis(selector?: ...): T[];
111
- insert(index: number, ...items: T[]): this;
112
- remove(itemOrSelector: T | ((item: T, index: number) => boolean)): this;
113
- toggle(item: T): this;
114
- clear(): this;
115
- }
116
- ```
117
-
118
- ---
119
-
120
- ## Map Extensions
121
-
122
- ```typescript
123
- interface Map<K, V> {
124
- getOrCreate(key: K, newValue: V): V;
125
- getOrCreate(key: K, newValueFn: () => V): V;
126
- update(key: K, updateFn: (v: V | undefined) => V): void;
127
- }
128
- ```
129
-
130
- - `getOrCreate` - Returns existing value, or creates and stores a new one. Accepts a direct value or a factory function.
131
- - `update` - Updates value using a function that receives the current value (or `undefined` if key is missing).
132
-
133
- ---
134
-
135
- ## Set Extensions
136
-
137
- ```typescript
138
- interface Set<T> {
139
- adds(...values: T[]): this;
140
- toggle(value: T, addOrDel?: "add" | "del"): this;
141
- }
142
- ```
143
-
144
- - `adds` - Adds multiple values at once.
145
- - `toggle` - Toggles value presence. Optional `addOrDel` parameter forces add or delete.
146
-
147
- ---
148
-
149
- ## Exported Types
150
-
151
- ```typescript
152
- type ArrayDiffsResult<T, P> =
153
- | { source: undefined; target: P } // INSERT
154
- | { source: T; target: undefined } // DELETE
155
- | { source: T; target: P }; // UPDATE
156
-
157
- type ArrayOneWayDiffResult<T> =
158
- | { type: "create"; item: T; orgItem: undefined }
159
- | { type: "update"; item: T; orgItem: T }
160
- | { type: "same"; item: T; orgItem: T };
161
-
162
- type TreeArray<T> = T & { children: TreeArray<T>[] };
163
- type ComparableType = string | number | boolean | DateTime | DateOnly | Time | undefined;
164
- ```
165
-
166
- ---
167
-
168
- ## Usage Examples
169
-
170
- ```typescript
171
- import "@simplysm/core-common";
172
-
173
- // Array extensions
174
- const items = [3, 1, 4, 1, 5, 9];
175
- items.distinct(); // [3, 1, 4, 5, 9]
176
- items.orderBy(); // [1, 1, 3, 4, 5, 9]
177
- items.sum(); // 23
178
- items.first((x) => x > 3); // 4
179
-
180
- const users = [
181
- { id: 1, dept: "A", name: "Alice" },
182
- { id: 2, dept: "B", name: "Bob" },
183
- { id: 3, dept: "A", name: "Charlie" },
184
- ];
185
- users.groupBy((u) => u.dept);
186
- // [{ key: "A", values: [Alice, Charlie] }, { key: "B", values: [Bob] }]
187
-
188
- users.toMap((u) => u.id);
189
- // Map { 1 => Alice, 2 => Bob, 3 => Charlie }
190
-
191
- // Map extensions
192
- const map = new Map<string, number>();
193
- map.getOrCreate("counter", 0); // 0
194
- map.update("counter", (v) => (v ?? 0) + 1); // counter = 1
195
-
196
- // Set extensions
197
- const set = new Set([1, 2, 3]);
198
- set.toggle(2); // removes 2 -> {1, 3}
199
- set.toggle(4); // adds 4 -> {1, 3, 4}
200
- set.adds(5, 6); // {1, 3, 4, 5, 6}
201
- ```
@@ -1,57 +0,0 @@
1
- # JSON Utilities
2
-
3
- Imported as the `json` namespace. JSON serialization/deserialization with full support for custom types.
4
-
5
- ```typescript
6
- import { json } from "@simplysm/core-common";
7
- ```
8
-
9
- ## stringify
10
-
11
- ```typescript
12
- function stringify(obj: unknown, options?: {
13
- space?: string | number;
14
- replacer?: (key: string | undefined, value: unknown) => unknown;
15
- redactBytes?: boolean;
16
- }): string;
17
- ```
18
-
19
- Serializes an object to JSON string with custom type support. Special types are encoded as `{ __type__: "TypeName", data: ... }`.
20
-
21
- **Supported types:** `Date`, `DateTime`, `DateOnly`, `Time`, `Uuid`, `Set`, `Map`, `Error`, `Uint8Array`.
22
-
23
- - `redactBytes` replaces `Uint8Array` contents with `"__hidden__"` (for logging).
24
- - Objects with `toJSON()` are honored (except built-in special types).
25
- - Throws `TypeError` on circular references.
26
-
27
- ---
28
-
29
- ## parse
30
-
31
- ```typescript
32
- function parse<T = unknown>(json: string): T;
33
- ```
34
-
35
- Deserializes a JSON string, restoring all custom types from `__type__` markers. All JSON `null` values are converted to `undefined` (simplysm framework convention).
36
-
37
- ---
38
-
39
- ## Usage Examples
40
-
41
- ```typescript
42
- import { json, DateTime, Uuid } from "@simplysm/core-common";
43
-
44
- const data = {
45
- id: Uuid.generate(),
46
- createdAt: new DateTime(2025, 1, 15),
47
- tags: new Set(["a", "b"]),
48
- meta: new Map([["key", "value"]]),
49
- };
50
-
51
- const str = json.stringify(data, { space: 2 });
52
- const restored = json.parse(str);
53
- // restored.id is Uuid, restored.createdAt is DateTime, etc.
54
-
55
- // Redact binary data for logging
56
- json.stringify({ file: new Uint8Array([1, 2, 3]) }, { redactBytes: true });
57
- ```
@@ -1,76 +0,0 @@
1
- # Number Utilities
2
-
3
- Imported as the `num` namespace.
4
-
5
- ```typescript
6
- import { num } from "@simplysm/core-common";
7
- ```
8
-
9
- ## parseInt
10
-
11
- ```typescript
12
- function parseInt(text: unknown): number | undefined;
13
- ```
14
-
15
- Parses a string to integer after stripping non-numeric characters (except `0-9`, `-`, `.`). Returns `undefined` for non-parsable input. For strings with decimals, returns only the integer part (truncates).
16
-
17
- ---
18
-
19
- ## parseFloat
20
-
21
- ```typescript
22
- function parseFloat(text: unknown): number | undefined;
23
- ```
24
-
25
- Parses a string to float after stripping non-numeric characters. Returns `undefined` for non-parsable input.
26
-
27
- ---
28
-
29
- ## parseRoundedInt
30
-
31
- ```typescript
32
- function parseRoundedInt(text: unknown): number | undefined;
33
- ```
34
-
35
- Parses to float then rounds to the nearest integer.
36
-
37
- ---
38
-
39
- ## isNullOrEmpty
40
-
41
- ```typescript
42
- function isNullOrEmpty(val: number | undefined): val is 0 | undefined;
43
- ```
44
-
45
- Type guard that returns `true` for `undefined`, `null`, or `0`.
46
-
47
- ---
48
-
49
- ## format
50
-
51
- ```typescript
52
- function format(val: number, digit?: { max?: number; min?: number }): string;
53
- function format(val: number | undefined, digit?: { max?: number; min?: number }): string | undefined;
54
- ```
55
-
56
- Formats a number with locale-aware thousand separators. Control decimal places with `max` (maximum) and `min` (minimum, zero-padded).
57
-
58
- ---
59
-
60
- ## Usage Examples
61
-
62
- ```typescript
63
- import { num } from "@simplysm/core-common";
64
-
65
- num.parseInt("$1,234"); // 1234
66
- num.parseInt("12.34"); // 12
67
- num.parseFloat("$1,234.56"); // 1234.56
68
- num.parseRoundedInt("12.6"); // 13
69
-
70
- num.isNullOrEmpty(0); // true
71
- num.isNullOrEmpty(undefined); // true
72
- num.isNullOrEmpty(42); // false
73
-
74
- num.format(1234.567, { max: 2 }); // "1,234.57"
75
- num.format(1234, { min: 2 }); // "1,234.00"
76
- ```
@@ -1,165 +0,0 @@
1
- # Object Utilities
2
-
3
- Imported as the `obj` namespace. Provides deep clone, equality, merge, object manipulation, and chain-path access.
4
-
5
- ```typescript
6
- import { obj } from "@simplysm/core-common";
7
- ```
8
-
9
- ## clone
10
-
11
- ```typescript
12
- function clone<T>(source: T): T;
13
- ```
14
-
15
- Deep clone supporting circular references, custom types (`DateTime`, `DateOnly`, `Time`, `Uuid`, `Uint8Array`, `Error`, `RegExp`, `Map`, `Set`), and prototype chain preservation. Functions and Symbols maintain references.
16
-
17
- ---
18
-
19
- ## equal
20
-
21
- ```typescript
22
- function equal(source: unknown, target: unknown, options?: EqualOptions): boolean;
23
-
24
- interface EqualOptions {
25
- topLevelIncludes?: string[];
26
- topLevelExcludes?: string[];
27
- ignoreArrayIndex?: boolean;
28
- shallow?: boolean;
29
- }
30
- ```
31
-
32
- Deep equality comparison with support for custom types. Options allow filtering compared keys at top level, ignoring array order (O(n^2)), or doing shallow reference comparison.
33
-
34
- ---
35
-
36
- ## merge
37
-
38
- ```typescript
39
- function merge<S, T>(source: S, target: T, opt?: MergeOptions): S & T;
40
-
41
- interface MergeOptions {
42
- arrayProcess?: "replace" | "concat";
43
- useDelTargetNull?: boolean;
44
- }
45
- ```
46
-
47
- Deep merge of target into source. Returns a new object (immutable). Arrays default to replacement; use `"concat"` for deduplication via Set. When `useDelTargetNull` is true, `null` in target deletes the key.
48
-
49
- ---
50
-
51
- ## merge3
52
-
53
- ```typescript
54
- function merge3<S, O, T>(
55
- source: S,
56
- origin: O,
57
- target: T,
58
- optionsObj?: Record<string, Merge3KeyOptions>,
59
- ): { conflict: boolean; result: O & S & T };
60
-
61
- interface Merge3KeyOptions {
62
- keys?: string[];
63
- excludes?: string[];
64
- ignoreArrayIndex?: boolean;
65
- }
66
- ```
67
-
68
- Three-way merge comparing source, origin, and target. Returns whether a conflict occurred and the merged result.
69
-
70
- ---
71
-
72
- ## omit / pick
73
-
74
- ```typescript
75
- function omit<T, K extends keyof T>(item: T, omitKeys: K[]): Omit<T, K>;
76
- function pick<T, K extends keyof T>(item: T, pickKeys: K[]): Pick<T, K>;
77
- ```
78
-
79
- Create new objects by excluding or including specific keys.
80
-
81
- ---
82
-
83
- ## Chain Access
84
-
85
- ```typescript
86
- function getChainValue(obj: unknown, chain: string): unknown;
87
- function getChainValue(obj: unknown, chain: string, optional: true): unknown | undefined;
88
- function setChainValue(obj: unknown, chain: string, value: unknown): void;
89
- function deleteChainValue(obj: unknown, chain: string): void;
90
- ```
91
-
92
- Get, set, or delete values using dot-bracket chain paths (e.g., `"a.b[0].c"`).
93
-
94
- ---
95
-
96
- ## keys / entries / fromEntries
97
-
98
- ```typescript
99
- function keys<T extends object>(obj: T): (keyof T)[];
100
- function entries<T extends object>(obj: T): [keyof T, T[keyof T]][];
101
- function fromEntries<T extends [string, unknown]>(entries: T[]): { [K in T[0]]: T[1] };
102
- ```
103
-
104
- Type-safe wrappers around `Object.keys`, `Object.entries`, and `Object.fromEntries`.
105
-
106
- ---
107
-
108
- ## map
109
-
110
- ```typescript
111
- function map<S extends object, K extends string, V>(
112
- obj: S,
113
- fn: (key: keyof S, value: S[keyof S]) => [K | null, V],
114
- ): Record<K | Extract<keyof S, string>, V>;
115
- ```
116
-
117
- Transforms each entry of an object. Return `[null, newValue]` to keep the original key, or `[newKey, newValue]` to rename.
118
-
119
- ---
120
-
121
- ## Type Utilities
122
-
123
- ```typescript
124
- type UndefToOptional<T>; // { a: string; b: string | undefined } -> { a: string; b?: string | undefined }
125
- type OptionalToUndef<T>; // { a: string; b?: string } -> { a: string; b: string | undefined }
126
- ```
127
-
128
- ---
129
-
130
- ## Usage Examples
131
-
132
- ```typescript
133
- import { obj } from "@simplysm/core-common";
134
-
135
- // Clone
136
- const original = { a: 1, nested: { b: 2 } };
137
- const copy = obj.clone(original);
138
-
139
- // Equal
140
- obj.equal({ a: 1 }, { a: 1 }); // true
141
- obj.equal([1, 2], [2, 1], { ignoreArrayIndex: true }); // true
142
-
143
- // Merge
144
- obj.merge({ a: 1, b: 2 }, { b: 3, c: 4 }); // { a: 1, b: 3, c: 4 }
145
-
146
- // 3-way merge
147
- const { conflict, result } = obj.merge3(
148
- { a: 1, b: 2 }, // source
149
- { a: 1, b: 1 }, // origin
150
- { a: 2, b: 1 }, // target
151
- );
152
- // conflict: false, result: { a: 2, b: 2 }
153
-
154
- // Omit / Pick
155
- obj.omit({ name: "Alice", age: 30, email: "a@b.c" }, ["email"]);
156
- // { name: "Alice", age: 30 }
157
-
158
- // Chain access
159
- const data = { a: { b: [{ c: 42 }] } };
160
- obj.getChainValue(data, "a.b[0].c"); // 42
161
- obj.setChainValue(data, "a.b[0].c", 99);
162
-
163
- // Type-safe Object helpers
164
- obj.keys({ x: 1, y: 2 }); // ["x", "y"] with type (keyof { x; y })[]
165
- ```
@@ -1,54 +0,0 @@
1
- # Path Utilities
2
-
3
- Imported as the `path` namespace. Browser-safe replacements for Node.js `path` module functions.
4
-
5
- ```typescript
6
- import { path } from "@simplysm/core-common";
7
- ```
8
-
9
- **Note:** Supports POSIX-style paths (forward slash `/`) only. Windows backslash paths are not supported.
10
-
11
- ## join
12
-
13
- ```typescript
14
- function join(...segments: string[]): string;
15
- ```
16
-
17
- Combines path segments (replacement for `path.join`).
18
-
19
- ---
20
-
21
- ## basename
22
-
23
- ```typescript
24
- function basename(filePath: string, ext?: string): string;
25
- ```
26
-
27
- Extracts the filename from a path. Optionally removes the specified extension.
28
-
29
- ---
30
-
31
- ## extname
32
-
33
- ```typescript
34
- function extname(filePath: string): string;
35
- ```
36
-
37
- Extracts the file extension. Hidden files (e.g., `.gitignore`) return an empty string, matching Node.js behavior.
38
-
39
- ---
40
-
41
- ## Usage Examples
42
-
43
- ```typescript
44
- import { path } from "@simplysm/core-common";
45
-
46
- path.join("a", "b", "c.txt"); // "a/b/c.txt"
47
- path.join("/root/", "/dir/", "file"); // "/root/dir/file"
48
-
49
- path.basename("/dir/file.txt"); // "file.txt"
50
- path.basename("/dir/file.txt", ".txt"); // "file"
51
-
52
- path.extname("archive.tar.gz"); // ".gz"
53
- path.extname(".gitignore"); // ""
54
- ```
@@ -1,40 +0,0 @@
1
- # Primitive Utilities
2
-
3
- Imported as the `primitive` namespace. Runtime type-string inference.
4
-
5
- ```typescript
6
- import { primitive } from "@simplysm/core-common";
7
- ```
8
-
9
- ## typeStr
10
-
11
- ```typescript
12
- function typeStr(value: PrimitiveTypeMap[PrimitiveTypeStr]): PrimitiveTypeStr;
13
- ```
14
-
15
- Infers the `PrimitiveTypeStr` from a runtime value. Throws `ArgumentError` if the type is not supported.
16
-
17
- **Mapping:**
18
- - `string` -> `"string"`
19
- - `number` -> `"number"`
20
- - `boolean` -> `"boolean"`
21
- - `DateTime` -> `"DateTime"`
22
- - `DateOnly` -> `"DateOnly"`
23
- - `Time` -> `"Time"`
24
- - `Uuid` -> `"Uuid"`
25
- - `Uint8Array` -> `"Bytes"`
26
-
27
- ---
28
-
29
- ## Usage Examples
30
-
31
- ```typescript
32
- import { primitive, DateTime, Uuid } from "@simplysm/core-common";
33
-
34
- primitive.typeStr("hello"); // "string"
35
- primitive.typeStr(123); // "number"
36
- primitive.typeStr(true); // "boolean"
37
- primitive.typeStr(new DateTime()); // "DateTime"
38
- primitive.typeStr(Uuid.generate()); // "Uuid"
39
- primitive.typeStr(new Uint8Array()); // "Bytes"
40
- ```
@@ -1,79 +0,0 @@
1
- # String Utilities
2
-
3
- Imported as the `str` namespace.
4
-
5
- ```typescript
6
- import { str } from "@simplysm/core-common";
7
- ```
8
-
9
- ## getKoreanSuffix
10
-
11
- ```typescript
12
- function getKoreanSuffix(text: string, type: "eul" | "eun" | "i" | "wa" | "rang" | "ro" | "ra"): string;
13
- ```
14
-
15
- Returns the appropriate Korean grammatical particle based on whether the last character has a final consonant (jongseong). Supports seven particle types.
16
-
17
- ---
18
-
19
- ## replaceFullWidth
20
-
21
- ```typescript
22
- function replaceFullWidth(str: string): string;
23
- ```
24
-
25
- Converts full-width characters to half-width: uppercase/lowercase letters, digits, spaces, and parentheses.
26
-
27
- ---
28
-
29
- ## Case Conversion
30
-
31
- ```typescript
32
- function toPascalCase(str: string): string; // "hello-world" -> "HelloWorld"
33
- function toCamelCase(str: string): string; // "hello-world" -> "helloWorld"
34
- function toKebabCase(str: string): string; // "HelloWorld" -> "hello-world"
35
- function toSnakeCase(str: string): string; // "HelloWorld" -> "hello_world"
36
- ```
37
-
38
- Converts between PascalCase, camelCase, kebab-case, and snake_case. Input separators (`-`, `_`, `.`) are recognized.
39
-
40
- ---
41
-
42
- ## isNullOrEmpty
43
-
44
- ```typescript
45
- function isNullOrEmpty(str: string | undefined): str is "" | undefined;
46
- ```
47
-
48
- Type guard that returns `true` for `undefined`, `null`, or empty string.
49
-
50
- ---
51
-
52
- ## insert
53
-
54
- ```typescript
55
- function insert(str: string, index: number, insertString: string): string;
56
- ```
57
-
58
- Inserts a string at the specified position.
59
-
60
- ---
61
-
62
- ## Usage Examples
63
-
64
- ```typescript
65
- import { str } from "@simplysm/core-common";
66
-
67
- str.toPascalCase("hello-world"); // "HelloWorld"
68
- str.toCamelCase("HelloWorld"); // "helloWorld"
69
- str.toKebabCase("HelloWorld"); // "hello-world"
70
- str.toSnakeCase("helloWorld"); // "hello_world"
71
-
72
- str.replaceFullWidth("ABC123"); // "ABC123"
73
-
74
- str.isNullOrEmpty(""); // true
75
- str.isNullOrEmpty(undefined); // true
76
- str.isNullOrEmpty("hello"); // false
77
-
78
- str.insert("Hello World", 5, ","); // "Hello, World"
79
- ```