caseparser 4.0.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 +75 -142
- package/dist/index.cjs +909 -1
- package/dist/index.d.cts +682 -8
- package/dist/index.d.ts +682 -8
- package/dist/index.js +850 -2
- package/package.json +19 -7
package/dist/index.d.cts
CHANGED
|
@@ -4,46 +4,112 @@ type CamelToPascal<T extends string> = Capitalize<T>;
|
|
|
4
4
|
type CamelToSnake<T extends string> = T extends `${infer L}${infer R}` ? `${L extends Capitalize<L> ? "_" : ""}${Lowercase<L>}${CamelToSnake<R>}` : T;
|
|
5
5
|
type CamelToUpperDash<T extends string> = Uppercase<CamelToDash<T>>;
|
|
6
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>>;
|
|
7
9
|
type DashToCamel<T extends string> = T extends `${infer L}-${infer R}` ? `${L}${Capitalize<DashToCamel<R>>}` : T;
|
|
8
10
|
type DashToPascal<T extends string> = Capitalize<DashToCamel<T>>;
|
|
9
11
|
type DashToSnake<T extends string> = T extends `${infer L}-${infer R}` ? `${L}_${DashToSnake<R>}` : T;
|
|
10
12
|
type DashToUpperDash<T extends string> = Uppercase<T>;
|
|
11
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;
|
|
12
16
|
type PascalToCamel<T extends string> = Uncapitalize<T>;
|
|
13
17
|
type PascalToDash<T extends string> = CamelToDash<Uncapitalize<T>>;
|
|
14
18
|
type PascalToSnake<T extends string> = CamelToSnake<Uncapitalize<T>>;
|
|
15
19
|
type PascalToUpperDash<T extends string> = Uppercase<PascalToDash<T>>;
|
|
16
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>>;
|
|
17
23
|
type SnakeToCamel<T extends string> = T extends `${infer L}_${infer R}` ? `${L}${Capitalize<SnakeToCamel<R>>}` : T;
|
|
18
24
|
type SnakeToDash<T extends string> = T extends `${infer L}_${infer R}` ? `${L}-${SnakeToDash<R>}` : T;
|
|
19
25
|
type SnakeToPascal<T extends string> = Capitalize<SnakeToCamel<T>>;
|
|
20
26
|
type SnakeToUpperDash<T extends string> = Uppercase<SnakeToDash<T>>;
|
|
21
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>>;
|
|
22
30
|
type UpperDashToCamel<T extends string> = DashToCamel<Lowercase<T>>;
|
|
23
31
|
type UpperDashToDash<T extends string> = Lowercase<T>;
|
|
24
32
|
type UpperDashToPascal<T extends string> = Capitalize<UpperDashToCamel<T>>;
|
|
25
33
|
type UpperDashToSnake<T extends string> = DashToSnake<UpperDashToDash<T>>;
|
|
26
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>>;
|
|
27
37
|
type UpperSnakeToCamel<T extends string> = SnakeToCamel<Lowercase<T>>;
|
|
28
38
|
type UpperSnakeToDash<T extends string> = SnakeToDash<Lowercase<T>>;
|
|
29
39
|
type UpperSnakeToPascal<T extends string> = SnakeToPascal<Lowercase<T>>;
|
|
30
40
|
type UpperSnakeToSnake<T extends string> = Lowercase<T>;
|
|
31
41
|
type UpperSnakeToUpperDash<T extends string> = Uppercase<UpperSnakeToDash<T>>;
|
|
32
|
-
type
|
|
33
|
-
type
|
|
34
|
-
type
|
|
35
|
-
type
|
|
36
|
-
type
|
|
37
|
-
type
|
|
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";
|
|
38
104
|
/** Identifies a conversion, e.g. `'CamelToSnake'`. */
|
|
39
|
-
type ParserType = ParserCamelType | ParserDashType | ParserPascalType | ParserSnakeType | ParserUpperDashType | ParserUpperSnakeType;
|
|
105
|
+
type ParserType = ParserCamelType | ParserDashType | ParserPascalType | ParserSnakeType | ParserUpperDashType | ParserUpperSnakeType | ParserTrainType | ParserDotType | ParserTitleType | ParserSentenceType;
|
|
40
106
|
/** Flattens an intersection/mapped type so editors show the resulting keys. */
|
|
41
107
|
type Prettify<T> = { [K in keyof T]: T[K]; } & {};
|
|
42
108
|
/**
|
|
43
109
|
* The type returned by a conversion: strings stay `string`, and object keys
|
|
44
110
|
* (deeply, including inside arrays) are renamed according to the conversion `P`.
|
|
45
111
|
*/
|
|
46
|
-
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> : 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;
|
|
47
113
|
//#endregion
|
|
48
114
|
//#region src/camelCase/camelCase.d.ts
|
|
49
115
|
/**
|
|
@@ -96,6 +162,46 @@ export declare function camelToUpperSnake<T extends object | string>(input: T):
|
|
|
96
162
|
* ```
|
|
97
163
|
*/
|
|
98
164
|
export declare function camelToUpperDash<T extends object | string>(input: T): Result<T, "CamelToUpperDash">;
|
|
165
|
+
/**
|
|
166
|
+
* Converts a string, or the keys of an object/array (deeply), from camelCase to Train-Case.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* camelToTrain('helloWorld'); // 'Hello-World'
|
|
171
|
+
* camelToTrain({ firstName: 'John' }); // { 'First-Name': 'John' }
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
export declare function camelToTrain<T extends object | string>(input: T): Result<T, "CamelToTrain">;
|
|
175
|
+
/**
|
|
176
|
+
* Converts a string, or the keys of an object/array (deeply), from camelCase to dot.case.
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```ts
|
|
180
|
+
* camelToDot('helloWorld'); // 'hello.world'
|
|
181
|
+
* camelToDot({ firstName: 'John' }); // { 'first.name': 'John' }
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
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">;
|
|
99
205
|
//#endregion
|
|
100
206
|
//#region src/dashCase/dashCase.d.ts
|
|
101
207
|
/**
|
|
@@ -148,6 +254,46 @@ export declare function dashToUpperSnake<T extends object | string>(input: T): R
|
|
|
148
254
|
* ```
|
|
149
255
|
*/
|
|
150
256
|
export declare function dashToUpperDash<T extends object | string>(input: T): Result<T, "DashToUpperDash">;
|
|
257
|
+
/**
|
|
258
|
+
* Converts a string, or the keys of an object/array (deeply), from dash-case to Train-Case.
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* ```ts
|
|
262
|
+
* dashToTrain('hello-world'); // 'Hello-World'
|
|
263
|
+
* dashToTrain({ 'first-name': 'John' }); // { 'First-Name': 'John' }
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
export declare function dashToTrain<T extends object | string>(input: T): Result<T, "DashToTrain">;
|
|
267
|
+
/**
|
|
268
|
+
* Converts a string, or the keys of an object/array (deeply), from dash-case to dot.case.
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```ts
|
|
272
|
+
* dashToDot('hello-world'); // 'hello.world'
|
|
273
|
+
* dashToDot({ 'first-name': 'John' }); // { 'first.name': 'John' }
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
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">;
|
|
151
297
|
//#endregion
|
|
152
298
|
//#region src/pascalCase/pascalCase.d.ts
|
|
153
299
|
/**
|
|
@@ -200,6 +346,46 @@ export declare function pascalToUpperSnake<T extends object | string>(input: T):
|
|
|
200
346
|
* ```
|
|
201
347
|
*/
|
|
202
348
|
export declare function pascalToUpperDash<T extends object | string>(input: T): Result<T, "PascalToUpperDash">;
|
|
349
|
+
/**
|
|
350
|
+
* Converts a string, or the keys of an object/array (deeply), from PascalCase to Train-Case.
|
|
351
|
+
*
|
|
352
|
+
* @example
|
|
353
|
+
* ```ts
|
|
354
|
+
* pascalToTrain('HelloWorld'); // 'Hello-World'
|
|
355
|
+
* pascalToTrain({ FirstName: 'John' }); // { 'First-Name': 'John' }
|
|
356
|
+
* ```
|
|
357
|
+
*/
|
|
358
|
+
export declare function pascalToTrain<T extends object | string>(input: T): Result<T, "PascalToTrain">;
|
|
359
|
+
/**
|
|
360
|
+
* Converts a string, or the keys of an object/array (deeply), from PascalCase to dot.case.
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```ts
|
|
364
|
+
* pascalToDot('HelloWorld'); // 'hello.world'
|
|
365
|
+
* pascalToDot({ FirstName: 'John' }); // { 'first.name': 'John' }
|
|
366
|
+
* ```
|
|
367
|
+
*/
|
|
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">;
|
|
203
389
|
//#endregion
|
|
204
390
|
//#region src/snakeCase/snakeCase.d.ts
|
|
205
391
|
/**
|
|
@@ -252,6 +438,414 @@ export declare function snakeToUpperSnake<T extends object | string>(input: T):
|
|
|
252
438
|
* ```
|
|
253
439
|
*/
|
|
254
440
|
export declare function snakeToUpperDash<T extends object | string>(input: T): Result<T, "SnakeToUpperDash">;
|
|
441
|
+
/**
|
|
442
|
+
* Converts a string, or the keys of an object/array (deeply), from snake_case to Train-Case.
|
|
443
|
+
*
|
|
444
|
+
* @example
|
|
445
|
+
* ```ts
|
|
446
|
+
* snakeToTrain('hello_world'); // 'Hello-World'
|
|
447
|
+
* snakeToTrain({ first_name: 'John' }); // { 'First-Name': 'John' }
|
|
448
|
+
* ```
|
|
449
|
+
*/
|
|
450
|
+
export declare function snakeToTrain<T extends object | string>(input: T): Result<T, "SnakeToTrain">;
|
|
451
|
+
/**
|
|
452
|
+
* Converts a string, or the keys of an object/array (deeply), from snake_case to dot.case.
|
|
453
|
+
*
|
|
454
|
+
* @example
|
|
455
|
+
* ```ts
|
|
456
|
+
* snakeToDot('hello_world'); // 'hello.world'
|
|
457
|
+
* snakeToDot({ first_name: 'John' }); // { 'first.name': 'John' }
|
|
458
|
+
* ```
|
|
459
|
+
*/
|
|
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">;
|
|
481
|
+
//#endregion
|
|
482
|
+
//#region src/trainCase/trainCase.d.ts
|
|
483
|
+
/**
|
|
484
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to camelCase.
|
|
485
|
+
*
|
|
486
|
+
* @example
|
|
487
|
+
* ```ts
|
|
488
|
+
* trainToCamel('Hello-World'); // 'helloWorld'
|
|
489
|
+
* trainToCamel({ 'First-Name': 'John' }); // { firstName: 'John' }
|
|
490
|
+
* ```
|
|
491
|
+
*/
|
|
492
|
+
export declare function trainToCamel<T extends object | string>(input: T): Result<T, "TrainToCamel">;
|
|
493
|
+
/**
|
|
494
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to PascalCase.
|
|
495
|
+
*
|
|
496
|
+
* @example
|
|
497
|
+
* ```ts
|
|
498
|
+
* trainToPascal('Hello-World'); // 'HelloWorld'
|
|
499
|
+
* trainToPascal({ 'First-Name': 'John' }); // { FirstName: 'John' }
|
|
500
|
+
* ```
|
|
501
|
+
*/
|
|
502
|
+
export declare function trainToPascal<T extends object | string>(input: T): Result<T, "TrainToPascal">;
|
|
503
|
+
/**
|
|
504
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to snake_case.
|
|
505
|
+
*
|
|
506
|
+
* @example
|
|
507
|
+
* ```ts
|
|
508
|
+
* trainToSnake('Hello-World'); // 'hello_world'
|
|
509
|
+
* trainToSnake({ 'First-Name': 'John' }); // { first_name: 'John' }
|
|
510
|
+
* ```
|
|
511
|
+
*/
|
|
512
|
+
export declare function trainToSnake<T extends object | string>(input: T): Result<T, "TrainToSnake">;
|
|
513
|
+
/**
|
|
514
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to dash-case.
|
|
515
|
+
*
|
|
516
|
+
* @example
|
|
517
|
+
* ```ts
|
|
518
|
+
* trainToDash('Hello-World'); // 'hello-world'
|
|
519
|
+
* trainToDash({ 'First-Name': 'John' }); // { 'first-name': 'John' }
|
|
520
|
+
* ```
|
|
521
|
+
*/
|
|
522
|
+
export declare function trainToDash<T extends object | string>(input: T): Result<T, "TrainToDash">;
|
|
523
|
+
/**
|
|
524
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to UPPER_SNAKE_CASE.
|
|
525
|
+
*
|
|
526
|
+
* @example
|
|
527
|
+
* ```ts
|
|
528
|
+
* trainToUpperSnake('Hello-World'); // 'HELLO_WORLD'
|
|
529
|
+
* trainToUpperSnake({ 'First-Name': 'John' }); // { FIRST_NAME: 'John' }
|
|
530
|
+
* ```
|
|
531
|
+
*/
|
|
532
|
+
export declare function trainToUpperSnake<T extends object | string>(input: T): Result<T, "TrainToUpperSnake">;
|
|
533
|
+
/**
|
|
534
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to UPPER-DASH-CASE.
|
|
535
|
+
*
|
|
536
|
+
* @example
|
|
537
|
+
* ```ts
|
|
538
|
+
* trainToUpperDash('Hello-World'); // 'HELLO-WORLD'
|
|
539
|
+
* trainToUpperDash({ 'First-Name': 'John' }); // { 'FIRST-NAME': 'John' }
|
|
540
|
+
* ```
|
|
541
|
+
*/
|
|
542
|
+
export declare function trainToUpperDash<T extends object | string>(input: T): Result<T, "TrainToUpperDash">;
|
|
543
|
+
/**
|
|
544
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to dot.case.
|
|
545
|
+
*
|
|
546
|
+
* @example
|
|
547
|
+
* ```ts
|
|
548
|
+
* trainToDot('Hello-World'); // 'hello.world'
|
|
549
|
+
* trainToDot({ 'First-Name': 'John' }); // { 'first.name': 'John' }
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
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">;
|
|
573
|
+
//#endregion
|
|
574
|
+
//#region src/dotCase/dotCase.d.ts
|
|
575
|
+
/**
|
|
576
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to camelCase.
|
|
577
|
+
*
|
|
578
|
+
* @example
|
|
579
|
+
* ```ts
|
|
580
|
+
* dotToCamel('hello.world'); // 'helloWorld'
|
|
581
|
+
* dotToCamel({ 'first.name': 'John' }); // { firstName: 'John' }
|
|
582
|
+
* ```
|
|
583
|
+
*/
|
|
584
|
+
export declare function dotToCamel<T extends object | string>(input: T): Result<T, "DotToCamel">;
|
|
585
|
+
/**
|
|
586
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to PascalCase.
|
|
587
|
+
*
|
|
588
|
+
* @example
|
|
589
|
+
* ```ts
|
|
590
|
+
* dotToPascal('hello.world'); // 'HelloWorld'
|
|
591
|
+
* dotToPascal({ 'first.name': 'John' }); // { FirstName: 'John' }
|
|
592
|
+
* ```
|
|
593
|
+
*/
|
|
594
|
+
export declare function dotToPascal<T extends object | string>(input: T): Result<T, "DotToPascal">;
|
|
595
|
+
/**
|
|
596
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to snake_case.
|
|
597
|
+
*
|
|
598
|
+
* @example
|
|
599
|
+
* ```ts
|
|
600
|
+
* dotToSnake('hello.world'); // 'hello_world'
|
|
601
|
+
* dotToSnake({ 'first.name': 'John' }); // { first_name: 'John' }
|
|
602
|
+
* ```
|
|
603
|
+
*/
|
|
604
|
+
export declare function dotToSnake<T extends object | string>(input: T): Result<T, "DotToSnake">;
|
|
605
|
+
/**
|
|
606
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to dash-case.
|
|
607
|
+
*
|
|
608
|
+
* @example
|
|
609
|
+
* ```ts
|
|
610
|
+
* dotToDash('hello.world'); // 'hello-world'
|
|
611
|
+
* dotToDash({ 'first.name': 'John' }); // { 'first-name': 'John' }
|
|
612
|
+
* ```
|
|
613
|
+
*/
|
|
614
|
+
export declare function dotToDash<T extends object | string>(input: T): Result<T, "DotToDash">;
|
|
615
|
+
/**
|
|
616
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to UPPER_SNAKE_CASE.
|
|
617
|
+
*
|
|
618
|
+
* @example
|
|
619
|
+
* ```ts
|
|
620
|
+
* dotToUpperSnake('hello.world'); // 'HELLO_WORLD'
|
|
621
|
+
* dotToUpperSnake({ 'first.name': 'John' }); // { FIRST_NAME: 'John' }
|
|
622
|
+
* ```
|
|
623
|
+
*/
|
|
624
|
+
export declare function dotToUpperSnake<T extends object | string>(input: T): Result<T, "DotToUpperSnake">;
|
|
625
|
+
/**
|
|
626
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to UPPER-DASH-CASE.
|
|
627
|
+
*
|
|
628
|
+
* @example
|
|
629
|
+
* ```ts
|
|
630
|
+
* dotToUpperDash('hello.world'); // 'HELLO-WORLD'
|
|
631
|
+
* dotToUpperDash({ 'first.name': 'John' }); // { 'FIRST-NAME': 'John' }
|
|
632
|
+
* ```
|
|
633
|
+
*/
|
|
634
|
+
export declare function dotToUpperDash<T extends object | string>(input: T): Result<T, "DotToUpperDash">;
|
|
635
|
+
/**
|
|
636
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to Train-Case.
|
|
637
|
+
*
|
|
638
|
+
* @example
|
|
639
|
+
* ```ts
|
|
640
|
+
* dotToTrain('hello.world'); // 'Hello-World'
|
|
641
|
+
* dotToTrain({ 'first.name': 'John' }); // { 'First-Name': 'John' }
|
|
642
|
+
* ```
|
|
643
|
+
*/
|
|
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">;
|
|
255
849
|
//#endregion
|
|
256
850
|
//#region src/upperDashCase/upperDashCase.d.ts
|
|
257
851
|
/**
|
|
@@ -304,6 +898,46 @@ export declare function upperDashToPascal<T extends object | string>(input: T):
|
|
|
304
898
|
* ```
|
|
305
899
|
*/
|
|
306
900
|
export declare function upperDashToUpperSnake<T extends object | string>(input: T): Result<T, "UpperDashToUpperSnake">;
|
|
901
|
+
/**
|
|
902
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to Train-Case.
|
|
903
|
+
*
|
|
904
|
+
* @example
|
|
905
|
+
* ```ts
|
|
906
|
+
* upperDashToTrain('HELLO-WORLD'); // 'Hello-World'
|
|
907
|
+
* upperDashToTrain({ 'FIRST-NAME': 'John' }); // { 'First-Name': 'John' }
|
|
908
|
+
* ```
|
|
909
|
+
*/
|
|
910
|
+
export declare function upperDashToTrain<T extends object | string>(input: T): Result<T, "UpperDashToTrain">;
|
|
911
|
+
/**
|
|
912
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to dot.case.
|
|
913
|
+
*
|
|
914
|
+
* @example
|
|
915
|
+
* ```ts
|
|
916
|
+
* upperDashToDot('HELLO-WORLD'); // 'hello.world'
|
|
917
|
+
* upperDashToDot({ 'FIRST-NAME': 'John' }); // { 'first.name': 'John' }
|
|
918
|
+
* ```
|
|
919
|
+
*/
|
|
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">;
|
|
307
941
|
//#endregion
|
|
308
942
|
//#region src/upperSnakeCase/upperSnakeCase.d.ts
|
|
309
943
|
/**
|
|
@@ -356,5 +990,45 @@ export declare function upperSnakeToPascal<T extends object | string>(input: T):
|
|
|
356
990
|
* ```
|
|
357
991
|
*/
|
|
358
992
|
export declare function upperSnakeToUpperDash<T extends object | string>(input: T): Result<T, "UpperSnakeToUpperDash">;
|
|
993
|
+
/**
|
|
994
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to Train-Case.
|
|
995
|
+
*
|
|
996
|
+
* @example
|
|
997
|
+
* ```ts
|
|
998
|
+
* upperSnakeToTrain('HELLO_WORLD'); // 'Hello-World'
|
|
999
|
+
* upperSnakeToTrain({ FIRST_NAME: 'John' }); // { 'First-Name': 'John' }
|
|
1000
|
+
* ```
|
|
1001
|
+
*/
|
|
1002
|
+
export declare function upperSnakeToTrain<T extends object | string>(input: T): Result<T, "UpperSnakeToTrain">;
|
|
1003
|
+
/**
|
|
1004
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to dot.case.
|
|
1005
|
+
*
|
|
1006
|
+
* @example
|
|
1007
|
+
* ```ts
|
|
1008
|
+
* upperSnakeToDot('HELLO_WORLD'); // 'hello.world'
|
|
1009
|
+
* upperSnakeToDot({ FIRST_NAME: 'John' }); // { 'first.name': 'John' }
|
|
1010
|
+
* ```
|
|
1011
|
+
*/
|
|
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">;
|
|
359
1033
|
//#endregion
|
|
360
1034
|
export type { ParserType, Prettify, Result };
|