caseparser 4.1.0 → 4.2.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/README.md +17 -12
- package/dist/index.cjs +515 -1
- package/dist/index.d.cts +392 -10
- package/dist/index.d.ts +392 -10
- package/dist/index.js +482 -2
- package/package.json +6 -2
package/dist/index.d.cts
CHANGED
|
@@ -55,23 +55,61 @@ type DotToSnake<T extends string> = DashToSnake<DotToDash<T>>;
|
|
|
55
55
|
type DotToTrain<T extends string> = DashToTrain<DotToDash<T>>;
|
|
56
56
|
type DotToUpperDash<T extends string> = Uppercase<DotToDash<T>>;
|
|
57
57
|
type DotToUpperSnake<T extends string> = DashToUpperSnake<DotToDash<T>>;
|
|
58
|
-
type
|
|
59
|
-
type
|
|
60
|
-
type
|
|
61
|
-
type
|
|
62
|
-
type
|
|
63
|
-
type
|
|
64
|
-
type
|
|
65
|
-
type
|
|
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";
|
|
66
104
|
/** Identifies a conversion, e.g. `'CamelToSnake'`. */
|
|
67
|
-
type ParserType = ParserCamelType | ParserDashType | ParserPascalType | ParserSnakeType | ParserUpperDashType | ParserUpperSnakeType | ParserTrainType | ParserDotType;
|
|
105
|
+
type ParserType = ParserCamelType | ParserDashType | ParserPascalType | ParserSnakeType | ParserUpperDashType | ParserUpperSnakeType | ParserTrainType | ParserDotType | ParserTitleType | ParserSentenceType;
|
|
68
106
|
/** Flattens an intersection/mapped type so editors show the resulting keys. */
|
|
69
107
|
type Prettify<T> = { [K in keyof T]: T[K]; } & {};
|
|
70
108
|
/**
|
|
71
109
|
* The type returned by a conversion: strings stay `string`, and object keys
|
|
72
110
|
* (deeply, including inside arrays) are renamed according to the conversion `P`.
|
|
73
111
|
*/
|
|
74
|
-
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> : never]: Result<T[K], P>; }> : T;
|
|
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;
|
|
75
113
|
//#endregion
|
|
76
114
|
//#region src/camelCase/camelCase.d.ts
|
|
77
115
|
/**
|
|
@@ -144,6 +182,26 @@ export declare function camelToTrain<T extends object | string>(input: T): Resul
|
|
|
144
182
|
* ```
|
|
145
183
|
*/
|
|
146
184
|
export declare function camelToDot<T extends object | string>(input: T): Result<T, "CamelToDot">;
|
|
185
|
+
/**
|
|
186
|
+
* Converts a string, or the keys of an object/array (deeply), from camelCase to Title Case.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```ts
|
|
190
|
+
* camelToTitle('helloWorld'); // 'Hello World'
|
|
191
|
+
* camelToTitle({ firstName: 'John' }); // { 'First Name': 'John' }
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
export declare function camelToTitle<T extends object | string>(input: T): Result<T, "CamelToTitle">;
|
|
195
|
+
/**
|
|
196
|
+
* Converts a string, or the keys of an object/array (deeply), from camelCase to Sentence case.
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```ts
|
|
200
|
+
* camelToSentence('helloWorld'); // 'Hello world'
|
|
201
|
+
* camelToSentence({ firstName: 'John' }); // { 'First name': 'John' }
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
export declare function camelToSentence<T extends object | string>(input: T): Result<T, "CamelToSentence">;
|
|
147
205
|
//#endregion
|
|
148
206
|
//#region src/dashCase/dashCase.d.ts
|
|
149
207
|
/**
|
|
@@ -216,6 +274,26 @@ export declare function dashToTrain<T extends object | string>(input: T): Result
|
|
|
216
274
|
* ```
|
|
217
275
|
*/
|
|
218
276
|
export declare function dashToDot<T extends object | string>(input: T): Result<T, "DashToDot">;
|
|
277
|
+
/**
|
|
278
|
+
* Converts a string, or the keys of an object/array (deeply), from dash-case to Title Case.
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* ```ts
|
|
282
|
+
* dashToTitle('hello-world'); // 'Hello World'
|
|
283
|
+
* dashToTitle({ 'first-name': 'John' }); // { 'First Name': 'John' }
|
|
284
|
+
* ```
|
|
285
|
+
*/
|
|
286
|
+
export declare function dashToTitle<T extends object | string>(input: T): Result<T, "DashToTitle">;
|
|
287
|
+
/**
|
|
288
|
+
* Converts a string, or the keys of an object/array (deeply), from dash-case to Sentence case.
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* ```ts
|
|
292
|
+
* dashToSentence('hello-world'); // 'Hello world'
|
|
293
|
+
* dashToSentence({ 'first-name': 'John' }); // { 'First name': 'John' }
|
|
294
|
+
* ```
|
|
295
|
+
*/
|
|
296
|
+
export declare function dashToSentence<T extends object | string>(input: T): Result<T, "DashToSentence">;
|
|
219
297
|
//#endregion
|
|
220
298
|
//#region src/pascalCase/pascalCase.d.ts
|
|
221
299
|
/**
|
|
@@ -288,6 +366,26 @@ export declare function pascalToTrain<T extends object | string>(input: T): Resu
|
|
|
288
366
|
* ```
|
|
289
367
|
*/
|
|
290
368
|
export declare function pascalToDot<T extends object | string>(input: T): Result<T, "PascalToDot">;
|
|
369
|
+
/**
|
|
370
|
+
* Converts a string, or the keys of an object/array (deeply), from PascalCase to Title Case.
|
|
371
|
+
*
|
|
372
|
+
* @example
|
|
373
|
+
* ```ts
|
|
374
|
+
* pascalToTitle('HelloWorld'); // 'Hello World'
|
|
375
|
+
* pascalToTitle({ FirstName: 'John' }); // { 'First Name': 'John' }
|
|
376
|
+
* ```
|
|
377
|
+
*/
|
|
378
|
+
export declare function pascalToTitle<T extends object | string>(input: T): Result<T, "PascalToTitle">;
|
|
379
|
+
/**
|
|
380
|
+
* Converts a string, or the keys of an object/array (deeply), from PascalCase to Sentence case.
|
|
381
|
+
*
|
|
382
|
+
* @example
|
|
383
|
+
* ```ts
|
|
384
|
+
* pascalToSentence('HelloWorld'); // 'Hello world'
|
|
385
|
+
* pascalToSentence({ FirstName: 'John' }); // { 'First name': 'John' }
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
export declare function pascalToSentence<T extends object | string>(input: T): Result<T, "PascalToSentence">;
|
|
291
389
|
//#endregion
|
|
292
390
|
//#region src/snakeCase/snakeCase.d.ts
|
|
293
391
|
/**
|
|
@@ -360,6 +458,26 @@ export declare function snakeToTrain<T extends object | string>(input: T): Resul
|
|
|
360
458
|
* ```
|
|
361
459
|
*/
|
|
362
460
|
export declare function snakeToDot<T extends object | string>(input: T): Result<T, "SnakeToDot">;
|
|
461
|
+
/**
|
|
462
|
+
* Converts a string, or the keys of an object/array (deeply), from snake_case to Title Case.
|
|
463
|
+
*
|
|
464
|
+
* @example
|
|
465
|
+
* ```ts
|
|
466
|
+
* snakeToTitle('hello_world'); // 'Hello World'
|
|
467
|
+
* snakeToTitle({ first_name: 'John' }); // { 'First Name': 'John' }
|
|
468
|
+
* ```
|
|
469
|
+
*/
|
|
470
|
+
export declare function snakeToTitle<T extends object | string>(input: T): Result<T, "SnakeToTitle">;
|
|
471
|
+
/**
|
|
472
|
+
* Converts a string, or the keys of an object/array (deeply), from snake_case to Sentence case.
|
|
473
|
+
*
|
|
474
|
+
* @example
|
|
475
|
+
* ```ts
|
|
476
|
+
* snakeToSentence('hello_world'); // 'Hello world'
|
|
477
|
+
* snakeToSentence({ first_name: 'John' }); // { 'First name': 'John' }
|
|
478
|
+
* ```
|
|
479
|
+
*/
|
|
480
|
+
export declare function snakeToSentence<T extends object | string>(input: T): Result<T, "SnakeToSentence">;
|
|
363
481
|
//#endregion
|
|
364
482
|
//#region src/trainCase/trainCase.d.ts
|
|
365
483
|
/**
|
|
@@ -432,6 +550,26 @@ export declare function trainToUpperDash<T extends object | string>(input: T): R
|
|
|
432
550
|
* ```
|
|
433
551
|
*/
|
|
434
552
|
export declare function trainToDot<T extends object | string>(input: T): Result<T, "TrainToDot">;
|
|
553
|
+
/**
|
|
554
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to Title Case.
|
|
555
|
+
*
|
|
556
|
+
* @example
|
|
557
|
+
* ```ts
|
|
558
|
+
* trainToTitle('Hello-World'); // 'Hello World'
|
|
559
|
+
* trainToTitle({ 'First-Name': 'John' }); // { 'First Name': 'John' }
|
|
560
|
+
* ```
|
|
561
|
+
*/
|
|
562
|
+
export declare function trainToTitle<T extends object | string>(input: T): Result<T, "TrainToTitle">;
|
|
563
|
+
/**
|
|
564
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to Sentence case.
|
|
565
|
+
*
|
|
566
|
+
* @example
|
|
567
|
+
* ```ts
|
|
568
|
+
* trainToSentence('Hello-World'); // 'Hello world'
|
|
569
|
+
* trainToSentence({ 'First-Name': 'John' }); // { 'First name': 'John' }
|
|
570
|
+
* ```
|
|
571
|
+
*/
|
|
572
|
+
export declare function trainToSentence<T extends object | string>(input: T): Result<T, "TrainToSentence">;
|
|
435
573
|
//#endregion
|
|
436
574
|
//#region src/dotCase/dotCase.d.ts
|
|
437
575
|
/**
|
|
@@ -504,6 +642,210 @@ export declare function dotToUpperDash<T extends object | string>(input: T): Res
|
|
|
504
642
|
* ```
|
|
505
643
|
*/
|
|
506
644
|
export declare function dotToTrain<T extends object | string>(input: T): Result<T, "DotToTrain">;
|
|
645
|
+
/**
|
|
646
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to Title Case.
|
|
647
|
+
*
|
|
648
|
+
* @example
|
|
649
|
+
* ```ts
|
|
650
|
+
* dotToTitle('hello.world'); // 'Hello World'
|
|
651
|
+
* dotToTitle({ 'first.name': 'John' }); // { 'First Name': 'John' }
|
|
652
|
+
* ```
|
|
653
|
+
*/
|
|
654
|
+
export declare function dotToTitle<T extends object | string>(input: T): Result<T, "DotToTitle">;
|
|
655
|
+
/**
|
|
656
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to Sentence case.
|
|
657
|
+
*
|
|
658
|
+
* @example
|
|
659
|
+
* ```ts
|
|
660
|
+
* dotToSentence('hello.world'); // 'Hello world'
|
|
661
|
+
* dotToSentence({ 'first.name': 'John' }); // { 'First name': 'John' }
|
|
662
|
+
* ```
|
|
663
|
+
*/
|
|
664
|
+
export declare function dotToSentence<T extends object | string>(input: T): Result<T, "DotToSentence">;
|
|
665
|
+
//#endregion
|
|
666
|
+
//#region src/titleCase/titleCase.d.ts
|
|
667
|
+
/**
|
|
668
|
+
* Converts a string, or the keys of an object/array (deeply), from Title Case to camelCase.
|
|
669
|
+
*
|
|
670
|
+
* @example
|
|
671
|
+
* ```ts
|
|
672
|
+
* titleToCamel('Hello World'); // 'helloWorld'
|
|
673
|
+
* titleToCamel({ 'First Name': 'John' }); // { firstName: 'John' }
|
|
674
|
+
* ```
|
|
675
|
+
*/
|
|
676
|
+
export declare function titleToCamel<T extends object | string>(input: T): Result<T, "TitleToCamel">;
|
|
677
|
+
/**
|
|
678
|
+
* Converts a string, or the keys of an object/array (deeply), from Title Case to PascalCase.
|
|
679
|
+
*
|
|
680
|
+
* @example
|
|
681
|
+
* ```ts
|
|
682
|
+
* titleToPascal('Hello World'); // 'HelloWorld'
|
|
683
|
+
* titleToPascal({ 'First Name': 'John' }); // { FirstName: 'John' }
|
|
684
|
+
* ```
|
|
685
|
+
*/
|
|
686
|
+
export declare function titleToPascal<T extends object | string>(input: T): Result<T, "TitleToPascal">;
|
|
687
|
+
/**
|
|
688
|
+
* Converts a string, or the keys of an object/array (deeply), from Title Case to snake_case.
|
|
689
|
+
*
|
|
690
|
+
* @example
|
|
691
|
+
* ```ts
|
|
692
|
+
* titleToSnake('Hello World'); // 'hello_world'
|
|
693
|
+
* titleToSnake({ 'First Name': 'John' }); // { first_name: 'John' }
|
|
694
|
+
* ```
|
|
695
|
+
*/
|
|
696
|
+
export declare function titleToSnake<T extends object | string>(input: T): Result<T, "TitleToSnake">;
|
|
697
|
+
/**
|
|
698
|
+
* Converts a string, or the keys of an object/array (deeply), from Title Case to dash-case.
|
|
699
|
+
*
|
|
700
|
+
* @example
|
|
701
|
+
* ```ts
|
|
702
|
+
* titleToDash('Hello World'); // 'hello-world'
|
|
703
|
+
* titleToDash({ 'First Name': 'John' }); // { 'first-name': 'John' }
|
|
704
|
+
* ```
|
|
705
|
+
*/
|
|
706
|
+
export declare function titleToDash<T extends object | string>(input: T): Result<T, "TitleToDash">;
|
|
707
|
+
/**
|
|
708
|
+
* Converts a string, or the keys of an object/array (deeply), from Title Case to UPPER_SNAKE_CASE.
|
|
709
|
+
*
|
|
710
|
+
* @example
|
|
711
|
+
* ```ts
|
|
712
|
+
* titleToUpperSnake('Hello World'); // 'HELLO_WORLD'
|
|
713
|
+
* titleToUpperSnake({ 'First Name': 'John' }); // { FIRST_NAME: 'John' }
|
|
714
|
+
* ```
|
|
715
|
+
*/
|
|
716
|
+
export declare function titleToUpperSnake<T extends object | string>(input: T): Result<T, "TitleToUpperSnake">;
|
|
717
|
+
/**
|
|
718
|
+
* Converts a string, or the keys of an object/array (deeply), from Title Case to UPPER-DASH-CASE.
|
|
719
|
+
*
|
|
720
|
+
* @example
|
|
721
|
+
* ```ts
|
|
722
|
+
* titleToUpperDash('Hello World'); // 'HELLO-WORLD'
|
|
723
|
+
* titleToUpperDash({ 'First Name': 'John' }); // { 'FIRST-NAME': 'John' }
|
|
724
|
+
* ```
|
|
725
|
+
*/
|
|
726
|
+
export declare function titleToUpperDash<T extends object | string>(input: T): Result<T, "TitleToUpperDash">;
|
|
727
|
+
/**
|
|
728
|
+
* Converts a string, or the keys of an object/array (deeply), from Title Case to Train-Case.
|
|
729
|
+
*
|
|
730
|
+
* @example
|
|
731
|
+
* ```ts
|
|
732
|
+
* titleToTrain('Hello World'); // 'Hello-World'
|
|
733
|
+
* titleToTrain({ 'First Name': 'John' }); // { 'First-Name': 'John' }
|
|
734
|
+
* ```
|
|
735
|
+
*/
|
|
736
|
+
export declare function titleToTrain<T extends object | string>(input: T): Result<T, "TitleToTrain">;
|
|
737
|
+
/**
|
|
738
|
+
* Converts a string, or the keys of an object/array (deeply), from Title Case to dot.case.
|
|
739
|
+
*
|
|
740
|
+
* @example
|
|
741
|
+
* ```ts
|
|
742
|
+
* titleToDot('Hello World'); // 'hello.world'
|
|
743
|
+
* titleToDot({ 'First Name': 'John' }); // { 'first.name': 'John' }
|
|
744
|
+
* ```
|
|
745
|
+
*/
|
|
746
|
+
export declare function titleToDot<T extends object | string>(input: T): Result<T, "TitleToDot">;
|
|
747
|
+
/**
|
|
748
|
+
* Converts a string, or the keys of an object/array (deeply), from Title Case to Sentence case.
|
|
749
|
+
*
|
|
750
|
+
* @example
|
|
751
|
+
* ```ts
|
|
752
|
+
* titleToSentence('Hello World'); // 'Hello world'
|
|
753
|
+
* titleToSentence({ 'First Name': 'John' }); // { 'First name': 'John' }
|
|
754
|
+
* ```
|
|
755
|
+
*/
|
|
756
|
+
export declare function titleToSentence<T extends object | string>(input: T): Result<T, "TitleToSentence">;
|
|
757
|
+
//#endregion
|
|
758
|
+
//#region src/sentenceCase/sentenceCase.d.ts
|
|
759
|
+
/**
|
|
760
|
+
* Converts a string, or the keys of an object/array (deeply), from Sentence case to camelCase.
|
|
761
|
+
*
|
|
762
|
+
* @example
|
|
763
|
+
* ```ts
|
|
764
|
+
* sentenceToCamel('Hello world'); // 'helloWorld'
|
|
765
|
+
* sentenceToCamel({ 'First name': 'John' }); // { firstName: 'John' }
|
|
766
|
+
* ```
|
|
767
|
+
*/
|
|
768
|
+
export declare function sentenceToCamel<T extends object | string>(input: T): Result<T, "SentenceToCamel">;
|
|
769
|
+
/**
|
|
770
|
+
* Converts a string, or the keys of an object/array (deeply), from Sentence case to PascalCase.
|
|
771
|
+
*
|
|
772
|
+
* @example
|
|
773
|
+
* ```ts
|
|
774
|
+
* sentenceToPascal('Hello world'); // 'HelloWorld'
|
|
775
|
+
* sentenceToPascal({ 'First name': 'John' }); // { FirstName: 'John' }
|
|
776
|
+
* ```
|
|
777
|
+
*/
|
|
778
|
+
export declare function sentenceToPascal<T extends object | string>(input: T): Result<T, "SentenceToPascal">;
|
|
779
|
+
/**
|
|
780
|
+
* Converts a string, or the keys of an object/array (deeply), from Sentence case to snake_case.
|
|
781
|
+
*
|
|
782
|
+
* @example
|
|
783
|
+
* ```ts
|
|
784
|
+
* sentenceToSnake('Hello world'); // 'hello_world'
|
|
785
|
+
* sentenceToSnake({ 'First name': 'John' }); // { first_name: 'John' }
|
|
786
|
+
* ```
|
|
787
|
+
*/
|
|
788
|
+
export declare function sentenceToSnake<T extends object | string>(input: T): Result<T, "SentenceToSnake">;
|
|
789
|
+
/**
|
|
790
|
+
* Converts a string, or the keys of an object/array (deeply), from Sentence case to dash-case.
|
|
791
|
+
*
|
|
792
|
+
* @example
|
|
793
|
+
* ```ts
|
|
794
|
+
* sentenceToDash('Hello world'); // 'hello-world'
|
|
795
|
+
* sentenceToDash({ 'First name': 'John' }); // { 'first-name': 'John' }
|
|
796
|
+
* ```
|
|
797
|
+
*/
|
|
798
|
+
export declare function sentenceToDash<T extends object | string>(input: T): Result<T, "SentenceToDash">;
|
|
799
|
+
/**
|
|
800
|
+
* Converts a string, or the keys of an object/array (deeply), from Sentence case to UPPER_SNAKE_CASE.
|
|
801
|
+
*
|
|
802
|
+
* @example
|
|
803
|
+
* ```ts
|
|
804
|
+
* sentenceToUpperSnake('Hello world'); // 'HELLO_WORLD'
|
|
805
|
+
* sentenceToUpperSnake({ 'First name': 'John' }); // { FIRST_NAME: 'John' }
|
|
806
|
+
* ```
|
|
807
|
+
*/
|
|
808
|
+
export declare function sentenceToUpperSnake<T extends object | string>(input: T): Result<T, "SentenceToUpperSnake">;
|
|
809
|
+
/**
|
|
810
|
+
* Converts a string, or the keys of an object/array (deeply), from Sentence case to UPPER-DASH-CASE.
|
|
811
|
+
*
|
|
812
|
+
* @example
|
|
813
|
+
* ```ts
|
|
814
|
+
* sentenceToUpperDash('Hello world'); // 'HELLO-WORLD'
|
|
815
|
+
* sentenceToUpperDash({ 'First name': 'John' }); // { 'FIRST-NAME': 'John' }
|
|
816
|
+
* ```
|
|
817
|
+
*/
|
|
818
|
+
export declare function sentenceToUpperDash<T extends object | string>(input: T): Result<T, "SentenceToUpperDash">;
|
|
819
|
+
/**
|
|
820
|
+
* Converts a string, or the keys of an object/array (deeply), from Sentence case to Train-Case.
|
|
821
|
+
*
|
|
822
|
+
* @example
|
|
823
|
+
* ```ts
|
|
824
|
+
* sentenceToTrain('Hello world'); // 'Hello-World'
|
|
825
|
+
* sentenceToTrain({ 'First name': 'John' }); // { 'First-Name': 'John' }
|
|
826
|
+
* ```
|
|
827
|
+
*/
|
|
828
|
+
export declare function sentenceToTrain<T extends object | string>(input: T): Result<T, "SentenceToTrain">;
|
|
829
|
+
/**
|
|
830
|
+
* Converts a string, or the keys of an object/array (deeply), from Sentence case to dot.case.
|
|
831
|
+
*
|
|
832
|
+
* @example
|
|
833
|
+
* ```ts
|
|
834
|
+
* sentenceToDot('Hello world'); // 'hello.world'
|
|
835
|
+
* sentenceToDot({ 'First name': 'John' }); // { 'first.name': 'John' }
|
|
836
|
+
* ```
|
|
837
|
+
*/
|
|
838
|
+
export declare function sentenceToDot<T extends object | string>(input: T): Result<T, "SentenceToDot">;
|
|
839
|
+
/**
|
|
840
|
+
* Converts a string, or the keys of an object/array (deeply), from Sentence case to Title Case.
|
|
841
|
+
*
|
|
842
|
+
* @example
|
|
843
|
+
* ```ts
|
|
844
|
+
* sentenceToTitle('Hello world'); // 'Hello World'
|
|
845
|
+
* sentenceToTitle({ 'First name': 'John' }); // { 'First Name': 'John' }
|
|
846
|
+
* ```
|
|
847
|
+
*/
|
|
848
|
+
export declare function sentenceToTitle<T extends object | string>(input: T): Result<T, "SentenceToTitle">;
|
|
507
849
|
//#endregion
|
|
508
850
|
//#region src/upperDashCase/upperDashCase.d.ts
|
|
509
851
|
/**
|
|
@@ -576,6 +918,26 @@ export declare function upperDashToTrain<T extends object | string>(input: T): R
|
|
|
576
918
|
* ```
|
|
577
919
|
*/
|
|
578
920
|
export declare function upperDashToDot<T extends object | string>(input: T): Result<T, "UpperDashToDot">;
|
|
921
|
+
/**
|
|
922
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to Title Case.
|
|
923
|
+
*
|
|
924
|
+
* @example
|
|
925
|
+
* ```ts
|
|
926
|
+
* upperDashToTitle('HELLO-WORLD'); // 'Hello World'
|
|
927
|
+
* upperDashToTitle({ 'FIRST-NAME': 'John' }); // { 'First Name': 'John' }
|
|
928
|
+
* ```
|
|
929
|
+
*/
|
|
930
|
+
export declare function upperDashToTitle<T extends object | string>(input: T): Result<T, "UpperDashToTitle">;
|
|
931
|
+
/**
|
|
932
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to Sentence case.
|
|
933
|
+
*
|
|
934
|
+
* @example
|
|
935
|
+
* ```ts
|
|
936
|
+
* upperDashToSentence('HELLO-WORLD'); // 'Hello world'
|
|
937
|
+
* upperDashToSentence({ 'FIRST-NAME': 'John' }); // { 'First name': 'John' }
|
|
938
|
+
* ```
|
|
939
|
+
*/
|
|
940
|
+
export declare function upperDashToSentence<T extends object | string>(input: T): Result<T, "UpperDashToSentence">;
|
|
579
941
|
//#endregion
|
|
580
942
|
//#region src/upperSnakeCase/upperSnakeCase.d.ts
|
|
581
943
|
/**
|
|
@@ -648,5 +1010,25 @@ export declare function upperSnakeToTrain<T extends object | string>(input: T):
|
|
|
648
1010
|
* ```
|
|
649
1011
|
*/
|
|
650
1012
|
export declare function upperSnakeToDot<T extends object | string>(input: T): Result<T, "UpperSnakeToDot">;
|
|
1013
|
+
/**
|
|
1014
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to Title Case.
|
|
1015
|
+
*
|
|
1016
|
+
* @example
|
|
1017
|
+
* ```ts
|
|
1018
|
+
* upperSnakeToTitle('HELLO_WORLD'); // 'Hello World'
|
|
1019
|
+
* upperSnakeToTitle({ FIRST_NAME: 'John' }); // { 'First Name': 'John' }
|
|
1020
|
+
* ```
|
|
1021
|
+
*/
|
|
1022
|
+
export declare function upperSnakeToTitle<T extends object | string>(input: T): Result<T, "UpperSnakeToTitle">;
|
|
1023
|
+
/**
|
|
1024
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to Sentence case.
|
|
1025
|
+
*
|
|
1026
|
+
* @example
|
|
1027
|
+
* ```ts
|
|
1028
|
+
* upperSnakeToSentence('HELLO_WORLD'); // 'Hello world'
|
|
1029
|
+
* upperSnakeToSentence({ FIRST_NAME: 'John' }); // { 'First name': 'John' }
|
|
1030
|
+
* ```
|
|
1031
|
+
*/
|
|
1032
|
+
export declare function upperSnakeToSentence<T extends object | string>(input: T): Result<T, "UpperSnakeToSentence">;
|
|
651
1033
|
//#endregion
|
|
652
1034
|
export type { ParserType, Prettify, Result };
|