caseparser 5.0.0 → 6.0.0

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/index.d.cts CHANGED
@@ -1,1555 +1,457 @@
1
- //#region src/types.d.ts
2
- type CamelToDash<T extends string> = T extends `${infer L}${infer R}` ? `${L extends Capitalize<L> ? "-" : ""}${Lowercase<L>}${CamelToDash<R>}` : T;
3
- type CamelToPascal<T extends string> = Capitalize<T>;
4
- type CamelToSnake<T extends string> = T extends `${infer L}${infer R}` ? `${L extends Capitalize<L> ? "_" : ""}${Lowercase<L>}${CamelToSnake<R>}` : T;
5
- type CamelToUpperDash<T extends string> = Uppercase<CamelToDash<T>>;
6
- type CamelToUpperSnake<T extends string> = Uppercase<CamelToSnake<T>>;
7
- type CamelToTrain<T extends string> = DashToTrain<CamelToDash<T>>;
8
- type CamelToDot<T extends string> = DashToDot<CamelToDash<T>>;
9
- type DashToCamel<T extends string> = T extends `${infer L}-${infer R}` ? `${L}${Capitalize<DashToCamel<R>>}` : T;
10
- type DashToPascal<T extends string> = Capitalize<DashToCamel<T>>;
11
- type DashToSnake<T extends string> = T extends `${infer L}-${infer R}` ? `${L}_${DashToSnake<R>}` : T;
12
- type DashToUpperDash<T extends string> = Uppercase<T>;
13
- type DashToUpperSnake<T extends string> = Uppercase<DashToSnake<T>>;
14
- type DashToTrain<T extends string> = T extends `${infer L}-${infer R}` ? `${Capitalize<L>}-${DashToTrain<R>}` : Capitalize<T>;
15
- type DashToDot<T extends string> = T extends `${infer L}-${infer R}` ? `${L}.${DashToDot<R>}` : T;
16
- type PascalToCamel<T extends string> = Uncapitalize<T>;
17
- type PascalToDash<T extends string> = CamelToDash<Uncapitalize<T>>;
18
- type PascalToSnake<T extends string> = CamelToSnake<Uncapitalize<T>>;
19
- type PascalToUpperDash<T extends string> = Uppercase<PascalToDash<T>>;
20
- type PascalToUpperSnake<T extends string> = Uppercase<PascalToSnake<T>>;
21
- type PascalToTrain<T extends string> = DashToTrain<PascalToDash<T>>;
22
- type PascalToDot<T extends string> = DashToDot<PascalToDash<T>>;
23
- type SnakeToCamel<T extends string> = T extends `${infer L}_${infer R}` ? `${L}${Capitalize<SnakeToCamel<R>>}` : T;
24
- type SnakeToDash<T extends string> = T extends `${infer L}_${infer R}` ? `${L}-${SnakeToDash<R>}` : T;
25
- type SnakeToPascal<T extends string> = Capitalize<SnakeToCamel<T>>;
26
- type SnakeToUpperDash<T extends string> = Uppercase<SnakeToDash<T>>;
27
- type SnakeToUpperSnake<T extends string> = Uppercase<T>;
28
- type SnakeToTrain<T extends string> = DashToTrain<SnakeToDash<T>>;
29
- type SnakeToDot<T extends string> = DashToDot<SnakeToDash<T>>;
30
- type UpperDashToCamel<T extends string> = DashToCamel<Lowercase<T>>;
31
- type UpperDashToDash<T extends string> = Lowercase<T>;
32
- type UpperDashToPascal<T extends string> = Capitalize<UpperDashToCamel<T>>;
33
- type UpperDashToSnake<T extends string> = DashToSnake<UpperDashToDash<T>>;
34
- type UpperDashToUpperSnake<T extends string> = Uppercase<UpperDashToSnake<T>>;
35
- type UpperDashToTrain<T extends string> = DashToTrain<UpperDashToDash<T>>;
36
- type UpperDashToDot<T extends string> = DashToDot<UpperDashToDash<T>>;
37
- type UpperSnakeToCamel<T extends string> = SnakeToCamel<Lowercase<T>>;
38
- type UpperSnakeToDash<T extends string> = SnakeToDash<Lowercase<T>>;
39
- type UpperSnakeToPascal<T extends string> = SnakeToPascal<Lowercase<T>>;
40
- type UpperSnakeToSnake<T extends string> = Lowercase<T>;
41
- type UpperSnakeToUpperDash<T extends string> = Uppercase<UpperSnakeToDash<T>>;
42
- type UpperSnakeToTrain<T extends string> = DashToTrain<UpperSnakeToDash<T>>;
43
- type UpperSnakeToDot<T extends string> = DashToDot<UpperSnakeToDash<T>>;
44
- type TrainToCamel<T extends string> = DashToCamel<TrainToDash<T>>;
45
- type TrainToDash<T extends string> = Lowercase<T>;
46
- type TrainToDot<T extends string> = DashToDot<TrainToDash<T>>;
47
- type TrainToPascal<T extends string> = DashToPascal<TrainToDash<T>>;
48
- type TrainToSnake<T extends string> = DashToSnake<TrainToDash<T>>;
49
- type TrainToUpperDash<T extends string> = Uppercase<T>;
50
- type TrainToUpperSnake<T extends string> = DashToUpperSnake<TrainToDash<T>>;
51
- type DotToCamel<T extends string> = DashToCamel<DotToDash<T>>;
52
- type DotToDash<T extends string> = T extends `${infer L}.${infer R}` ? `${L}-${DotToDash<R>}` : T;
53
- type DotToPascal<T extends string> = DashToPascal<DotToDash<T>>;
54
- type DotToSnake<T extends string> = DashToSnake<DotToDash<T>>;
55
- type DotToTrain<T extends string> = DashToTrain<DotToDash<T>>;
56
- type DotToUpperDash<T extends string> = Uppercase<DotToDash<T>>;
57
- type DotToUpperSnake<T extends string> = DashToUpperSnake<DotToDash<T>>;
58
- type DashToWords<T extends string> = T extends `${infer L}-${infer R}` ? `${L} ${DashToWords<R>}` : T;
59
- type WordsToDash<T extends string> = T extends `${infer L} ${infer R}` ? `${L}-${WordsToDash<R>}` : T;
60
- type DashToTitle<T extends string> = T extends `${infer L}-${infer R}` ? `${Capitalize<L>} ${DashToTitle<R>}` : Capitalize<T>;
61
- type DashToSentence<T extends string> = Capitalize<DashToWords<T>>;
62
- type CamelToTitle<T extends string> = DashToTitle<CamelToDash<T>>;
63
- type CamelToSentence<T extends string> = DashToSentence<CamelToDash<T>>;
64
- type PascalToTitle<T extends string> = DashToTitle<PascalToDash<T>>;
65
- type PascalToSentence<T extends string> = DashToSentence<PascalToDash<T>>;
66
- type SnakeToTitle<T extends string> = DashToTitle<SnakeToDash<T>>;
67
- type SnakeToSentence<T extends string> = DashToSentence<SnakeToDash<T>>;
68
- type UpperSnakeToTitle<T extends string> = DashToTitle<UpperSnakeToDash<T>>;
69
- type UpperSnakeToSentence<T extends string> = DashToSentence<UpperSnakeToDash<T>>;
70
- type UpperDashToTitle<T extends string> = DashToTitle<UpperDashToDash<T>>;
71
- type UpperDashToSentence<T extends string> = DashToSentence<UpperDashToDash<T>>;
72
- type TrainToTitle<T extends string> = DashToTitle<TrainToDash<T>>;
73
- type TrainToSentence<T extends string> = DashToSentence<TrainToDash<T>>;
74
- type DotToTitle<T extends string> = DashToTitle<DotToDash<T>>;
75
- type DotToSentence<T extends string> = DashToSentence<DotToDash<T>>;
76
- type TitleToDash<T extends string> = WordsToDash<Lowercase<T>>;
77
- type TitleToCamel<T extends string> = DashToCamel<TitleToDash<T>>;
78
- type TitleToPascal<T extends string> = DashToPascal<TitleToDash<T>>;
79
- type TitleToSnake<T extends string> = DashToSnake<TitleToDash<T>>;
80
- type TitleToUpperSnake<T extends string> = DashToUpperSnake<TitleToDash<T>>;
81
- type TitleToUpperDash<T extends string> = DashToUpperDash<TitleToDash<T>>;
82
- type TitleToTrain<T extends string> = DashToTrain<TitleToDash<T>>;
83
- type TitleToDot<T extends string> = DashToDot<TitleToDash<T>>;
84
- type TitleToSentence<T extends string> = DashToSentence<TitleToDash<T>>;
85
- type SentenceToDash<T extends string> = WordsToDash<Lowercase<T>>;
86
- type SentenceToCamel<T extends string> = DashToCamel<SentenceToDash<T>>;
87
- type SentenceToPascal<T extends string> = DashToPascal<SentenceToDash<T>>;
88
- type SentenceToSnake<T extends string> = DashToSnake<SentenceToDash<T>>;
89
- type SentenceToUpperSnake<T extends string> = DashToUpperSnake<SentenceToDash<T>>;
90
- type SentenceToUpperDash<T extends string> = DashToUpperDash<SentenceToDash<T>>;
91
- type SentenceToTrain<T extends string> = DashToTrain<SentenceToDash<T>>;
92
- type SentenceToDot<T extends string> = DashToDot<SentenceToDash<T>>;
93
- type SentenceToTitle<T extends string> = DashToTitle<SentenceToDash<T>>;
94
- type ParserCamelType = "CamelToDash" | "CamelToPascal" | "CamelToSnake" | "CamelToUpperDash" | "CamelToUpperSnake" | "CamelToTrain" | "CamelToDot" | "CamelToTitle" | "CamelToSentence";
95
- type ParserDashType = "DashToCamel" | "DashToPascal" | "DashToSnake" | "DashToUpperDash" | "DashToUpperSnake" | "DashToTrain" | "DashToDot" | "DashToTitle" | "DashToSentence";
96
- type ParserPascalType = "PascalToCamel" | "PascalToDash" | "PascalToSnake" | "PascalToUpperDash" | "PascalToUpperSnake" | "PascalToTrain" | "PascalToDot" | "PascalToTitle" | "PascalToSentence";
97
- type ParserSnakeType = "SnakeToCamel" | "SnakeToDash" | "SnakeToPascal" | "SnakeToUpperDash" | "SnakeToUpperSnake" | "SnakeToTrain" | "SnakeToDot" | "SnakeToTitle" | "SnakeToSentence";
98
- type ParserUpperDashType = "UpperDashToCamel" | "UpperDashToDash" | "UpperDashToPascal" | "UpperDashToSnake" | "UpperDashToUpperSnake" | "UpperDashToTrain" | "UpperDashToDot" | "UpperDashToTitle" | "UpperDashToSentence";
99
- type ParserUpperSnakeType = "UpperSnakeToCamel" | "UpperSnakeToDash" | "UpperSnakeToPascal" | "UpperSnakeToSnake" | "UpperSnakeToUpperDash" | "UpperSnakeToTrain" | "UpperSnakeToDot" | "UpperSnakeToTitle" | "UpperSnakeToSentence";
100
- type ParserTrainType = "TrainToCamel" | "TrainToDash" | "TrainToDot" | "TrainToPascal" | "TrainToSnake" | "TrainToUpperDash" | "TrainToUpperSnake" | "TrainToTitle" | "TrainToSentence";
101
- type ParserDotType = "DotToCamel" | "DotToDash" | "DotToPascal" | "DotToSnake" | "DotToTrain" | "DotToUpperDash" | "DotToUpperSnake" | "DotToTitle" | "DotToSentence";
102
- type ParserTitleType = "TitleToCamel" | "TitleToPascal" | "TitleToSnake" | "TitleToDash" | "TitleToUpperSnake" | "TitleToUpperDash" | "TitleToTrain" | "TitleToDot" | "TitleToSentence";
103
- type ParserSentenceType = "SentenceToCamel" | "SentenceToPascal" | "SentenceToSnake" | "SentenceToDash" | "SentenceToUpperSnake" | "SentenceToUpperDash" | "SentenceToTrain" | "SentenceToDot" | "SentenceToTitle";
104
- /** Identifies a conversion, e.g. `'CamelToSnake'`. */
105
- type ParserType = ParserCamelType | ParserDashType | ParserPascalType | ParserSnakeType | ParserUpperDashType | ParserUpperSnakeType | ParserTrainType | ParserDotType | ParserTitleType | ParserSentenceType;
106
- /** Flattens an intersection/mapped type so editors show the resulting keys. */
107
- type Prettify<T> = { [K in keyof T]: T[K]; } & {};
108
- /**
109
- * The type returned by a conversion: strings stay `string`, and object keys
110
- * (deeply, including inside arrays) are renamed according to the conversion `P`.
111
- */
112
- type Result<T, P> = T extends string ? string : T extends Array<unknown> ? { [K in keyof T]: Result<T[K], P>; } : T extends object ? Prettify<{ [K in keyof T as P extends "CamelToDash" ? CamelToDash<K & string> : P extends "CamelToPascal" ? CamelToPascal<K & string> : P extends "CamelToSnake" ? CamelToSnake<K & string> : P extends "CamelToUpperDash" ? CamelToUpperDash<K & string> : P extends "CamelToUpperSnake" ? CamelToUpperSnake<K & string> : P extends "DashToCamel" ? DashToCamel<K & string> : P extends "DashToPascal" ? DashToPascal<K & string> : P extends "DashToSnake" ? DashToSnake<K & string> : P extends "DashToUpperDash" ? DashToUpperDash<K & string> : P extends "DashToUpperSnake" ? DashToUpperSnake<K & string> : P extends "PascalToCamel" ? PascalToCamel<K & string> : P extends "PascalToDash" ? PascalToDash<K & string> : P extends "PascalToSnake" ? PascalToSnake<K & string> : P extends "PascalToUpperDash" ? PascalToUpperDash<K & string> : P extends "PascalToUpperSnake" ? PascalToUpperSnake<K & string> : P extends "SnakeToCamel" ? SnakeToCamel<K & string> : P extends "SnakeToDash" ? SnakeToDash<K & string> : P extends "SnakeToPascal" ? SnakeToPascal<K & string> : P extends "SnakeToUpperDash" ? SnakeToUpperDash<K & string> : P extends "SnakeToUpperSnake" ? SnakeToUpperSnake<K & string> : P extends "UpperDashToCamel" ? UpperDashToCamel<K & string> : P extends "UpperDashToDash" ? UpperDashToDash<K & string> : P extends "UpperDashToPascal" ? UpperDashToPascal<K & string> : P extends "UpperDashToSnake" ? UpperDashToSnake<K & string> : P extends "UpperDashToUpperSnake" ? UpperDashToUpperSnake<K & string> : P extends "UpperSnakeToCamel" ? UpperSnakeToCamel<K & string> : P extends "UpperSnakeToDash" ? UpperSnakeToDash<K & string> : P extends "UpperSnakeToPascal" ? UpperSnakeToPascal<K & string> : P extends "UpperSnakeToSnake" ? UpperSnakeToSnake<K & string> : P extends "UpperSnakeToUpperDash" ? UpperSnakeToUpperDash<K & string> : P extends "CamelToTrain" ? CamelToTrain<K & string> : P extends "CamelToDot" ? CamelToDot<K & string> : P extends "PascalToTrain" ? PascalToTrain<K & string> : P extends "PascalToDot" ? PascalToDot<K & string> : P extends "SnakeToTrain" ? SnakeToTrain<K & string> : P extends "SnakeToDot" ? SnakeToDot<K & string> : P extends "DashToTrain" ? DashToTrain<K & string> : P extends "DashToDot" ? DashToDot<K & string> : P extends "UpperSnakeToTrain" ? UpperSnakeToTrain<K & string> : P extends "UpperSnakeToDot" ? UpperSnakeToDot<K & string> : P extends "UpperDashToTrain" ? UpperDashToTrain<K & string> : P extends "UpperDashToDot" ? UpperDashToDot<K & string> : P extends "TrainToCamel" ? TrainToCamel<K & string> : P extends "TrainToPascal" ? TrainToPascal<K & string> : P extends "TrainToSnake" ? TrainToSnake<K & string> : P extends "TrainToDash" ? TrainToDash<K & string> : P extends "TrainToUpperSnake" ? TrainToUpperSnake<K & string> : P extends "TrainToUpperDash" ? TrainToUpperDash<K & string> : P extends "TrainToDot" ? TrainToDot<K & string> : P extends "DotToCamel" ? DotToCamel<K & string> : P extends "DotToPascal" ? DotToPascal<K & string> : P extends "DotToSnake" ? DotToSnake<K & string> : P extends "DotToDash" ? DotToDash<K & string> : P extends "DotToUpperSnake" ? DotToUpperSnake<K & string> : P extends "DotToUpperDash" ? DotToUpperDash<K & string> : P extends "DotToTrain" ? DotToTrain<K & string> : P extends "CamelToTitle" ? CamelToTitle<K & string> : P extends "CamelToSentence" ? CamelToSentence<K & string> : P extends "PascalToTitle" ? PascalToTitle<K & string> : P extends "PascalToSentence" ? PascalToSentence<K & string> : P extends "SnakeToTitle" ? SnakeToTitle<K & string> : P extends "SnakeToSentence" ? SnakeToSentence<K & string> : P extends "DashToTitle" ? DashToTitle<K & string> : P extends "DashToSentence" ? DashToSentence<K & string> : P extends "UpperSnakeToTitle" ? UpperSnakeToTitle<K & string> : P extends "UpperSnakeToSentence" ? UpperSnakeToSentence<K & string> : P extends "UpperDashToTitle" ? UpperDashToTitle<K & string> : P extends "UpperDashToSentence" ? UpperDashToSentence<K & string> : P extends "TrainToTitle" ? TrainToTitle<K & string> : P extends "TrainToSentence" ? TrainToSentence<K & string> : P extends "DotToTitle" ? DotToTitle<K & string> : P extends "DotToSentence" ? DotToSentence<K & string> : P extends "TitleToCamel" ? TitleToCamel<K & string> : P extends "TitleToPascal" ? TitleToPascal<K & string> : P extends "TitleToSnake" ? TitleToSnake<K & string> : P extends "TitleToDash" ? TitleToDash<K & string> : P extends "TitleToUpperSnake" ? TitleToUpperSnake<K & string> : P extends "TitleToUpperDash" ? TitleToUpperDash<K & string> : P extends "TitleToTrain" ? TitleToTrain<K & string> : P extends "TitleToDot" ? TitleToDot<K & string> : P extends "TitleToSentence" ? TitleToSentence<K & string> : P extends "SentenceToCamel" ? SentenceToCamel<K & string> : P extends "SentenceToPascal" ? SentenceToPascal<K & string> : P extends "SentenceToSnake" ? SentenceToSnake<K & string> : P extends "SentenceToDash" ? SentenceToDash<K & string> : P extends "SentenceToUpperSnake" ? SentenceToUpperSnake<K & string> : P extends "SentenceToUpperDash" ? SentenceToUpperDash<K & string> : P extends "SentenceToTrain" ? SentenceToTrain<K & string> : P extends "SentenceToDot" ? SentenceToDot<K & string> : P extends "SentenceToTitle" ? SentenceToTitle<K & string> : never]: Result<T[K], P>; }> : T;
113
- //#endregion
114
- //#region src/camelCase/camelCase.d.ts
115
- /**
116
- * Converts a string, or the keys of an object/array (deeply), from camelCase to dash-case.
117
- *
118
- * @example
119
- * ```ts
120
- * camelToDash('helloWorld'); // 'hello-world'
121
- * camelToDash({ firstName: 'John' }); // { 'first-name': 'John' }
122
- * ```
123
- *
124
- * @deprecated Use `toKebab` instead, which converts from any case. It keeps acronyms together,
125
- * so results differ for keys like `userID` (see the migration notes in the README).
126
- */
127
- export declare function camelToDash<T extends object | string>(input: T): Result<T, "CamelToDash">;
128
- /**
129
- * Converts a string, or the keys of an object/array (deeply), from camelCase to snake_case.
130
- *
131
- * @example
132
- * ```ts
133
- * camelToSnake('helloWorld'); // 'hello_world'
134
- * camelToSnake({ firstName: 'John' }); // { first_name: 'John' }
135
- * ```
136
- *
137
- * @deprecated Use `toSnake` instead, which converts from any case. It keeps acronyms together,
138
- * so results differ for keys like `userID` (see the migration notes in the README).
139
- */
140
- export declare function camelToSnake<T extends object | string>(input: T): Result<T, "CamelToSnake">;
141
- /**
142
- * Converts a string, or the keys of an object/array (deeply), from camelCase to PascalCase.
143
- *
144
- * @example
145
- * ```ts
146
- * camelToPascal('helloWorld'); // 'HelloWorld'
147
- * camelToPascal({ firstName: 'John' }); // { FirstName: 'John' }
148
- * ```
149
- *
150
- * @deprecated Use `toPascal` instead, which converts from any case. It keeps acronyms together,
151
- * so results differ for keys like `userID` (see the migration notes in the README).
152
- */
153
- export declare function camelToPascal<T extends object | string>(input: T): Result<T, "CamelToPascal">;
154
- /**
155
- * Converts a string, or the keys of an object/array (deeply), from camelCase to UPPER_SNAKE_CASE.
156
- *
157
- * @example
158
- * ```ts
159
- * camelToUpperSnake('helloWorld'); // 'HELLO_WORLD'
160
- * camelToUpperSnake({ firstName: 'John' }); // { FIRST_NAME: 'John' }
161
- * ```
162
- *
163
- * @deprecated Use `toUpperSnake` instead, which converts from any case. It keeps acronyms together,
164
- * so results differ for keys like `userID` (see the migration notes in the README).
165
- */
166
- export declare function camelToUpperSnake<T extends object | string>(input: T): Result<T, "CamelToUpperSnake">;
167
- /**
168
- * Converts a string, or the keys of an object/array (deeply), from camelCase to UPPER-DASH-CASE.
169
- *
170
- * @example
171
- * ```ts
172
- * camelToUpperDash('helloWorld'); // 'HELLO-WORLD'
173
- * camelToUpperDash({ firstName: 'John' }); // { 'FIRST-NAME': 'John' }
174
- * ```
175
- *
176
- * @deprecated Use `toUpperKebab` instead, which converts from any case. It keeps acronyms together,
177
- * so results differ for keys like `userID` (see the migration notes in the README).
178
- */
179
- export declare function camelToUpperDash<T extends object | string>(input: T): Result<T, "CamelToUpperDash">;
180
- /**
181
- * Converts a string, or the keys of an object/array (deeply), from camelCase to Train-Case.
182
- *
183
- * @example
184
- * ```ts
185
- * camelToTrain('helloWorld'); // 'Hello-World'
186
- * camelToTrain({ firstName: 'John' }); // { 'First-Name': 'John' }
187
- * ```
188
- *
189
- * @deprecated Use `toTrain` instead, which converts from any case. It keeps acronyms together,
190
- * so results differ for keys like `userID` (see the migration notes in the README).
191
- */
192
- export declare function camelToTrain<T extends object | string>(input: T): Result<T, "CamelToTrain">;
193
- /**
194
- * Converts a string, or the keys of an object/array (deeply), from camelCase to dot.case.
195
- *
196
- * @example
197
- * ```ts
198
- * camelToDot('helloWorld'); // 'hello.world'
199
- * camelToDot({ firstName: 'John' }); // { 'first.name': 'John' }
200
- * ```
201
- *
202
- * @deprecated Use `toDot` instead, which converts from any case. It keeps acronyms together,
203
- * so results differ for keys like `userID` (see the migration notes in the README).
204
- */
205
- export declare function camelToDot<T extends object | string>(input: T): Result<T, "CamelToDot">;
206
- /**
207
- * Converts a string, or the keys of an object/array (deeply), from camelCase to Title Case.
208
- *
209
- * @example
210
- * ```ts
211
- * camelToTitle('helloWorld'); // 'Hello World'
212
- * camelToTitle({ firstName: 'John' }); // { 'First Name': 'John' }
213
- * ```
214
- *
215
- * @deprecated Use `toTitle` instead, which converts from any case. It keeps acronyms together,
216
- * so results differ for keys like `userID` (see the migration notes in the README).
217
- */
218
- export declare function camelToTitle<T extends object | string>(input: T): Result<T, "CamelToTitle">;
219
- /**
220
- * Converts a string, or the keys of an object/array (deeply), from camelCase to Sentence case.
221
- *
222
- * @example
223
- * ```ts
224
- * camelToSentence('helloWorld'); // 'Hello world'
225
- * camelToSentence({ firstName: 'John' }); // { 'First name': 'John' }
226
- * ```
227
- *
228
- * @deprecated Use `toSentence` instead, which converts from any case. It keeps acronyms together,
229
- * so results differ for keys like `userID` (see the migration notes in the README).
230
- */
231
- export declare function camelToSentence<T extends object | string>(input: T): Result<T, "CamelToSentence">;
232
- //#endregion
233
- //#region src/dashCase/dashCase.d.ts
234
- /**
235
- * Converts a string, or the keys of an object/array (deeply), from dash-case to snake_case.
236
- *
237
- * @example
238
- * ```ts
239
- * dashToSnake('hello-world'); // 'hello_world'
240
- * dashToSnake({ 'first-name': 'John' }); // { first_name: 'John' }
241
- * ```
242
- *
243
- * @deprecated Use `toSnake` instead, which converts from any case. It keeps acronyms together,
244
- * so results differ for keys like `userID` (see the migration notes in the README).
245
- */
246
- export declare function dashToSnake<T extends object | string>(input: T): Result<T, "DashToSnake">;
247
- /**
248
- * Converts a string, or the keys of an object/array (deeply), from dash-case to camelCase.
249
- *
250
- * @example
251
- * ```ts
252
- * dashToCamel('hello-world'); // 'helloWorld'
253
- * dashToCamel({ 'first-name': 'John' }); // { firstName: 'John' }
254
- * ```
255
- *
256
- * @deprecated Use `toCamel` instead, which converts from any case. It keeps acronyms together,
257
- * so results differ for keys like `userID` (see the migration notes in the README).
258
- */
259
- export declare function dashToCamel<T extends object | string>(input: T): Result<T, "DashToCamel">;
260
- /**
261
- * Converts a string, or the keys of an object/array (deeply), from dash-case to PascalCase.
262
- *
263
- * @example
264
- * ```ts
265
- * dashToPascal('hello-world'); // 'HelloWorld'
266
- * dashToPascal({ 'first-name': 'John' }); // { FirstName: 'John' }
267
- * ```
268
- *
269
- * @deprecated Use `toPascal` instead, which converts from any case. It keeps acronyms together,
270
- * so results differ for keys like `userID` (see the migration notes in the README).
271
- */
272
- export declare function dashToPascal<T extends object | string>(input: T): Result<T, "DashToPascal">;
273
- /**
274
- * Converts a string, or the keys of an object/array (deeply), from dash-case to UPPER_SNAKE_CASE.
275
- *
276
- * @example
277
- * ```ts
278
- * dashToUpperSnake('hello-world'); // 'HELLO_WORLD'
279
- * dashToUpperSnake({ 'first-name': 'John' }); // { FIRST_NAME: 'John' }
280
- * ```
281
- *
282
- * @deprecated Use `toUpperSnake` instead, which converts from any case. It keeps acronyms together,
283
- * so results differ for keys like `userID` (see the migration notes in the README).
284
- */
285
- export declare function dashToUpperSnake<T extends object | string>(input: T): Result<T, "DashToUpperSnake">;
286
- /**
287
- * Converts a string, or the keys of an object/array (deeply), from dash-case to UPPER-DASH-CASE.
288
- *
289
- * @example
290
- * ```ts
291
- * dashToUpperDash('hello-world'); // 'HELLO-WORLD'
292
- * dashToUpperDash({ 'first-name': 'John' }); // { 'FIRST-NAME': 'John' }
293
- * ```
294
- *
295
- * @deprecated Use `toUpperKebab` instead, which converts from any case. It keeps acronyms together,
296
- * so results differ for keys like `userID` (see the migration notes in the README).
297
- */
298
- export declare function dashToUpperDash<T extends object | string>(input: T): Result<T, "DashToUpperDash">;
299
- /**
300
- * Converts a string, or the keys of an object/array (deeply), from dash-case to Train-Case.
301
- *
302
- * @example
303
- * ```ts
304
- * dashToTrain('hello-world'); // 'Hello-World'
305
- * dashToTrain({ 'first-name': 'John' }); // { 'First-Name': 'John' }
306
- * ```
307
- *
308
- * @deprecated Use `toTrain` instead, which converts from any case. It keeps acronyms together,
309
- * so results differ for keys like `userID` (see the migration notes in the README).
310
- */
311
- export declare function dashToTrain<T extends object | string>(input: T): Result<T, "DashToTrain">;
312
- /**
313
- * Converts a string, or the keys of an object/array (deeply), from dash-case to dot.case.
314
- *
315
- * @example
316
- * ```ts
317
- * dashToDot('hello-world'); // 'hello.world'
318
- * dashToDot({ 'first-name': 'John' }); // { 'first.name': 'John' }
319
- * ```
320
- *
321
- * @deprecated Use `toDot` instead, which converts from any case. It keeps acronyms together,
322
- * so results differ for keys like `userID` (see the migration notes in the README).
323
- */
324
- export declare function dashToDot<T extends object | string>(input: T): Result<T, "DashToDot">;
325
- /**
326
- * Converts a string, or the keys of an object/array (deeply), from dash-case to Title Case.
327
- *
328
- * @example
329
- * ```ts
330
- * dashToTitle('hello-world'); // 'Hello World'
331
- * dashToTitle({ 'first-name': 'John' }); // { 'First Name': 'John' }
332
- * ```
333
- *
334
- * @deprecated Use `toTitle` instead, which converts from any case. It keeps acronyms together,
335
- * so results differ for keys like `userID` (see the migration notes in the README).
336
- */
337
- export declare function dashToTitle<T extends object | string>(input: T): Result<T, "DashToTitle">;
338
- /**
339
- * Converts a string, or the keys of an object/array (deeply), from dash-case to Sentence case.
340
- *
341
- * @example
342
- * ```ts
343
- * dashToSentence('hello-world'); // 'Hello world'
344
- * dashToSentence({ 'first-name': 'John' }); // { 'First name': 'John' }
345
- * ```
346
- *
347
- * @deprecated Use `toSentence` instead, which converts from any case. It keeps acronyms together,
348
- * so results differ for keys like `userID` (see the migration notes in the README).
349
- */
350
- export declare function dashToSentence<T extends object | string>(input: T): Result<T, "DashToSentence">;
351
- //#endregion
352
- //#region src/pascalCase/pascalCase.d.ts
353
- /**
354
- * Converts a string, or the keys of an object/array (deeply), from PascalCase to camelCase.
355
- *
356
- * @example
357
- * ```ts
358
- * pascalToCamel('HelloWorld'); // 'helloWorld'
359
- * pascalToCamel({ FirstName: 'John' }); // { firstName: 'John' }
360
- * ```
361
- *
362
- * @deprecated Use `toCamel` instead, which converts from any case. It keeps acronyms together,
363
- * so results differ for keys like `userID` (see the migration notes in the README).
364
- */
365
- export declare function pascalToCamel<T extends object | string>(input: T): Result<T, "PascalToCamel">;
366
- /**
367
- * Converts a string, or the keys of an object/array (deeply), from PascalCase to snake_case.
368
- *
369
- * @example
370
- * ```ts
371
- * pascalToSnake('HelloWorld'); // 'hello_world'
372
- * pascalToSnake({ FirstName: 'John' }); // { first_name: 'John' }
373
- * ```
374
- *
375
- * @deprecated Use `toSnake` instead, which converts from any case. It keeps acronyms together,
376
- * so results differ for keys like `userID` (see the migration notes in the README).
377
- */
378
- export declare function pascalToSnake<T extends object | string>(input: T): Result<T, "PascalToSnake">;
379
- /**
380
- * Converts a string, or the keys of an object/array (deeply), from PascalCase to dash-case.
381
- *
382
- * @example
383
- * ```ts
384
- * pascalToDash('HelloWorld'); // 'hello-world'
385
- * pascalToDash({ FirstName: 'John' }); // { 'first-name': 'John' }
386
- * ```
387
- *
388
- * @deprecated Use `toKebab` instead, which converts from any case. It keeps acronyms together,
389
- * so results differ for keys like `userID` (see the migration notes in the README).
390
- */
391
- export declare function pascalToDash<T extends object | string>(input: T): Result<T, "PascalToDash">;
392
- /**
393
- * Converts a string, or the keys of an object/array (deeply), from PascalCase to UPPER_SNAKE_CASE.
394
- *
395
- * @example
396
- * ```ts
397
- * pascalToUpperSnake('HelloWorld'); // 'HELLO_WORLD'
398
- * pascalToUpperSnake({ FirstName: 'John' }); // { FIRST_NAME: 'John' }
399
- * ```
400
- *
401
- * @deprecated Use `toUpperSnake` instead, which converts from any case. It keeps acronyms together,
402
- * so results differ for keys like `userID` (see the migration notes in the README).
403
- */
404
- export declare function pascalToUpperSnake<T extends object | string>(input: T): Result<T, "PascalToUpperSnake">;
405
- /**
406
- * Converts a string, or the keys of an object/array (deeply), from PascalCase to UPPER-DASH-CASE.
407
- *
408
- * @example
409
- * ```ts
410
- * pascalToUpperDash('HelloWorld'); // 'HELLO-WORLD'
411
- * pascalToUpperDash({ FirstName: 'John' }); // { 'FIRST-NAME': 'John' }
412
- * ```
413
- *
414
- * @deprecated Use `toUpperKebab` instead, which converts from any case. It keeps acronyms together,
415
- * so results differ for keys like `userID` (see the migration notes in the README).
416
- */
417
- export declare function pascalToUpperDash<T extends object | string>(input: T): Result<T, "PascalToUpperDash">;
418
- /**
419
- * Converts a string, or the keys of an object/array (deeply), from PascalCase to Train-Case.
420
- *
421
- * @example
422
- * ```ts
423
- * pascalToTrain('HelloWorld'); // 'Hello-World'
424
- * pascalToTrain({ FirstName: 'John' }); // { 'First-Name': 'John' }
425
- * ```
426
- *
427
- * @deprecated Use `toTrain` instead, which converts from any case. It keeps acronyms together,
428
- * so results differ for keys like `userID` (see the migration notes in the README).
429
- */
430
- export declare function pascalToTrain<T extends object | string>(input: T): Result<T, "PascalToTrain">;
431
- /**
432
- * Converts a string, or the keys of an object/array (deeply), from PascalCase to dot.case.
433
- *
434
- * @example
435
- * ```ts
436
- * pascalToDot('HelloWorld'); // 'hello.world'
437
- * pascalToDot({ FirstName: 'John' }); // { 'first.name': 'John' }
438
- * ```
439
- *
440
- * @deprecated Use `toDot` instead, which converts from any case. It keeps acronyms together,
441
- * so results differ for keys like `userID` (see the migration notes in the README).
442
- */
443
- export declare function pascalToDot<T extends object | string>(input: T): Result<T, "PascalToDot">;
444
- /**
445
- * Converts a string, or the keys of an object/array (deeply), from PascalCase to Title Case.
446
- *
447
- * @example
448
- * ```ts
449
- * pascalToTitle('HelloWorld'); // 'Hello World'
450
- * pascalToTitle({ FirstName: 'John' }); // { 'First Name': 'John' }
451
- * ```
452
- *
453
- * @deprecated Use `toTitle` instead, which converts from any case. It keeps acronyms together,
454
- * so results differ for keys like `userID` (see the migration notes in the README).
455
- */
456
- export declare function pascalToTitle<T extends object | string>(input: T): Result<T, "PascalToTitle">;
457
- /**
458
- * Converts a string, or the keys of an object/array (deeply), from PascalCase to Sentence case.
459
- *
460
- * @example
461
- * ```ts
462
- * pascalToSentence('HelloWorld'); // 'Hello world'
463
- * pascalToSentence({ FirstName: 'John' }); // { 'First name': 'John' }
464
- * ```
465
- *
466
- * @deprecated Use `toSentence` instead, which converts from any case. It keeps acronyms together,
467
- * so results differ for keys like `userID` (see the migration notes in the README).
468
- */
469
- export declare function pascalToSentence<T extends object | string>(input: T): Result<T, "PascalToSentence">;
470
- //#endregion
471
- //#region src/snakeCase/snakeCase.d.ts
472
- /**
473
- * Converts a string, or the keys of an object/array (deeply), from snake_case to camelCase.
474
- *
475
- * @example
476
- * ```ts
477
- * snakeToCamel('hello_world'); // 'helloWorld'
478
- * snakeToCamel({ first_name: 'John' }); // { firstName: 'John' }
479
- * ```
480
- *
481
- * @deprecated Use `toCamel` instead, which converts from any case. It keeps acronyms together,
482
- * so results differ for keys like `userID` (see the migration notes in the README).
483
- */
484
- export declare function snakeToCamel<T extends object | string>(input: T): Result<T, "SnakeToCamel">;
485
- /**
486
- * Converts a string, or the keys of an object/array (deeply), from snake_case to dash-case.
487
- *
488
- * @example
489
- * ```ts
490
- * snakeToDash('hello_world'); // 'hello-world'
491
- * snakeToDash({ first_name: 'John' }); // { 'first-name': 'John' }
492
- * ```
493
- *
494
- * @deprecated Use `toKebab` instead, which converts from any case. It keeps acronyms together,
495
- * so results differ for keys like `userID` (see the migration notes in the README).
496
- */
497
- export declare function snakeToDash<T extends object | string>(input: T): Result<T, "SnakeToDash">;
498
- /**
499
- * Converts a string, or the keys of an object/array (deeply), from snake_case to PascalCase.
500
- *
501
- * @example
502
- * ```ts
503
- * snakeToPascal('hello_world'); // 'HelloWorld'
504
- * snakeToPascal({ first_name: 'John' }); // { FirstName: 'John' }
505
- * ```
506
- *
507
- * @deprecated Use `toPascal` instead, which converts from any case. It keeps acronyms together,
508
- * so results differ for keys like `userID` (see the migration notes in the README).
509
- */
510
- export declare function snakeToPascal<T extends object | string>(input: T): Result<T, "SnakeToPascal">;
511
- /**
512
- * Converts a string, or the keys of an object/array (deeply), from snake_case to UPPER_SNAKE_CASE.
513
- *
514
- * @example
515
- * ```ts
516
- * snakeToUpperSnake('hello_world'); // 'HELLO_WORLD'
517
- * snakeToUpperSnake({ first_name: 'John' }); // { FIRST_NAME: 'John' }
518
- * ```
519
- *
520
- * @deprecated Use `toUpperSnake` instead, which converts from any case. It keeps acronyms together,
521
- * so results differ for keys like `userID` (see the migration notes in the README).
522
- */
523
- export declare function snakeToUpperSnake<T extends object | string>(input: T): Result<T, "SnakeToUpperSnake">;
524
- /**
525
- * Converts a string, or the keys of an object/array (deeply), from snake_case to UPPER-DASH-CASE.
526
- *
527
- * @example
528
- * ```ts
529
- * snakeToUpperDash('hello_world'); // 'HELLO-WORLD'
530
- * snakeToUpperDash({ first_name: 'John' }); // { 'FIRST-NAME': 'John' }
531
- * ```
532
- *
533
- * @deprecated Use `toUpperKebab` instead, which converts from any case. It keeps acronyms together,
534
- * so results differ for keys like `userID` (see the migration notes in the README).
535
- */
536
- export declare function snakeToUpperDash<T extends object | string>(input: T): Result<T, "SnakeToUpperDash">;
537
- /**
538
- * Converts a string, or the keys of an object/array (deeply), from snake_case to Train-Case.
539
- *
540
- * @example
541
- * ```ts
542
- * snakeToTrain('hello_world'); // 'Hello-World'
543
- * snakeToTrain({ first_name: 'John' }); // { 'First-Name': 'John' }
544
- * ```
545
- *
546
- * @deprecated Use `toTrain` instead, which converts from any case. It keeps acronyms together,
547
- * so results differ for keys like `userID` (see the migration notes in the README).
548
- */
549
- export declare function snakeToTrain<T extends object | string>(input: T): Result<T, "SnakeToTrain">;
550
- /**
551
- * Converts a string, or the keys of an object/array (deeply), from snake_case to dot.case.
552
- *
553
- * @example
554
- * ```ts
555
- * snakeToDot('hello_world'); // 'hello.world'
556
- * snakeToDot({ first_name: 'John' }); // { 'first.name': 'John' }
557
- * ```
558
- *
559
- * @deprecated Use `toDot` instead, which converts from any case. It keeps acronyms together,
560
- * so results differ for keys like `userID` (see the migration notes in the README).
561
- */
562
- export declare function snakeToDot<T extends object | string>(input: T): Result<T, "SnakeToDot">;
563
- /**
564
- * Converts a string, or the keys of an object/array (deeply), from snake_case to Title Case.
565
- *
566
- * @example
567
- * ```ts
568
- * snakeToTitle('hello_world'); // 'Hello World'
569
- * snakeToTitle({ first_name: 'John' }); // { 'First Name': 'John' }
570
- * ```
571
- *
572
- * @deprecated Use `toTitle` instead, which converts from any case. It keeps acronyms together,
573
- * so results differ for keys like `userID` (see the migration notes in the README).
574
- */
575
- export declare function snakeToTitle<T extends object | string>(input: T): Result<T, "SnakeToTitle">;
576
- /**
577
- * Converts a string, or the keys of an object/array (deeply), from snake_case to Sentence case.
578
- *
579
- * @example
580
- * ```ts
581
- * snakeToSentence('hello_world'); // 'Hello world'
582
- * snakeToSentence({ first_name: 'John' }); // { 'First name': 'John' }
583
- * ```
584
- *
585
- * @deprecated Use `toSentence` instead, which converts from any case. It keeps acronyms together,
586
- * so results differ for keys like `userID` (see the migration notes in the README).
587
- */
588
- export declare function snakeToSentence<T extends object | string>(input: T): Result<T, "SnakeToSentence">;
589
- //#endregion
590
- //#region src/trainCase/trainCase.d.ts
591
- /**
592
- * Converts a string, or the keys of an object/array (deeply), from Train-Case to camelCase.
593
- *
594
- * @example
595
- * ```ts
596
- * trainToCamel('Hello-World'); // 'helloWorld'
597
- * trainToCamel({ 'First-Name': 'John' }); // { firstName: 'John' }
598
- * ```
599
- *
600
- * @deprecated Use `toCamel` instead, which converts from any case. It keeps acronyms together,
601
- * so results differ for keys like `userID` (see the migration notes in the README).
602
- */
603
- export declare function trainToCamel<T extends object | string>(input: T): Result<T, "TrainToCamel">;
604
- /**
605
- * Converts a string, or the keys of an object/array (deeply), from Train-Case to PascalCase.
606
- *
607
- * @example
608
- * ```ts
609
- * trainToPascal('Hello-World'); // 'HelloWorld'
610
- * trainToPascal({ 'First-Name': 'John' }); // { FirstName: 'John' }
611
- * ```
612
- *
613
- * @deprecated Use `toPascal` instead, which converts from any case. It keeps acronyms together,
614
- * so results differ for keys like `userID` (see the migration notes in the README).
615
- */
616
- export declare function trainToPascal<T extends object | string>(input: T): Result<T, "TrainToPascal">;
617
- /**
618
- * Converts a string, or the keys of an object/array (deeply), from Train-Case to snake_case.
619
- *
620
- * @example
621
- * ```ts
622
- * trainToSnake('Hello-World'); // 'hello_world'
623
- * trainToSnake({ 'First-Name': 'John' }); // { first_name: 'John' }
624
- * ```
625
- *
626
- * @deprecated Use `toSnake` instead, which converts from any case. It keeps acronyms together,
627
- * so results differ for keys like `userID` (see the migration notes in the README).
628
- */
629
- export declare function trainToSnake<T extends object | string>(input: T): Result<T, "TrainToSnake">;
630
- /**
631
- * Converts a string, or the keys of an object/array (deeply), from Train-Case to dash-case.
632
- *
633
- * @example
634
- * ```ts
635
- * trainToDash('Hello-World'); // 'hello-world'
636
- * trainToDash({ 'First-Name': 'John' }); // { 'first-name': 'John' }
637
- * ```
638
- *
639
- * @deprecated Use `toKebab` instead, which converts from any case. It keeps acronyms together,
640
- * so results differ for keys like `userID` (see the migration notes in the README).
641
- */
642
- export declare function trainToDash<T extends object | string>(input: T): Result<T, "TrainToDash">;
643
- /**
644
- * Converts a string, or the keys of an object/array (deeply), from Train-Case to UPPER_SNAKE_CASE.
645
- *
646
- * @example
647
- * ```ts
648
- * trainToUpperSnake('Hello-World'); // 'HELLO_WORLD'
649
- * trainToUpperSnake({ 'First-Name': 'John' }); // { FIRST_NAME: 'John' }
650
- * ```
651
- *
652
- * @deprecated Use `toUpperSnake` instead, which converts from any case. It keeps acronyms together,
653
- * so results differ for keys like `userID` (see the migration notes in the README).
654
- */
655
- export declare function trainToUpperSnake<T extends object | string>(input: T): Result<T, "TrainToUpperSnake">;
656
- /**
657
- * Converts a string, or the keys of an object/array (deeply), from Train-Case to UPPER-DASH-CASE.
658
- *
659
- * @example
660
- * ```ts
661
- * trainToUpperDash('Hello-World'); // 'HELLO-WORLD'
662
- * trainToUpperDash({ 'First-Name': 'John' }); // { 'FIRST-NAME': 'John' }
663
- * ```
664
- *
665
- * @deprecated Use `toUpperKebab` instead, which converts from any case. It keeps acronyms together,
666
- * so results differ for keys like `userID` (see the migration notes in the README).
667
- */
668
- export declare function trainToUpperDash<T extends object | string>(input: T): Result<T, "TrainToUpperDash">;
669
- /**
670
- * Converts a string, or the keys of an object/array (deeply), from Train-Case to dot.case.
671
- *
672
- * @example
673
- * ```ts
674
- * trainToDot('Hello-World'); // 'hello.world'
675
- * trainToDot({ 'First-Name': 'John' }); // { 'first.name': 'John' }
676
- * ```
677
- *
678
- * @deprecated Use `toDot` instead, which converts from any case. It keeps acronyms together,
679
- * so results differ for keys like `userID` (see the migration notes in the README).
680
- */
681
- export declare function trainToDot<T extends object | string>(input: T): Result<T, "TrainToDot">;
682
- /**
683
- * Converts a string, or the keys of an object/array (deeply), from Train-Case to Title Case.
684
- *
685
- * @example
686
- * ```ts
687
- * trainToTitle('Hello-World'); // 'Hello World'
688
- * trainToTitle({ 'First-Name': 'John' }); // { 'First Name': 'John' }
689
- * ```
690
- *
691
- * @deprecated Use `toTitle` instead, which converts from any case. It keeps acronyms together,
692
- * so results differ for keys like `userID` (see the migration notes in the README).
693
- */
694
- export declare function trainToTitle<T extends object | string>(input: T): Result<T, "TrainToTitle">;
695
- /**
696
- * Converts a string, or the keys of an object/array (deeply), from Train-Case to Sentence case.
697
- *
698
- * @example
699
- * ```ts
700
- * trainToSentence('Hello-World'); // 'Hello world'
701
- * trainToSentence({ 'First-Name': 'John' }); // { 'First name': 'John' }
702
- * ```
703
- *
704
- * @deprecated Use `toSentence` instead, which converts from any case. It keeps acronyms together,
705
- * so results differ for keys like `userID` (see the migration notes in the README).
706
- */
707
- export declare function trainToSentence<T extends object | string>(input: T): Result<T, "TrainToSentence">;
708
- //#endregion
709
- //#region src/dotCase/dotCase.d.ts
710
- /**
711
- * Converts a string, or the keys of an object/array (deeply), from dot.case to camelCase.
712
- *
713
- * @example
714
- * ```ts
715
- * dotToCamel('hello.world'); // 'helloWorld'
716
- * dotToCamel({ 'first.name': 'John' }); // { firstName: 'John' }
717
- * ```
718
- *
719
- * @deprecated Use `toCamel` instead, which converts from any case. It keeps acronyms together,
720
- * so results differ for keys like `userID` (see the migration notes in the README).
721
- */
722
- export declare function dotToCamel<T extends object | string>(input: T): Result<T, "DotToCamel">;
723
- /**
724
- * Converts a string, or the keys of an object/array (deeply), from dot.case to PascalCase.
725
- *
726
- * @example
727
- * ```ts
728
- * dotToPascal('hello.world'); // 'HelloWorld'
729
- * dotToPascal({ 'first.name': 'John' }); // { FirstName: 'John' }
730
- * ```
731
- *
732
- * @deprecated Use `toPascal` instead, which converts from any case. It keeps acronyms together,
733
- * so results differ for keys like `userID` (see the migration notes in the README).
734
- */
735
- export declare function dotToPascal<T extends object | string>(input: T): Result<T, "DotToPascal">;
736
- /**
737
- * Converts a string, or the keys of an object/array (deeply), from dot.case to snake_case.
738
- *
739
- * @example
740
- * ```ts
741
- * dotToSnake('hello.world'); // 'hello_world'
742
- * dotToSnake({ 'first.name': 'John' }); // { first_name: 'John' }
743
- * ```
744
- *
745
- * @deprecated Use `toSnake` instead, which converts from any case. It keeps acronyms together,
746
- * so results differ for keys like `userID` (see the migration notes in the README).
747
- */
748
- export declare function dotToSnake<T extends object | string>(input: T): Result<T, "DotToSnake">;
749
- /**
750
- * Converts a string, or the keys of an object/array (deeply), from dot.case to dash-case.
751
- *
752
- * @example
753
- * ```ts
754
- * dotToDash('hello.world'); // 'hello-world'
755
- * dotToDash({ 'first.name': 'John' }); // { 'first-name': 'John' }
756
- * ```
757
- *
758
- * @deprecated Use `toKebab` instead, which converts from any case. It keeps acronyms together,
759
- * so results differ for keys like `userID` (see the migration notes in the README).
760
- */
761
- export declare function dotToDash<T extends object | string>(input: T): Result<T, "DotToDash">;
762
- /**
763
- * Converts a string, or the keys of an object/array (deeply), from dot.case to UPPER_SNAKE_CASE.
764
- *
765
- * @example
766
- * ```ts
767
- * dotToUpperSnake('hello.world'); // 'HELLO_WORLD'
768
- * dotToUpperSnake({ 'first.name': 'John' }); // { FIRST_NAME: 'John' }
769
- * ```
770
- *
771
- * @deprecated Use `toUpperSnake` instead, which converts from any case. It keeps acronyms together,
772
- * so results differ for keys like `userID` (see the migration notes in the README).
773
- */
774
- export declare function dotToUpperSnake<T extends object | string>(input: T): Result<T, "DotToUpperSnake">;
775
- /**
776
- * Converts a string, or the keys of an object/array (deeply), from dot.case to UPPER-DASH-CASE.
777
- *
778
- * @example
779
- * ```ts
780
- * dotToUpperDash('hello.world'); // 'HELLO-WORLD'
781
- * dotToUpperDash({ 'first.name': 'John' }); // { 'FIRST-NAME': 'John' }
782
- * ```
783
- *
784
- * @deprecated Use `toUpperKebab` instead, which converts from any case. It keeps acronyms together,
785
- * so results differ for keys like `userID` (see the migration notes in the README).
786
- */
787
- export declare function dotToUpperDash<T extends object | string>(input: T): Result<T, "DotToUpperDash">;
788
- /**
789
- * Converts a string, or the keys of an object/array (deeply), from dot.case to Train-Case.
790
- *
791
- * @example
792
- * ```ts
793
- * dotToTrain('hello.world'); // 'Hello-World'
794
- * dotToTrain({ 'first.name': 'John' }); // { 'First-Name': 'John' }
795
- * ```
796
- *
797
- * @deprecated Use `toTrain` instead, which converts from any case. It keeps acronyms together,
798
- * so results differ for keys like `userID` (see the migration notes in the README).
799
- */
800
- export declare function dotToTrain<T extends object | string>(input: T): Result<T, "DotToTrain">;
801
- /**
802
- * Converts a string, or the keys of an object/array (deeply), from dot.case to Title Case.
803
- *
804
- * @example
805
- * ```ts
806
- * dotToTitle('hello.world'); // 'Hello World'
807
- * dotToTitle({ 'first.name': 'John' }); // { 'First Name': 'John' }
808
- * ```
809
- *
810
- * @deprecated Use `toTitle` instead, which converts from any case. It keeps acronyms together,
811
- * so results differ for keys like `userID` (see the migration notes in the README).
812
- */
813
- export declare function dotToTitle<T extends object | string>(input: T): Result<T, "DotToTitle">;
814
- /**
815
- * Converts a string, or the keys of an object/array (deeply), from dot.case to Sentence case.
816
- *
817
- * @example
818
- * ```ts
819
- * dotToSentence('hello.world'); // 'Hello world'
820
- * dotToSentence({ 'first.name': 'John' }); // { 'First name': 'John' }
821
- * ```
822
- *
823
- * @deprecated Use `toSentence` instead, which converts from any case. It keeps acronyms together,
824
- * so results differ for keys like `userID` (see the migration notes in the README).
825
- */
826
- export declare function dotToSentence<T extends object | string>(input: T): Result<T, "DotToSentence">;
827
- //#endregion
828
- //#region src/titleCase/titleCase.d.ts
829
- /**
830
- * Converts a string, or the keys of an object/array (deeply), from Title Case to camelCase.
831
- *
832
- * @example
833
- * ```ts
834
- * titleToCamel('Hello World'); // 'helloWorld'
835
- * titleToCamel({ 'First Name': 'John' }); // { firstName: 'John' }
836
- * ```
837
- *
838
- * @deprecated Use `toCamel` instead, which converts from any case. It keeps acronyms together,
839
- * so results differ for keys like `userID` (see the migration notes in the README).
840
- */
841
- export declare function titleToCamel<T extends object | string>(input: T): Result<T, "TitleToCamel">;
842
- /**
843
- * Converts a string, or the keys of an object/array (deeply), from Title Case to PascalCase.
844
- *
845
- * @example
846
- * ```ts
847
- * titleToPascal('Hello World'); // 'HelloWorld'
848
- * titleToPascal({ 'First Name': 'John' }); // { FirstName: 'John' }
849
- * ```
850
- *
851
- * @deprecated Use `toPascal` instead, which converts from any case. It keeps acronyms together,
852
- * so results differ for keys like `userID` (see the migration notes in the README).
853
- */
854
- export declare function titleToPascal<T extends object | string>(input: T): Result<T, "TitleToPascal">;
855
- /**
856
- * Converts a string, or the keys of an object/array (deeply), from Title Case to snake_case.
857
- *
858
- * @example
859
- * ```ts
860
- * titleToSnake('Hello World'); // 'hello_world'
861
- * titleToSnake({ 'First Name': 'John' }); // { first_name: 'John' }
862
- * ```
863
- *
864
- * @deprecated Use `toSnake` instead, which converts from any case. It keeps acronyms together,
865
- * so results differ for keys like `userID` (see the migration notes in the README).
866
- */
867
- export declare function titleToSnake<T extends object | string>(input: T): Result<T, "TitleToSnake">;
868
- /**
869
- * Converts a string, or the keys of an object/array (deeply), from Title Case to dash-case.
870
- *
871
- * @example
872
- * ```ts
873
- * titleToDash('Hello World'); // 'hello-world'
874
- * titleToDash({ 'First Name': 'John' }); // { 'first-name': 'John' }
875
- * ```
876
- *
877
- * @deprecated Use `toKebab` instead, which converts from any case. It keeps acronyms together,
878
- * so results differ for keys like `userID` (see the migration notes in the README).
879
- */
880
- export declare function titleToDash<T extends object | string>(input: T): Result<T, "TitleToDash">;
881
- /**
882
- * Converts a string, or the keys of an object/array (deeply), from Title Case to UPPER_SNAKE_CASE.
883
- *
884
- * @example
885
- * ```ts
886
- * titleToUpperSnake('Hello World'); // 'HELLO_WORLD'
887
- * titleToUpperSnake({ 'First Name': 'John' }); // { FIRST_NAME: 'John' }
888
- * ```
889
- *
890
- * @deprecated Use `toUpperSnake` instead, which converts from any case. It keeps acronyms together,
891
- * so results differ for keys like `userID` (see the migration notes in the README).
892
- */
893
- export declare function titleToUpperSnake<T extends object | string>(input: T): Result<T, "TitleToUpperSnake">;
894
- /**
895
- * Converts a string, or the keys of an object/array (deeply), from Title Case to UPPER-DASH-CASE.
896
- *
897
- * @example
898
- * ```ts
899
- * titleToUpperDash('Hello World'); // 'HELLO-WORLD'
900
- * titleToUpperDash({ 'First Name': 'John' }); // { 'FIRST-NAME': 'John' }
901
- * ```
902
- *
903
- * @deprecated Use `toUpperKebab` instead, which converts from any case. It keeps acronyms together,
904
- * so results differ for keys like `userID` (see the migration notes in the README).
905
- */
906
- export declare function titleToUpperDash<T extends object | string>(input: T): Result<T, "TitleToUpperDash">;
907
- /**
908
- * Converts a string, or the keys of an object/array (deeply), from Title Case to Train-Case.
909
- *
910
- * @example
911
- * ```ts
912
- * titleToTrain('Hello World'); // 'Hello-World'
913
- * titleToTrain({ 'First Name': 'John' }); // { 'First-Name': 'John' }
914
- * ```
915
- *
916
- * @deprecated Use `toTrain` instead, which converts from any case. It keeps acronyms together,
917
- * so results differ for keys like `userID` (see the migration notes in the README).
918
- */
919
- export declare function titleToTrain<T extends object | string>(input: T): Result<T, "TitleToTrain">;
920
- /**
921
- * Converts a string, or the keys of an object/array (deeply), from Title Case to dot.case.
922
- *
923
- * @example
924
- * ```ts
925
- * titleToDot('Hello World'); // 'hello.world'
926
- * titleToDot({ 'First Name': 'John' }); // { 'first.name': 'John' }
927
- * ```
928
- *
929
- * @deprecated Use `toDot` instead, which converts from any case. It keeps acronyms together,
930
- * so results differ for keys like `userID` (see the migration notes in the README).
931
- */
932
- export declare function titleToDot<T extends object | string>(input: T): Result<T, "TitleToDot">;
933
- /**
934
- * Converts a string, or the keys of an object/array (deeply), from Title Case to Sentence case.
935
- *
936
- * @example
937
- * ```ts
938
- * titleToSentence('Hello World'); // 'Hello world'
939
- * titleToSentence({ 'First Name': 'John' }); // { 'First name': 'John' }
940
- * ```
941
- *
942
- * @deprecated Use `toSentence` instead, which converts from any case. It keeps acronyms together,
943
- * so results differ for keys like `userID` (see the migration notes in the README).
944
- */
945
- export declare function titleToSentence<T extends object | string>(input: T): Result<T, "TitleToSentence">;
946
- //#endregion
947
- //#region src/sentenceCase/sentenceCase.d.ts
948
- /**
949
- * Converts a string, or the keys of an object/array (deeply), from Sentence case to camelCase.
950
- *
951
- * @example
952
- * ```ts
953
- * sentenceToCamel('Hello world'); // 'helloWorld'
954
- * sentenceToCamel({ 'First name': 'John' }); // { firstName: 'John' }
955
- * ```
956
- *
957
- * @deprecated Use `toCamel` instead, which converts from any case. It keeps acronyms together,
958
- * so results differ for keys like `userID` (see the migration notes in the README).
959
- */
960
- export declare function sentenceToCamel<T extends object | string>(input: T): Result<T, "SentenceToCamel">;
961
- /**
962
- * Converts a string, or the keys of an object/array (deeply), from Sentence case to PascalCase.
963
- *
964
- * @example
965
- * ```ts
966
- * sentenceToPascal('Hello world'); // 'HelloWorld'
967
- * sentenceToPascal({ 'First name': 'John' }); // { FirstName: 'John' }
968
- * ```
969
- *
970
- * @deprecated Use `toPascal` instead, which converts from any case. It keeps acronyms together,
971
- * so results differ for keys like `userID` (see the migration notes in the README).
972
- */
973
- export declare function sentenceToPascal<T extends object | string>(input: T): Result<T, "SentenceToPascal">;
974
- /**
975
- * Converts a string, or the keys of an object/array (deeply), from Sentence case to snake_case.
976
- *
977
- * @example
978
- * ```ts
979
- * sentenceToSnake('Hello world'); // 'hello_world'
980
- * sentenceToSnake({ 'First name': 'John' }); // { first_name: 'John' }
981
- * ```
982
- *
983
- * @deprecated Use `toSnake` instead, which converts from any case. It keeps acronyms together,
984
- * so results differ for keys like `userID` (see the migration notes in the README).
985
- */
986
- export declare function sentenceToSnake<T extends object | string>(input: T): Result<T, "SentenceToSnake">;
987
- /**
988
- * Converts a string, or the keys of an object/array (deeply), from Sentence case to dash-case.
989
- *
990
- * @example
991
- * ```ts
992
- * sentenceToDash('Hello world'); // 'hello-world'
993
- * sentenceToDash({ 'First name': 'John' }); // { 'first-name': 'John' }
994
- * ```
995
- *
996
- * @deprecated Use `toKebab` instead, which converts from any case. It keeps acronyms together,
997
- * so results differ for keys like `userID` (see the migration notes in the README).
998
- */
999
- export declare function sentenceToDash<T extends object | string>(input: T): Result<T, "SentenceToDash">;
1000
- /**
1001
- * Converts a string, or the keys of an object/array (deeply), from Sentence case to UPPER_SNAKE_CASE.
1002
- *
1003
- * @example
1004
- * ```ts
1005
- * sentenceToUpperSnake('Hello world'); // 'HELLO_WORLD'
1006
- * sentenceToUpperSnake({ 'First name': 'John' }); // { FIRST_NAME: 'John' }
1007
- * ```
1008
- *
1009
- * @deprecated Use `toUpperSnake` instead, which converts from any case. It keeps acronyms together,
1010
- * so results differ for keys like `userID` (see the migration notes in the README).
1011
- */
1012
- export declare function sentenceToUpperSnake<T extends object | string>(input: T): Result<T, "SentenceToUpperSnake">;
1013
- /**
1014
- * Converts a string, or the keys of an object/array (deeply), from Sentence case to UPPER-DASH-CASE.
1015
- *
1016
- * @example
1017
- * ```ts
1018
- * sentenceToUpperDash('Hello world'); // 'HELLO-WORLD'
1019
- * sentenceToUpperDash({ 'First name': 'John' }); // { 'FIRST-NAME': 'John' }
1020
- * ```
1021
- *
1022
- * @deprecated Use `toUpperKebab` instead, which converts from any case. It keeps acronyms together,
1023
- * so results differ for keys like `userID` (see the migration notes in the README).
1024
- */
1025
- export declare function sentenceToUpperDash<T extends object | string>(input: T): Result<T, "SentenceToUpperDash">;
1
+ //#region src/anyCase/types.d.ts
2
+ /** Flattens an intersection/mapped type so editors show the resulting keys. */
3
+ type Prettify<T> = { [K in keyof T]: T[K]; } & {};
4
+ type Separator = "_" | "-" | "." | " ";
5
+ /** ASCII punctuation, except the separators `_`, `-` and `.`. */
6
+ type SymbolChar = "!" | "\"" | "#" | "$" | "%" | "&" | "'" | "(" | ")" | "*" | "+" | "," | "/" | ":" | ";" | "<" | "=" | ">" | "?" | "@" | "[" | "\\" | "]" | "^" | "`" | "{" | "|" | "}" | "~";
1026
7
  /**
1027
- * Converts a string, or the keys of an object/array (deeply), from Sentence case to Train-Case.
1028
- *
1029
- * @example
1030
- * ```ts
1031
- * sentenceToTrain('Hello world'); // 'Hello-World'
1032
- * sentenceToTrain({ 'First name': 'John' }); // { 'First-Name': 'John' }
1033
- * ```
1034
- *
1035
- * @deprecated Use `toTrain` instead, which converts from any case. It keeps acronyms together,
1036
- * so results differ for keys like `userID` (see the migration notes in the README).
8
+ * Which symbols the `toX` functions keep: `true` keeps all of them, `false` (the default)
9
+ * removes all of them, and an array keeps only the listed ones (e.g. `['$', '@']`).
1037
10
  */
1038
- export declare function sentenceToTrain<T extends object | string>(input: T): Result<T, "SentenceToTrain">;
11
+ type AllowSymbols = boolean | readonly string[];
12
+ /** Changes the case of the whole result: `'lowercase'` or `'uppercase'`. */
13
+ type Transform = "uppercase" | "lowercase";
14
+ /** The options of the `toX` functions. `S` is inferred from `allowSymbols`, and `I` from `ignore`. */
15
+ interface CaseOptions<S = boolean | string, I extends string = string> {
16
+ /** Symbols are removed by default. `true` keeps all of them, and an array keeps only the listed ones (e.g. `['$']`). */
17
+ allowSymbols?: S | readonly S[];
18
+ /** Object keys that are kept as they are, at any depth (e.g. `['_id']`). Their values are still converted. */
19
+ ignore?: readonly I[];
20
+ }
21
+ /** The options of `toDot` and `toPath`, which also take a `transform`. `X` is inferred from `transform`. */
22
+ interface TransformCaseOptions<S = boolean | string, X extends Transform | undefined = Transform | undefined, I extends string = string> extends CaseOptions<S, I> {
23
+ /** The original case of each word is kept by default. `'lowercase'` or `'uppercase'` changes the case of the whole result. */
24
+ transform?: X;
25
+ }
26
+ /** The separator that `toPath` joins the words with: `'/'` (the default) or `'\\'`. */
27
+ type PathSeparator = "/" | "\\";
28
+ /** The options of `toPath`, which also take a `separator`. `P` is inferred from `separator`. */
29
+ interface PathCaseOptions<S = boolean | string, X extends Transform | undefined = Transform | undefined, P extends PathSeparator = PathSeparator, I extends string = string> extends TransformCaseOptions<S, X, I> {
30
+ /** Joins the words with `'/'` (the default) or `'\\'`. */
31
+ separator?: P;
32
+ }
33
+ type IsUpper<C extends string> = C extends Lowercase<C> ? false : true;
34
+ type IsLower<C extends string> = C extends Uppercase<C> ? false : true;
35
+ type Push<L extends boolean, W extends string[], Word extends string> = Word extends "" ? W : [...W, L extends true ? Lowercase<Word> : Word];
36
+ type RunText<Run> = Run extends string ? Run : "";
1039
37
  /**
1040
- * Converts a string, or the keys of an object/array (deeply), from Sentence case to dot.case.
1041
- *
1042
- * @example
1043
- * ```ts
1044
- * sentenceToDot('Hello world'); // 'hello.world'
1045
- * sentenceToDot({ 'First name': 'John' }); // { 'first.name': 'John' }
1046
- * ```
1047
- *
1048
- * @deprecated Use `toDot` instead, which converts from any case. It keeps acronyms together,
1049
- * so results differ for keys like `userID` (see the migration notes in the README).
38
+ * Splits a string into lowercase words, the same way `words()` does at runtime:
39
+ * on `_`, `-`, `.` and spaces, before an uppercase letter that follows a lowercase
40
+ * letter or a digit (`helloWorld`), and before the last letter of an acronym (`XMLHttp`).
41
+ * Symbols also start a new word; the ones in `S` are kept (see `words()`). Words are lowercased
42
+ * unless `L` is `false`. `Run` holds the kept symbols of the current run of symbols, or `false`
43
+ * outside of one.
1050
44
  */
1051
- export declare function sentenceToDot<T extends object | string>(input: T): Result<T, "SentenceToDot">;
45
+ type Words<T extends string, S extends string, L extends boolean = true, W extends string[] = [], Word extends string = "", Prev extends string = "", Run extends string | false = false> = T extends `${infer C}${infer Rest}` ? C extends Separator | SymbolChar ? C extends Separator ? Words<Rest, S, L, Push<L, W, `${Word}${RunText<Run>}`>, "", "", false> : Words<Rest, S, L, W, Word, Prev, `${RunText<Run>}${C extends S ? C : ""}`> : Run extends string ? Words<Rest, S, L, Push<L, W, Word>, `${Run}${C}`, C, false> : IsUpper<C> extends true ? Prev extends "" ? Words<Rest, S, L, W, `${Word}${C}`, C> : IsUpper<Prev> extends false ? Words<Rest, S, L, Push<L, W, Word>, C, C> : Rest extends `${infer Next}${string}` ? IsLower<Next> extends true ? Words<Rest, S, L, Push<L, W, Word>, C, C> : Words<Rest, S, L, W, `${Word}${C}`, C> : Words<Rest, S, L, W, `${Word}${C}`, C> : Words<Rest, S, L, W, `${Word}${C}`, C> : Push<L, W, `${Word}${RunText<Run>}`>;
46
+ /** Uppercases the first character that is not a symbol: `'$id'` → `'$Id'`. */
47
+ type CapitalizeWord<W> = W extends `${infer C}${infer R}` ? C extends SymbolChar ? `${C}${CapitalizeWord<R>}` : `${Uppercase<C>}${R}` : W;
48
+ type Join<W, S extends string> = W extends [infer A extends string] ? A : W extends [infer A extends string, ...infer R] ? `${A}${S}${Join<R, S>}` : "";
49
+ type CapitalizeAll<W> = { [K in keyof W]: CapitalizeWord<W[K] & string>; };
50
+ /** In a path, `/` and `\\` also separate words: they are replaced with a space before splitting, like `ToPath` does. */
51
+ type PathSeparatorsToSpace<T extends string> = T extends `${infer A}/${infer B}` ? PathSeparatorsToSpace<`${A} ${B}`> : T extends `${infer A}\\${infer B}` ? PathSeparatorsToSpace<`${A} ${B}`> : T;
52
+ type CamelWords<W> = W extends [infer F extends string, ...infer R] ? `${F}${Join<CapitalizeAll<R>, "">}` : "";
53
+ /** A case that the `toX` functions (e.g. `toSnake`) convert to. */
54
+ type Case = "Camel" | "Pascal" | "Snake" | "Kebab" | "UpperSnake" | "UpperKebab" | "Train" | "Dot" | "Title" | "Sentence" | "PascalSnake" | "Path" | "Space" | "Lower" | "Upper";
55
+ /** The symbols kept by an `allowSymbols` argument: `true` → all, `false` → none, `'$' | '@'` → those. */
56
+ type KeptSymbols<S> = S extends true ? SymbolChar : S extends false ? never : S & string;
57
+ /** Applies a `transform` to a converted key, or falls back to `string` when it is only known at runtime. */
58
+ type ApplyTransform<K extends string, X> = [X] extends [undefined] ? K : [X] extends ["lowercase"] ? Lowercase<K> : [X] extends ["uppercase"] ? Uppercase<K> : string;
59
+ type ConvertKey<K extends string, C extends Case, S extends string, P extends string = "/"> = string extends K ? string : C extends "Camel" ? CamelWords<Words<K, S>> : C extends "Pascal" ? Join<CapitalizeAll<Words<K, S>>, ""> : C extends "Snake" ? Join<Words<K, S>, "_"> : C extends "Kebab" ? Join<Words<K, S>, "-"> : C extends "UpperSnake" ? Uppercase<Join<Words<K, S>, "_">> : C extends "UpperKebab" ? Uppercase<Join<Words<K, S>, "-">> : C extends "Train" ? Join<CapitalizeAll<Words<K, S>>, "-"> : C extends "Dot" ? Join<Words<K, S, false>, "."> : C extends "Title" ? Join<CapitalizeAll<Words<K, S>>, " "> : C extends "Sentence" ? CapitalizeWord<Join<Words<K, S>, " ">> : C extends "PascalSnake" ? Join<CapitalizeAll<Words<K, S>>, "_"> : C extends "Path" ? Join<Words<PathSeparatorsToSpace<K>, S, false>, P> : C extends "Space" ? Join<Words<K, S, false>, " "> : C extends "Lower" ? Join<Words<K, S>, " "> : C extends "Upper" ? Uppercase<Join<Words<K, S>, " ">> : never;
60
+ /** An `ignore`d key keeps its name, and any key could be ignored when `ignore` is only known as `string[]`. */
61
+ type IgnoreKey<K, I extends string, Converted> = [I] extends [never] ? Converted : string extends I ? string : K extends I ? K : Converted;
1052
62
  /**
1053
- * Converts a string, or the keys of an object/array (deeply), from Sentence case to Title Case.
1054
- *
1055
- * @example
1056
- * ```ts
1057
- * sentenceToTitle('Hello world'); // 'Hello World'
1058
- * sentenceToTitle({ 'First name': 'John' }); // { 'First Name': 'John' }
1059
- * ```
1060
- *
1061
- * @deprecated Use `toTitle` instead, which converts from any case. It keeps acronyms together,
1062
- * so results differ for keys like `userID` (see the migration notes in the README).
63
+ * The type returned by a `toX` function: strings stay `string`, and object keys
64
+ * in any case (deeply, including inside arrays) are renamed to the case `C`.
65
+ * `S` is the `allowSymbols` argument (`false` by default), `X` the `transform` option of `toDot` and `toPath`,
66
+ * `P` the `separator` option of `toPath`, and `I` the keys in the `ignore` option.
1063
67
  */
1064
- export declare function sentenceToTitle<T extends object | string>(input: T): Result<T, "SentenceToTitle">;
68
+ type CaseResult<T, C extends Case, S = false, X = undefined, P extends string = "/", I extends string = never> = T extends string ? string : T extends Array<unknown> ? { [K in keyof T]: CaseResult<T[K], C, S, X, P, I>; } : T extends object ? Prettify<{ [K in keyof T as IgnoreKey<K, I, boolean extends S ? string : string extends KeptSymbols<S> ? string : ApplyTransform<ConvertKey<K & string, C, KeptSymbols<S>, P>, X>>]: CaseResult<T[K], C, S, X, P, I>; }> : T;
1065
69
  //#endregion
1066
- //#region src/upperDashCase/upperDashCase.d.ts
1067
- /**
1068
- * Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to camelCase.
1069
- *
1070
- * @example
1071
- * ```ts
1072
- * upperDashToCamel('HELLO-WORLD'); // 'helloWorld'
1073
- * upperDashToCamel({ 'FIRST-NAME': 'John' }); // { firstName: 'John' }
1074
- * ```
1075
- *
1076
- * @deprecated Use `toCamel` instead, which converts from any case. It keeps acronyms together,
1077
- * so results differ for keys like `userID` (see the migration notes in the README).
1078
- */
1079
- export declare function upperDashToCamel<T extends object | string>(input: T): Result<T, "UpperDashToCamel">;
1080
- /**
1081
- * Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to snake_case.
1082
- *
1083
- * @example
1084
- * ```ts
1085
- * upperDashToSnake('HELLO-WORLD'); // 'hello_world'
1086
- * upperDashToSnake({ 'FIRST-NAME': 'John' }); // { first_name: 'John' }
1087
- * ```
1088
- *
1089
- * @deprecated Use `toSnake` instead, which converts from any case. It keeps acronyms together,
1090
- * so results differ for keys like `userID` (see the migration notes in the README).
1091
- */
1092
- export declare function upperDashToSnake<T extends object | string>(input: T): Result<T, "UpperDashToSnake">;
1093
- /**
1094
- * Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to dash-case.
1095
- *
1096
- * @example
1097
- * ```ts
1098
- * upperDashToDash('HELLO-WORLD'); // 'hello-world'
1099
- * upperDashToDash({ 'FIRST-NAME': 'John' }); // { 'first-name': 'John' }
1100
- * ```
1101
- *
1102
- * @deprecated Use `toKebab` instead, which converts from any case. It keeps acronyms together,
1103
- * so results differ for keys like `userID` (see the migration notes in the README).
1104
- */
1105
- export declare function upperDashToDash<T extends object | string>(input: T): Result<T, "UpperDashToDash">;
70
+ //#region src/anyCase/anyCase.d.ts
1106
71
  /**
1107
- * Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to PascalCase.
72
+ * Converts a string, or the keys of an object/array (deeply), from any case to camelCase.
1108
73
  *
1109
74
  * @example
1110
75
  * ```ts
1111
- * upperDashToPascal('HELLO-WORLD'); // 'HelloWorld'
1112
- * upperDashToPascal({ 'FIRST-NAME': 'John' }); // { FirstName: 'John' }
76
+ * toCamel('hello_world'); // 'helloWorld'
77
+ * toCamel({ first_name: 'John', userID: 1 }); // { firstName: 'John', userId: 1 }
78
+ * toCamel('$hello-world', true); // '$helloWorld'
1113
79
  * ```
1114
80
  *
1115
- * @deprecated Use `toPascal` instead, which converts from any case. It keeps acronyms together,
1116
- * so results differ for keys like `userID` (see the migration notes in the README).
81
+ * @param allowSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
82
+ * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
1117
83
  */
1118
- export declare function upperDashToPascal<T extends object | string>(input: T): Result<T, "UpperDashToPascal">;
84
+ export declare function toCamel<T extends object | string, S extends boolean | string = false>(input: T, allowSymbols?: S | readonly S[]): CaseResult<T, "Camel", S>;
1119
85
  /**
1120
- * Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to UPPER_SNAKE_CASE.
86
+ * Converts a string, or the keys of an object/array (deeply), from any case to camelCase.
1121
87
  *
1122
88
  * @example
1123
89
  * ```ts
1124
- * upperDashToUpperSnake('HELLO-WORLD'); // 'HELLO_WORLD'
1125
- * upperDashToUpperSnake({ 'FIRST-NAME': 'John' }); // { FIRST_NAME: 'John' }
90
+ * toCamel('$hello-world', { allowSymbols: ['$'] }); // '$helloWorld'
1126
91
  * ```
1127
92
  *
1128
- * @deprecated Use `toUpperSnake` instead, which converts from any case. It keeps acronyms together,
1129
- * so results differ for keys like `userID` (see the migration notes in the README).
93
+ * @param options `allowSymbols`: symbols are removed by default; `true` keeps all of them, and an array keeps only some.
1130
94
  */
1131
- export declare function upperDashToUpperSnake<T extends object | string>(input: T): Result<T, "UpperDashToUpperSnake">;
95
+ export declare function toCamel<T extends object | string, S extends boolean | string = false, I extends string = never>(input: T, options: CaseOptions<S, I>): CaseResult<T, "Camel", S, undefined, "/", I>;
1132
96
  /**
1133
- * Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to Train-Case.
97
+ * Converts a string, or the keys of an object/array (deeply), from any case to PascalCase.
1134
98
  *
1135
99
  * @example
1136
100
  * ```ts
1137
- * upperDashToTrain('HELLO-WORLD'); // 'Hello-World'
1138
- * upperDashToTrain({ 'FIRST-NAME': 'John' }); // { 'First-Name': 'John' }
101
+ * toPascal('hello-world'); // 'HelloWorld'
102
+ * toPascal({ 'first-name': 'John', userID: 1 }); // { FirstName: 'John', UserId: 1 }
103
+ * toPascal('$hello-world', true); // '$HelloWorld'
1139
104
  * ```
1140
105
  *
1141
- * @deprecated Use `toTrain` instead, which converts from any case. It keeps acronyms together,
1142
- * so results differ for keys like `userID` (see the migration notes in the README).
106
+ * @param allowSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
107
+ * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
1143
108
  */
1144
- export declare function upperDashToTrain<T extends object | string>(input: T): Result<T, "UpperDashToTrain">;
109
+ export declare function toPascal<T extends object | string, S extends boolean | string = false>(input: T, allowSymbols?: S | readonly S[]): CaseResult<T, "Pascal", S>;
1145
110
  /**
1146
- * Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to dot.case.
111
+ * Converts a string, or the keys of an object/array (deeply), from any case to PascalCase.
1147
112
  *
1148
113
  * @example
1149
114
  * ```ts
1150
- * upperDashToDot('HELLO-WORLD'); // 'hello.world'
1151
- * upperDashToDot({ 'FIRST-NAME': 'John' }); // { 'first.name': 'John' }
115
+ * toPascal('$hello-world', { allowSymbols: ['$'] }); // '$HelloWorld'
1152
116
  * ```
1153
117
  *
1154
- * @deprecated Use `toDot` instead, which converts from any case. It keeps acronyms together,
1155
- * so results differ for keys like `userID` (see the migration notes in the README).
118
+ * @param options `allowSymbols`: symbols are removed by default; `true` keeps all of them, and an array keeps only some.
1156
119
  */
1157
- export declare function upperDashToDot<T extends object | string>(input: T): Result<T, "UpperDashToDot">;
120
+ export declare function toPascal<T extends object | string, S extends boolean | string = false, I extends string = never>(input: T, options: CaseOptions<S, I>): CaseResult<T, "Pascal", S, undefined, "/", I>;
1158
121
  /**
1159
- * Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to Title Case.
122
+ * Converts a string, or the keys of an object/array (deeply), from any case to snake_case.
1160
123
  *
1161
124
  * @example
1162
125
  * ```ts
1163
- * upperDashToTitle('HELLO-WORLD'); // 'Hello World'
1164
- * upperDashToTitle({ 'FIRST-NAME': 'John' }); // { 'First Name': 'John' }
126
+ * toSnake('helloWorld'); // 'hello_world'
127
+ * toSnake({ firstName: 'John', userID: 1 }); // { first_name: 'John', user_id: 1 }
128
+ * toSnake('$hello-world', true); // '$hello_world'
1165
129
  * ```
1166
130
  *
1167
- * @deprecated Use `toTitle` instead, which converts from any case. It keeps acronyms together,
1168
- * so results differ for keys like `userID` (see the migration notes in the README).
131
+ * @param allowSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
132
+ * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
1169
133
  */
1170
- export declare function upperDashToTitle<T extends object | string>(input: T): Result<T, "UpperDashToTitle">;
134
+ export declare function toSnake<T extends object | string, S extends boolean | string = false>(input: T, allowSymbols?: S | readonly S[]): CaseResult<T, "Snake", S>;
1171
135
  /**
1172
- * Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to Sentence case.
136
+ * Converts a string, or the keys of an object/array (deeply), from any case to snake_case.
1173
137
  *
1174
138
  * @example
1175
139
  * ```ts
1176
- * upperDashToSentence('HELLO-WORLD'); // 'Hello world'
1177
- * upperDashToSentence({ 'FIRST-NAME': 'John' }); // { 'First name': 'John' }
140
+ * toSnake('$hello-world', { allowSymbols: ['$'] }); // '$hello_world'
1178
141
  * ```
1179
142
  *
1180
- * @deprecated Use `toSentence` instead, which converts from any case. It keeps acronyms together,
1181
- * so results differ for keys like `userID` (see the migration notes in the README).
143
+ * @param options `allowSymbols`: symbols are removed by default; `true` keeps all of them, and an array keeps only some.
1182
144
  */
1183
- export declare function upperDashToSentence<T extends object | string>(input: T): Result<T, "UpperDashToSentence">;
1184
- //#endregion
1185
- //#region src/upperSnakeCase/upperSnakeCase.d.ts
145
+ export declare function toSnake<T extends object | string, S extends boolean | string = false, I extends string = never>(input: T, options: CaseOptions<S, I>): CaseResult<T, "Snake", S, undefined, "/", I>;
1186
146
  /**
1187
- * Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to camelCase.
147
+ * Converts a string, or the keys of an object/array (deeply), from any case to kebab-case.
1188
148
  *
1189
149
  * @example
1190
150
  * ```ts
1191
- * upperSnakeToCamel('HELLO_WORLD'); // 'helloWorld'
1192
- * upperSnakeToCamel({ FIRST_NAME: 'John' }); // { firstName: 'John' }
151
+ * toKebab('HELLO_WORLD'); // 'hello-world'
152
+ * toKebab({ FIRST_NAME: 'John', userID: 1 }); // { 'first-name': 'John', 'user-id': 1 }
153
+ * toKebab('$hello-world', true); // '$hello-world'
1193
154
  * ```
1194
155
  *
1195
- * @deprecated Use `toCamel` instead, which converts from any case. It keeps acronyms together,
1196
- * so results differ for keys like `userID` (see the migration notes in the README).
156
+ * @param allowSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
157
+ * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
1197
158
  */
1198
- export declare function upperSnakeToCamel<T extends object | string>(input: T): Result<T, "UpperSnakeToCamel">;
159
+ export declare function toKebab<T extends object | string, S extends boolean | string = false>(input: T, allowSymbols?: S | readonly S[]): CaseResult<T, "Kebab", S>;
1199
160
  /**
1200
- * Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to snake_case.
161
+ * Converts a string, or the keys of an object/array (deeply), from any case to kebab-case.
1201
162
  *
1202
163
  * @example
1203
164
  * ```ts
1204
- * upperSnakeToSnake('HELLO_WORLD'); // 'hello_world'
1205
- * upperSnakeToSnake({ FIRST_NAME: 'John' }); // { first_name: 'John' }
165
+ * toKebab('$hello-world', { allowSymbols: ['$'] }); // '$hello-world'
1206
166
  * ```
1207
167
  *
1208
- * @deprecated Use `toSnake` instead, which converts from any case. It keeps acronyms together,
1209
- * so results differ for keys like `userID` (see the migration notes in the README).
168
+ * @param options `allowSymbols`: symbols are removed by default; `true` keeps all of them, and an array keeps only some.
1210
169
  */
1211
- export declare function upperSnakeToSnake<T extends object | string>(input: T): Result<T, "UpperSnakeToSnake">;
170
+ export declare function toKebab<T extends object | string, S extends boolean | string = false, I extends string = never>(input: T, options: CaseOptions<S, I>): CaseResult<T, "Kebab", S, undefined, "/", I>;
1212
171
  /**
1213
- * Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to dash-case.
172
+ * Converts a string, or the keys of an object/array (deeply), from any case to UPPER_SNAKE_CASE.
1214
173
  *
1215
174
  * @example
1216
175
  * ```ts
1217
- * upperSnakeToDash('HELLO_WORLD'); // 'hello-world'
1218
- * upperSnakeToDash({ FIRST_NAME: 'John' }); // { 'first-name': 'John' }
176
+ * toUpperSnake('hello-world'); // 'HELLO_WORLD'
177
+ * toUpperSnake({ 'first-name': 'John', userID: 1 }); // { FIRST_NAME: 'John', USER_ID: 1 }
178
+ * toUpperSnake('$hello-world', true); // '$HELLO_WORLD'
1219
179
  * ```
1220
180
  *
1221
- * @deprecated Use `toKebab` instead, which converts from any case. It keeps acronyms together,
1222
- * so results differ for keys like `userID` (see the migration notes in the README).
181
+ * @param allowSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
182
+ * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
1223
183
  */
1224
- export declare function upperSnakeToDash<T extends object | string>(input: T): Result<T, "UpperSnakeToDash">;
184
+ export declare function toUpperSnake<T extends object | string, S extends boolean | string = false>(input: T, allowSymbols?: S | readonly S[]): CaseResult<T, "UpperSnake", S>;
1225
185
  /**
1226
- * Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to PascalCase.
186
+ * Converts a string, or the keys of an object/array (deeply), from any case to UPPER_SNAKE_CASE.
1227
187
  *
1228
188
  * @example
1229
189
  * ```ts
1230
- * upperSnakeToPascal('HELLO_WORLD'); // 'HelloWorld'
1231
- * upperSnakeToPascal({ FIRST_NAME: 'John' }); // { FirstName: 'John' }
190
+ * toUpperSnake('$hello-world', { allowSymbols: ['$'] }); // '$HELLO_WORLD'
1232
191
  * ```
1233
192
  *
1234
- * @deprecated Use `toPascal` instead, which converts from any case. It keeps acronyms together,
1235
- * so results differ for keys like `userID` (see the migration notes in the README).
193
+ * @param options `allowSymbols`: symbols are removed by default; `true` keeps all of them, and an array keeps only some.
1236
194
  */
1237
- export declare function upperSnakeToPascal<T extends object | string>(input: T): Result<T, "UpperSnakeToPascal">;
195
+ export declare function toUpperSnake<T extends object | string, S extends boolean | string = false, I extends string = never>(input: T, options: CaseOptions<S, I>): CaseResult<T, "UpperSnake", S, undefined, "/", I>;
1238
196
  /**
1239
- * Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to UPPER-DASH-CASE.
197
+ * Converts a string, or the keys of an object/array (deeply), from any case to UPPER-KEBAB-CASE.
1240
198
  *
1241
199
  * @example
1242
200
  * ```ts
1243
- * upperSnakeToUpperDash('HELLO_WORLD'); // 'HELLO-WORLD'
1244
- * upperSnakeToUpperDash({ FIRST_NAME: 'John' }); // { 'FIRST-NAME': 'John' }
201
+ * toUpperKebab('helloWorld'); // 'HELLO-WORLD'
202
+ * toUpperKebab({ firstName: 'John', userID: 1 }); // { 'FIRST-NAME': 'John', 'USER-ID': 1 }
203
+ * toUpperKebab('$hello-world', true); // '$HELLO-WORLD'
1245
204
  * ```
1246
205
  *
1247
- * @deprecated Use `toUpperKebab` instead, which converts from any case. It keeps acronyms together,
1248
- * so results differ for keys like `userID` (see the migration notes in the README).
206
+ * @param allowSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
207
+ * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
1249
208
  */
1250
- export declare function upperSnakeToUpperDash<T extends object | string>(input: T): Result<T, "UpperSnakeToUpperDash">;
209
+ export declare function toUpperKebab<T extends object | string, S extends boolean | string = false>(input: T, allowSymbols?: S | readonly S[]): CaseResult<T, "UpperKebab", S>;
1251
210
  /**
1252
- * Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to Train-Case.
211
+ * Converts a string, or the keys of an object/array (deeply), from any case to UPPER-KEBAB-CASE.
1253
212
  *
1254
213
  * @example
1255
214
  * ```ts
1256
- * upperSnakeToTrain('HELLO_WORLD'); // 'Hello-World'
1257
- * upperSnakeToTrain({ FIRST_NAME: 'John' }); // { 'First-Name': 'John' }
215
+ * toUpperKebab('$hello-world', { allowSymbols: ['$'] }); // '$HELLO-WORLD'
1258
216
  * ```
1259
217
  *
1260
- * @deprecated Use `toTrain` instead, which converts from any case. It keeps acronyms together,
1261
- * so results differ for keys like `userID` (see the migration notes in the README).
218
+ * @param options `allowSymbols`: symbols are removed by default; `true` keeps all of them, and an array keeps only some.
1262
219
  */
1263
- export declare function upperSnakeToTrain<T extends object | string>(input: T): Result<T, "UpperSnakeToTrain">;
220
+ export declare function toUpperKebab<T extends object | string, S extends boolean | string = false, I extends string = never>(input: T, options: CaseOptions<S, I>): CaseResult<T, "UpperKebab", S, undefined, "/", I>;
1264
221
  /**
1265
- * Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to dot.case.
222
+ * Converts a string, or the keys of an object/array (deeply), from any case to Train-Case.
1266
223
  *
1267
224
  * @example
1268
225
  * ```ts
1269
- * upperSnakeToDot('HELLO_WORLD'); // 'hello.world'
1270
- * upperSnakeToDot({ FIRST_NAME: 'John' }); // { 'first.name': 'John' }
226
+ * toTrain('hello_world'); // 'Hello-World'
227
+ * toTrain({ first_name: 'John', userID: 1 }); // { 'First-Name': 'John', 'User-Id': 1 }
228
+ * toTrain('$hello-world', true); // '$Hello-World'
1271
229
  * ```
1272
230
  *
1273
- * @deprecated Use `toDot` instead, which converts from any case. It keeps acronyms together,
1274
- * so results differ for keys like `userID` (see the migration notes in the README).
231
+ * @param allowSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
232
+ * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
1275
233
  */
1276
- export declare function upperSnakeToDot<T extends object | string>(input: T): Result<T, "UpperSnakeToDot">;
234
+ export declare function toTrain<T extends object | string, S extends boolean | string = false>(input: T, allowSymbols?: S | readonly S[]): CaseResult<T, "Train", S>;
1277
235
  /**
1278
- * Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to Title Case.
236
+ * Converts a string, or the keys of an object/array (deeply), from any case to Train-Case.
1279
237
  *
1280
238
  * @example
1281
239
  * ```ts
1282
- * upperSnakeToTitle('HELLO_WORLD'); // 'Hello World'
1283
- * upperSnakeToTitle({ FIRST_NAME: 'John' }); // { 'First Name': 'John' }
240
+ * toTrain('$hello-world', { allowSymbols: ['$'] }); // '$Hello-World'
1284
241
  * ```
1285
242
  *
1286
- * @deprecated Use `toTitle` instead, which converts from any case. It keeps acronyms together,
1287
- * so results differ for keys like `userID` (see the migration notes in the README).
243
+ * @param options `allowSymbols`: symbols are removed by default; `true` keeps all of them, and an array keeps only some.
1288
244
  */
1289
- export declare function upperSnakeToTitle<T extends object | string>(input: T): Result<T, "UpperSnakeToTitle">;
245
+ export declare function toTrain<T extends object | string, S extends boolean | string = false, I extends string = never>(input: T, options: CaseOptions<S, I>): CaseResult<T, "Train", S, undefined, "/", I>;
1290
246
  /**
1291
- * Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to Sentence case.
247
+ * Converts a string, or the keys of an object/array (deeply), from any case to dot.case, keeping the original case of each word.
1292
248
  *
1293
249
  * @example
1294
250
  * ```ts
1295
- * upperSnakeToSentence('HELLO_WORLD'); // 'Hello world'
1296
- * upperSnakeToSentence({ FIRST_NAME: 'John' }); // { 'First name': 'John' }
251
+ * toDot('$hello-World', { allowSymbols: ['$'] }); // '$hello.World'
252
+ * toDot('helloWorld', { transform: 'lowercase' }); // 'hello.world'
253
+ * toDot('helloWorld', { transform: 'uppercase' }); // 'HELLO.WORLD'
1297
254
  * ```
1298
255
  *
1299
- * @deprecated Use `toSentence` instead, which converts from any case. It keeps acronyms together,
1300
- * so results differ for keys like `userID` (see the migration notes in the README).
1301
- */
1302
- export declare function upperSnakeToSentence<T extends object | string>(input: T): Result<T, "UpperSnakeToSentence">;
1303
- //#endregion
1304
- //#region src/anyCase/types.d.ts
1305
- type Separator = "_" | "-" | "." | " ";
1306
- /** ASCII punctuation, except the separators `_`, `-` and `.`. */
1307
- type SymbolChar = "!" | "\"" | "#" | "$" | "%" | "&" | "'" | "(" | ")" | "*" | "+" | "," | "/" | ":" | ";" | "<" | "=" | ">" | "?" | "@" | "[" | "\\" | "]" | "^" | "`" | "{" | "|" | "}" | "~";
1308
- /**
1309
- * Which symbols the `toX` functions keep: `true` keeps all of them, `false` (the default)
1310
- * removes all of them, and an array keeps only the listed ones (e.g. `['$', '@']`).
1311
- */
1312
- type KeepSymbols = boolean | readonly string[];
1313
- type IsUpper<C extends string> = C extends Lowercase<C> ? false : true;
1314
- type IsLower<C extends string> = C extends Uppercase<C> ? false : true;
1315
- type Push<L extends boolean, W extends string[], Word extends string> = Word extends "" ? W : [...W, L extends true ? Lowercase<Word> : Word];
1316
- type RunText<Run> = Run extends string ? Run : "";
1317
- /**
1318
- * Splits a string into lowercase words, the same way `words()` does at runtime:
1319
- * on `_`, `-`, `.` and spaces, before an uppercase letter that follows a lowercase
1320
- * letter or a digit (`helloWorld`), and before the last letter of an acronym (`XMLHttp`).
1321
- * Symbols also start a new word; the ones in `S` are kept (see `words()`). Words are lowercased
1322
- * unless `L` is `false`. `Run` holds the kept symbols of the current run of symbols, or `false`
1323
- * outside of one.
1324
- */
1325
- type Words<T extends string, S extends string, L extends boolean = true, W extends string[] = [], Word extends string = "", Prev extends string = "", Run extends string | false = false> = T extends `${infer C}${infer Rest}` ? C extends Separator | SymbolChar ? C extends Separator ? Words<Rest, S, L, Push<L, W, `${Word}${RunText<Run>}`>, "", "", false> : Words<Rest, S, L, W, Word, Prev, `${RunText<Run>}${C extends S ? C : ""}`> : Run extends string ? Words<Rest, S, L, Push<L, W, Word>, `${Run}${C}`, C, false> : IsUpper<C> extends true ? Prev extends "" ? Words<Rest, S, L, W, `${Word}${C}`, C> : IsUpper<Prev> extends false ? Words<Rest, S, L, Push<L, W, Word>, C, C> : Rest extends `${infer Next}${string}` ? IsLower<Next> extends true ? Words<Rest, S, L, Push<L, W, Word>, C, C> : Words<Rest, S, L, W, `${Word}${C}`, C> : Words<Rest, S, L, W, `${Word}${C}`, C> : Words<Rest, S, L, W, `${Word}${C}`, C> : Push<L, W, `${Word}${RunText<Run>}`>;
1326
- /** Uppercases the first character that is not a symbol: `'$id'` → `'$Id'`. */
1327
- type CapitalizeWord<W> = W extends `${infer C}${infer R}` ? C extends SymbolChar ? `${C}${CapitalizeWord<R>}` : `${Uppercase<C>}${R}` : W;
1328
- type Join<W, S extends string> = W extends [infer A] ? A & string : W extends [infer A, ...infer R] ? `${A & string}${S}${Join<R, S>}` : "";
1329
- type CapitalizeAll<W> = { [K in keyof W]: CapitalizeWord<W[K] & string>; };
1330
- type CamelWords<W> = W extends [infer F, ...infer R] ? `${F & string}${Join<CapitalizeAll<R>, "">}` : "";
1331
- /** A case that the `toX` functions (e.g. `toSnake`) convert to. */
1332
- type Case = "Camel" | "Pascal" | "Snake" | "Kebab" | "UpperSnake" | "UpperKebab" | "Train" | "Dot" | "Title" | "Sentence" | "PascalSnake" | "Path" | "Space" | "Lower" | "Upper";
1333
- /** The symbols kept by a `keepSymbols` argument: `true` → all, `false` → none, `'$' | '@'` → those. */
1334
- type KeptSymbols<S> = S extends true ? SymbolChar : S extends false ? never : S & string;
1335
- type ConvertKey<K extends string, C extends Case, S extends string> = string extends K ? string : C extends "Camel" ? CamelWords<Words<K, S>> : C extends "Pascal" ? Join<CapitalizeAll<Words<K, S>>, ""> : C extends "Snake" ? Join<Words<K, S>, "_"> : C extends "Kebab" ? Join<Words<K, S>, "-"> : C extends "UpperSnake" ? Uppercase<Join<Words<K, S>, "_">> : C extends "UpperKebab" ? Uppercase<Join<Words<K, S>, "-">> : C extends "Train" ? Join<CapitalizeAll<Words<K, S>>, "-"> : C extends "Dot" ? Join<Words<K, S, false>, "."> : C extends "Title" ? Join<CapitalizeAll<Words<K, S>>, " "> : C extends "Sentence" ? CapitalizeWord<Join<Words<K, S>, " ">> : C extends "PascalSnake" ? Join<CapitalizeAll<Words<K, S>>, "_"> : C extends "Path" ? Join<Words<K, S, false>, "/"> : C extends "Space" ? Join<Words<K, S, false>, " "> : C extends "Lower" ? Join<Words<K, S>, " "> : C extends "Upper" ? Uppercase<Join<Words<K, S>, " ">> : never;
1336
- /**
1337
- * The type returned by a `toX` function: strings stay `string`, and object keys
1338
- * in any case (deeply, including inside arrays) are renamed to the case `C`.
1339
- * `S` is the `keepSymbols` argument (`false` by default).
256
+ * @param options `allowSymbols`: symbols are removed by default; `true` keeps all of them, and an array keeps only some.
257
+ * `transform`: the original case of each word is kept by default; `'lowercase'` or `'uppercase'` changes the case of the whole result.
1340
258
  */
1341
- type CaseResult<T, C extends Case, S = false> = T extends string ? string : T extends Array<unknown> ? { [K in keyof T]: CaseResult<T[K], C, S>; } : T extends object ? Prettify<{ [K in keyof T as boolean extends S ? string : string extends KeptSymbols<S> ? string : ConvertKey<K & string, C, KeptSymbols<S>>]: CaseResult<T[K], C, S>; }> : T;
1342
- //#endregion
1343
- //#region src/anyCase/anyCase.d.ts
259
+ export declare function toDot<T extends object | string, S extends boolean | string = false, X extends Transform | undefined = undefined, I extends string = never>(input: T, options: TransformCaseOptions<S, X, I>): CaseResult<T, "Dot", S, X, "/", I>;
1344
260
  /**
1345
- * Converts a string, or the keys of an object/array (deeply), from any case to camelCase.
261
+ * Converts a string, or the keys of an object/array (deeply), from any case to dot.case, keeping the original case of each word.
1346
262
  *
1347
263
  * @example
1348
264
  * ```ts
1349
- * toCamel('hello_world'); // 'helloWorld'
1350
- * toCamel({ first_name: 'John', userID: 1 }); // { firstName: 'John', userId: 1 }
1351
- * toCamel('$hello-world', true); // '$helloWorld'
265
+ * toDot('HelloWorld'); // 'Hello.World'
266
+ * toDot({ FirstName: 'John', userID: 1 }); // { 'First.Name': 'John', 'user.ID': 1 }
267
+ * toDot('$hello-world', true); // '$hello.world'
1352
268
  * ```
1353
269
  *
1354
- * @param keepSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
270
+ * @param allowSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
1355
271
  * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
1356
272
  */
1357
- export declare function toCamel<T extends object | string, S extends boolean | string = false>(input: T, keepSymbols?: S | readonly S[]): CaseResult<T, "Camel", S>;
273
+ export declare function toDot<T extends object | string, S extends boolean | string = false>(input: T, allowSymbols?: S | readonly S[]): CaseResult<T, "Dot", S>;
1358
274
  /**
1359
- * Converts a string, or the keys of an object/array (deeply), from any case to PascalCase.
275
+ * Converts a string, or the keys of an object/array (deeply), from any case to Title Case.
1360
276
  *
1361
277
  * @example
1362
278
  * ```ts
1363
- * toPascal('hello-world'); // 'HelloWorld'
1364
- * toPascal({ 'first-name': 'John', userID: 1 }); // { FirstName: 'John', UserId: 1 }
1365
- * toPascal('$hello-world', true); // '$HelloWorld'
279
+ * toTitle('hello_world'); // 'Hello World'
280
+ * toTitle({ first_name: 'John', userID: 1 }); // { 'First Name': 'John', 'User Id': 1 }
281
+ * toTitle('$hello-world', true); // '$Hello World'
1366
282
  * ```
1367
283
  *
1368
- * @param keepSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
284
+ * @param allowSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
1369
285
  * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
1370
286
  */
1371
- export declare function toPascal<T extends object | string, S extends boolean | string = false>(input: T, keepSymbols?: S | readonly S[]): CaseResult<T, "Pascal", S>;
287
+ export declare function toTitle<T extends object | string, S extends boolean | string = false>(input: T, allowSymbols?: S | readonly S[]): CaseResult<T, "Title", S>;
1372
288
  /**
1373
- * Converts a string, or the keys of an object/array (deeply), from any case to snake_case.
289
+ * Converts a string, or the keys of an object/array (deeply), from any case to Title Case.
1374
290
  *
1375
291
  * @example
1376
292
  * ```ts
1377
- * toSnake('helloWorld'); // 'hello_world'
1378
- * toSnake({ firstName: 'John', userID: 1 }); // { first_name: 'John', user_id: 1 }
1379
- * toSnake('$hello-world', true); // '$hello_world'
293
+ * toTitle('$hello-world', { allowSymbols: ['$'] }); // '$Hello World'
1380
294
  * ```
1381
295
  *
1382
- * @param keepSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
1383
- * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
296
+ * @param options `allowSymbols`: symbols are removed by default; `true` keeps all of them, and an array keeps only some.
1384
297
  */
1385
- export declare function toSnake<T extends object | string, S extends boolean | string = false>(input: T, keepSymbols?: S | readonly S[]): CaseResult<T, "Snake", S>;
298
+ export declare function toTitle<T extends object | string, S extends boolean | string = false, I extends string = never>(input: T, options: CaseOptions<S, I>): CaseResult<T, "Title", S, undefined, "/", I>;
1386
299
  /**
1387
- * Converts a string, or the keys of an object/array (deeply), from any case to kebab-case.
300
+ * Converts a string, or the keys of an object/array (deeply), from any case to Sentence case.
1388
301
  *
1389
302
  * @example
1390
303
  * ```ts
1391
- * toKebab('HELLO_WORLD'); // 'hello-world'
1392
- * toKebab({ FIRST_NAME: 'John', userID: 1 }); // { 'first-name': 'John', 'user-id': 1 }
1393
- * toKebab('$hello-world', true); // '$hello-world'
304
+ * toSentence('helloWorld'); // 'Hello world'
305
+ * toSentence({ firstName: 'John', userID: 1 }); // { 'First name': 'John', 'User id': 1 }
306
+ * toSentence('$hello-world', true); // '$Hello world'
1394
307
  * ```
1395
308
  *
1396
- * @param keepSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
309
+ * @param allowSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
1397
310
  * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
1398
311
  */
1399
- export declare function toKebab<T extends object | string, S extends boolean | string = false>(input: T, keepSymbols?: S | readonly S[]): CaseResult<T, "Kebab", S>;
312
+ export declare function toSentence<T extends object | string, S extends boolean | string = false>(input: T, allowSymbols?: S | readonly S[]): CaseResult<T, "Sentence", S>;
1400
313
  /**
1401
- * Converts a string, or the keys of an object/array (deeply), from any case to UPPER_SNAKE_CASE.
314
+ * Converts a string, or the keys of an object/array (deeply), from any case to Sentence case.
1402
315
  *
1403
316
  * @example
1404
317
  * ```ts
1405
- * toUpperSnake('hello-world'); // 'HELLO_WORLD'
1406
- * toUpperSnake({ 'first-name': 'John', userID: 1 }); // { FIRST_NAME: 'John', USER_ID: 1 }
1407
- * toUpperSnake('$hello-world', true); // '$HELLO_WORLD'
318
+ * toSentence('$hello-world', { allowSymbols: ['$'] }); // '$Hello world'
1408
319
  * ```
1409
320
  *
1410
- * @param keepSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
1411
- * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
321
+ * @param options `allowSymbols`: symbols are removed by default; `true` keeps all of them, and an array keeps only some.
1412
322
  */
1413
- export declare function toUpperSnake<T extends object | string, S extends boolean | string = false>(input: T, keepSymbols?: S | readonly S[]): CaseResult<T, "UpperSnake", S>;
323
+ export declare function toSentence<T extends object | string, S extends boolean | string = false, I extends string = never>(input: T, options: CaseOptions<S, I>): CaseResult<T, "Sentence", S, undefined, "/", I>;
1414
324
  /**
1415
- * Converts a string, or the keys of an object/array (deeply), from any case to UPPER-KEBAB-CASE.
325
+ * Converts a string, or the keys of an object/array (deeply), from any case to Pascal_Snake_Case (also known as Ada_Case).
1416
326
  *
1417
327
  * @example
1418
328
  * ```ts
1419
- * toUpperKebab('helloWorld'); // 'HELLO-WORLD'
1420
- * toUpperKebab({ firstName: 'John', userID: 1 }); // { 'FIRST-NAME': 'John', 'USER-ID': 1 }
1421
- * toUpperKebab('$hello-world', true); // '$HELLO-WORLD'
329
+ * toPascalSnake('helloWorld'); // 'Hello_World'
330
+ * toPascalSnake({ first_name: 'John', userID: 1 }); // { First_Name: 'John', User_Id: 1 }
331
+ * toPascalSnake('$hello-world', true); // '$Hello_World'
1422
332
  * ```
1423
333
  *
1424
- * @param keepSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
334
+ * @param allowSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
1425
335
  * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
1426
336
  */
1427
- export declare function toUpperKebab<T extends object | string, S extends boolean | string = false>(input: T, keepSymbols?: S | readonly S[]): CaseResult<T, "UpperKebab", S>;
337
+ export declare function toPascalSnake<T extends object | string, S extends boolean | string = false>(input: T, allowSymbols?: S | readonly S[]): CaseResult<T, "PascalSnake", S>;
1428
338
  /**
1429
- * Converts a string, or the keys of an object/array (deeply), from any case to Train-Case.
339
+ * Converts a string, or the keys of an object/array (deeply), from any case to Pascal_Snake_Case (also known as Ada_Case).
1430
340
  *
1431
341
  * @example
1432
342
  * ```ts
1433
- * toTrain('hello_world'); // 'Hello-World'
1434
- * toTrain({ first_name: 'John', userID: 1 }); // { 'First-Name': 'John', 'User-Id': 1 }
1435
- * toTrain('$hello-world', true); // '$Hello-World'
343
+ * toPascalSnake('$hello-world', { allowSymbols: ['$'] }); // '$Hello_World'
1436
344
  * ```
1437
345
  *
1438
- * @param keepSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
1439
- * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
346
+ * @param options `allowSymbols`: symbols are removed by default; `true` keeps all of them, and an array keeps only some.
1440
347
  */
1441
- export declare function toTrain<T extends object | string, S extends boolean | string = false>(input: T, keepSymbols?: S | readonly S[]): CaseResult<T, "Train", S>;
348
+ export declare function toPascalSnake<T extends object | string, S extends boolean | string = false, I extends string = never>(input: T, options: CaseOptions<S, I>): CaseResult<T, "PascalSnake", S, undefined, "/", I>;
1442
349
  /**
1443
- * Converts a string, or the keys of an object/array (deeply), from any case to dot.case, keeping the original case of each word.
350
+ * Converts a string, or the keys of an object/array (deeply), from any case to path/case, keeping the original case of each word.
351
+ * `/` and `\\` in the input also separate words.
1444
352
  *
1445
353
  * @example
1446
354
  * ```ts
1447
- * toDot('HelloWorld'); // 'Hello.World'
1448
- * toDot({ FirstName: 'John', userID: 1 }); // { 'First.Name': 'John', 'user.ID': 1 }
1449
- * toDot('$hello-world', true); // '$hello.world'
355
+ * toPath('$hello-World', { allowSymbols: ['$'] }); // '$hello/World'
356
+ * toPath('helloWorld', { transform: 'lowercase' }); // 'hello/world'
357
+ * toPath('helloWorld', { transform: 'uppercase' }); // 'HELLO/WORLD'
358
+ * toPath('users/profilePicture', { separator: '\\' }); // 'users\\profile\\Picture'
1450
359
  * ```
1451
360
  *
1452
- * @param keepSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
1453
- * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
361
+ * @param options `allowSymbols`: symbols are removed by default; `true` keeps all of them, and an array keeps only some.
362
+ * `transform`: the original case of each word is kept by default; `'lowercase'` or `'uppercase'` changes the case of the whole result.
363
+ * `separator`: `'/'` (the default) or `'\\'`.
1454
364
  */
1455
- export declare function toDot<T extends object | string, S extends boolean | string = false>(input: T, keepSymbols?: S | readonly S[]): CaseResult<T, "Dot", S>;
365
+ export declare function toPath<T extends object | string, S extends boolean | string = false, X extends Transform | undefined = undefined, P extends PathSeparator = "/", I extends string = never>(input: T, options: PathCaseOptions<S, X, P, I>): CaseResult<T, "Path", S, X, P, I>;
1456
366
  /**
1457
- * Converts a string, or the keys of an object/array (deeply), from any case to Title Case.
367
+ * Converts a string, or the keys of an object/array (deeply), from any case to path/case, keeping the original case of each word.
368
+ * `/` and `\\` in the input also separate words.
1458
369
  *
1459
370
  * @example
1460
371
  * ```ts
1461
- * toTitle('hello_world'); // 'Hello World'
1462
- * toTitle({ first_name: 'John', userID: 1 }); // { 'First Name': 'John', 'User Id': 1 }
1463
- * toTitle('$hello-world', true); // '$Hello World'
372
+ * toPath('helloWorld'); // 'hello/World'
373
+ * toPath({ first_name: 'John', userID: 1 }); // { 'first/name': 'John', 'user/ID': 1 }
374
+ * toPath('$hello-world', true); // '$hello/world'
1464
375
  * ```
1465
376
  *
1466
- * @param keepSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
377
+ * @param allowSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
1467
378
  * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
1468
379
  */
1469
- export declare function toTitle<T extends object | string, S extends boolean | string = false>(input: T, keepSymbols?: S | readonly S[]): CaseResult<T, "Title", S>;
380
+ export declare function toPath<T extends object | string, S extends boolean | string = false>(input: T, allowSymbols?: S | readonly S[]): CaseResult<T, "Path", S>;
1470
381
  /**
1471
- * Converts a string, or the keys of an object/array (deeply), from any case to Sentence case.
382
+ * Converts a string, or the keys of an object/array (deeply), from any case to space case, keeping the original case of each word.
1472
383
  *
1473
384
  * @example
1474
385
  * ```ts
1475
- * toSentence('helloWorld'); // 'Hello world'
1476
- * toSentence({ firstName: 'John', userID: 1 }); // { 'First name': 'John', 'User id': 1 }
1477
- * toSentence('$hello-world', true); // '$Hello world'
386
+ * toSpace('helloWorld'); // 'hello World'
387
+ * toSpace({ first_name: 'John', userID: 1 }); // { 'first name': 'John', 'user ID': 1 }
388
+ * toSpace('$hello-world', true); // '$hello world'
1478
389
  * ```
1479
390
  *
1480
- * @param keepSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
391
+ * @param allowSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
1481
392
  * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
1482
393
  */
1483
- export declare function toSentence<T extends object | string, S extends boolean | string = false>(input: T, keepSymbols?: S | readonly S[]): CaseResult<T, "Sentence", S>;
394
+ export declare function toSpace<T extends object | string, S extends boolean | string = false>(input: T, allowSymbols?: S | readonly S[]): CaseResult<T, "Space", S>;
1484
395
  /**
1485
- * Converts a string, or the keys of an object/array (deeply), from any case to Pascal_Snake_Case (also known as Ada_Case).
396
+ * Converts a string, or the keys of an object/array (deeply), from any case to space case, keeping the original case of each word.
1486
397
  *
1487
398
  * @example
1488
399
  * ```ts
1489
- * toPascalSnake('helloWorld'); // 'Hello_World'
1490
- * toPascalSnake({ first_name: 'John', userID: 1 }); // { First_Name: 'John', User_Id: 1 }
1491
- * toPascalSnake('$hello-world', true); // '$Hello_World'
400
+ * toSpace('$hello-world', { allowSymbols: ['$'] }); // '$hello world'
1492
401
  * ```
1493
402
  *
1494
- * @param keepSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
1495
- * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
403
+ * @param options `allowSymbols`: symbols are removed by default; `true` keeps all of them, and an array keeps only some.
1496
404
  */
1497
- export declare function toPascalSnake<T extends object | string, S extends boolean | string = false>(input: T, keepSymbols?: S | readonly S[]): CaseResult<T, "PascalSnake", S>;
405
+ export declare function toSpace<T extends object | string, S extends boolean | string = false, I extends string = never>(input: T, options: CaseOptions<S, I>): CaseResult<T, "Space", S, undefined, "/", I>;
1498
406
  /**
1499
- * Converts a string, or the keys of an object/array (deeply), from any case to path/case, keeping the original case of each word.
407
+ * Converts a string, or the keys of an object/array (deeply), from any case to lower case (space separated).
1500
408
  *
1501
409
  * @example
1502
410
  * ```ts
1503
- * toPath('helloWorld'); // 'hello/World'
1504
- * toPath({ first_name: 'John', userID: 1 }); // { 'first/name': 'John', 'user/ID': 1 }
1505
- * toPath('$hello-world', true); // '$hello/world'
411
+ * toLower('helloWorld'); // 'hello world'
412
+ * toLower({ first_name: 'John', userID: 1 }); // { 'first name': 'John', 'user id': 1 }
413
+ * toLower('$hello-world', true); // '$hello world'
1506
414
  * ```
1507
415
  *
1508
- * @param keepSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
416
+ * @param allowSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
1509
417
  * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
1510
418
  */
1511
- export declare function toPath<T extends object | string, S extends boolean | string = false>(input: T, keepSymbols?: S | readonly S[]): CaseResult<T, "Path", S>;
419
+ export declare function toLower<T extends object | string, S extends boolean | string = false>(input: T, allowSymbols?: S | readonly S[]): CaseResult<T, "Lower", S>;
1512
420
  /**
1513
- * Converts a string, or the keys of an object/array (deeply), from any case to space case, keeping the original case of each word.
421
+ * Converts a string, or the keys of an object/array (deeply), from any case to lower case (space separated).
1514
422
  *
1515
423
  * @example
1516
424
  * ```ts
1517
- * toSpace('helloWorld'); // 'hello World'
1518
- * toSpace({ first_name: 'John', userID: 1 }); // { 'first name': 'John', 'user ID': 1 }
1519
- * toSpace('$hello-world', true); // '$hello world'
425
+ * toLower('$hello-world', { allowSymbols: ['$'] }); // '$hello world'
1520
426
  * ```
1521
427
  *
1522
- * @param keepSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
1523
- * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
428
+ * @param options `allowSymbols`: symbols are removed by default; `true` keeps all of them, and an array keeps only some.
1524
429
  */
1525
- export declare function toSpace<T extends object | string, S extends boolean | string = false>(input: T, keepSymbols?: S | readonly S[]): CaseResult<T, "Space", S>;
430
+ export declare function toLower<T extends object | string, S extends boolean | string = false, I extends string = never>(input: T, options: CaseOptions<S, I>): CaseResult<T, "Lower", S, undefined, "/", I>;
1526
431
  /**
1527
- * Converts a string, or the keys of an object/array (deeply), from any case to lower case (space separated).
432
+ * Converts a string, or the keys of an object/array (deeply), from any case to UPPER CASE (space separated).
1528
433
  *
1529
434
  * @example
1530
435
  * ```ts
1531
- * toLower('helloWorld'); // 'hello world'
1532
- * toLower({ first_name: 'John', userID: 1 }); // { 'first name': 'John', 'user id': 1 }
1533
- * toLower('$hello-world', true); // '$hello world'
436
+ * toUpper('helloWorld'); // 'HELLO WORLD'
437
+ * toUpper({ first_name: 'John', userID: 1 }); // { 'FIRST NAME': 'John', 'USER ID': 1 }
438
+ * toUpper('$hello-world', true); // '$HELLO WORLD'
1534
439
  * ```
1535
440
  *
1536
- * @param keepSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
441
+ * @param allowSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
1537
442
  * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
1538
443
  */
1539
- export declare function toLower<T extends object | string, S extends boolean | string = false>(input: T, keepSymbols?: S | readonly S[]): CaseResult<T, "Lower", S>;
444
+ export declare function toUpper<T extends object | string, S extends boolean | string = false>(input: T, allowSymbols?: S | readonly S[]): CaseResult<T, "Upper", S>;
1540
445
  /**
1541
446
  * Converts a string, or the keys of an object/array (deeply), from any case to UPPER CASE (space separated).
1542
447
  *
1543
448
  * @example
1544
449
  * ```ts
1545
- * toUpper('helloWorld'); // 'HELLO WORLD'
1546
- * toUpper({ first_name: 'John', userID: 1 }); // { 'FIRST NAME': 'John', 'USER ID': 1 }
1547
- * toUpper('$hello-world', true); // '$HELLO WORLD'
450
+ * toUpper('$hello-world', { allowSymbols: ['$'] }); // '$HELLO WORLD'
1548
451
  * ```
1549
452
  *
1550
- * @param keepSymbols Symbols (ASCII punctuation, like `$` or `@`) are removed by default.
1551
- * Pass `true` to keep all of them, or an array to keep only some (e.g. `['$']`).
453
+ * @param options `allowSymbols`: symbols are removed by default; `true` keeps all of them, and an array keeps only some.
1552
454
  */
1553
- export declare function toUpper<T extends object | string, S extends boolean | string = false>(input: T, keepSymbols?: S | readonly S[]): CaseResult<T, "Upper", S>;
455
+ export declare function toUpper<T extends object | string, S extends boolean | string = false, I extends string = never>(input: T, options: CaseOptions<S, I>): CaseResult<T, "Upper", S, undefined, "/", I>;
1554
456
  //#endregion
1555
- export type { Case, CaseResult, KeepSymbols, ParserType, Prettify, Result };
457
+ export type { AllowSymbols, Case, CaseOptions, CaseResult, PathCaseOptions, PathSeparator, Transform, TransformCaseOptions };