caseparser 3.0.0 → 4.1.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 +110 -135
- package/dist/index.cjs +924 -0
- package/dist/index.d.cts +652 -0
- package/dist/index.d.ts +624 -48
- package/dist/index.js +821 -271
- package/package.json +52 -23
- package/.nvmrc +0 -1
- package/CHANGELOG.md +0 -40
- package/dist/index.mjs +0 -262
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,924 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/utils.ts
|
|
3
|
+
function isString(input) {
|
|
4
|
+
return typeof input === "string";
|
|
5
|
+
}
|
|
6
|
+
function isObject(input) {
|
|
7
|
+
return typeof input === "object" && (input === null || input === void 0 ? void 0 : input.constructor) === Object;
|
|
8
|
+
}
|
|
9
|
+
function isArray(input) {
|
|
10
|
+
return Array.isArray(input);
|
|
11
|
+
}
|
|
12
|
+
function Lowercase(str) {
|
|
13
|
+
return str.toLowerCase();
|
|
14
|
+
}
|
|
15
|
+
function Uppercase(str) {
|
|
16
|
+
return str.toUpperCase();
|
|
17
|
+
}
|
|
18
|
+
function Capitalize(str) {
|
|
19
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
20
|
+
}
|
|
21
|
+
function Uncapitalize(str) {
|
|
22
|
+
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/parser/stringParser.ts
|
|
26
|
+
const CamelToDash = (str) => str.replace(/([A-Z])/g, (g) => "-" + g[0].toLowerCase());
|
|
27
|
+
const CamelToPascal = (str) => Capitalize(str);
|
|
28
|
+
const CamelToSnake = (str) => str.replace(/([A-Z])/g, (g) => "_" + g[0].toLowerCase());
|
|
29
|
+
const CamelToUpperDash = (str) => Uppercase(CamelToDash(str));
|
|
30
|
+
const CamelToUpperSnake = (str) => Uppercase(CamelToSnake(str));
|
|
31
|
+
const CamelToTrain = (str) => DashToTrain(CamelToDash(str));
|
|
32
|
+
const CamelToDot = (str) => DashToDot(CamelToDash(str));
|
|
33
|
+
const DashToCamel = (str) => str.replace(/(\-\w)/g, (g) => g[1].toUpperCase());
|
|
34
|
+
const DashToPascal = (str) => Capitalize(DashToCamel(str));
|
|
35
|
+
const DashToSnake = (str) => str.replace(/(\-)/g, "_");
|
|
36
|
+
const DashToUpperDash = (str) => Uppercase(str);
|
|
37
|
+
const DashToUpperSnake = (str) => Uppercase(DashToSnake(str));
|
|
38
|
+
const DashToTrain = (str) => str.split("-").map(Capitalize).join("-");
|
|
39
|
+
const DashToDot = (str) => str.replace(/(\-)/g, ".");
|
|
40
|
+
const PascalToCamel = (str) => Uncapitalize(str);
|
|
41
|
+
const PascalToDash = (str) => CamelToDash(Uncapitalize(str));
|
|
42
|
+
const PascalToSnake = (str) => CamelToSnake(Uncapitalize(str));
|
|
43
|
+
const PascalToUpperDash = (str) => Uppercase(PascalToDash(str));
|
|
44
|
+
const PascalToUpperSnake = (str) => Uppercase(PascalToSnake(str));
|
|
45
|
+
const PascalToTrain = (str) => DashToTrain(PascalToDash(str));
|
|
46
|
+
const PascalToDot = (str) => DashToDot(PascalToDash(str));
|
|
47
|
+
const SnakeToCamel = (str) => str.replace(/(\_\w)/g, (g) => g[1].toUpperCase());
|
|
48
|
+
const SnakeToDash = (str) => str.replace(/(\_)/g, "-");
|
|
49
|
+
const SnakeToPascal = (str) => Capitalize(SnakeToCamel(str));
|
|
50
|
+
const SnakeToUpperDash = (str) => Uppercase(SnakeToDash(str));
|
|
51
|
+
const SnakeToTrain = (str) => DashToTrain(SnakeToDash(str));
|
|
52
|
+
const SnakeToDot = (str) => DashToDot(SnakeToDash(str));
|
|
53
|
+
const SnakeToUpperSnake = (str) => Uppercase(str);
|
|
54
|
+
const UpperDashToCamel = (str) => DashToCamel(Lowercase(str));
|
|
55
|
+
const UpperDashToDash = (str) => Lowercase(str);
|
|
56
|
+
const UpperDashToPascal = (str) => Capitalize(UpperDashToCamel(str));
|
|
57
|
+
const UpperDashToSnake = (str) => DashToSnake(UpperDashToDash(str));
|
|
58
|
+
const UpperDashToUpperSnake = (str) => Uppercase(UpperDashToSnake(str));
|
|
59
|
+
const UpperDashToTrain = (str) => DashToTrain(UpperDashToDash(str));
|
|
60
|
+
const UpperDashToDot = (str) => DashToDot(UpperDashToDash(str));
|
|
61
|
+
const UpperSnakeToCamel = (str) => SnakeToCamel(Lowercase(str));
|
|
62
|
+
const UpperSnakeToDash = (str) => str.replace(/(\_)/g, "-").toLowerCase();
|
|
63
|
+
const UpperSnakeToPascal = (str) => SnakeToPascal(Lowercase(str));
|
|
64
|
+
const UpperSnakeToSnake = (str) => Lowercase(str);
|
|
65
|
+
const UpperSnakeToUpperDash = (str) => Uppercase(UpperSnakeToDash(str));
|
|
66
|
+
const UpperSnakeToTrain = (str) => DashToTrain(UpperSnakeToDash(str));
|
|
67
|
+
const UpperSnakeToDot = (str) => DashToDot(UpperSnakeToDash(str));
|
|
68
|
+
const TrainToCamel = (str) => DashToCamel(TrainToDash(str));
|
|
69
|
+
const TrainToDash = (str) => Lowercase(str);
|
|
70
|
+
const TrainToDot = (str) => DashToDot(TrainToDash(str));
|
|
71
|
+
const TrainToPascal = (str) => DashToPascal(TrainToDash(str));
|
|
72
|
+
const TrainToSnake = (str) => DashToSnake(TrainToDash(str));
|
|
73
|
+
const TrainToUpperDash = (str) => Uppercase(str);
|
|
74
|
+
const TrainToUpperSnake = (str) => DashToUpperSnake(TrainToDash(str));
|
|
75
|
+
const DotToCamel = (str) => DashToCamel(DotToDash(str));
|
|
76
|
+
const DotToDash = (str) => str.replace(/(\.)/g, "-");
|
|
77
|
+
const DotToPascal = (str) => DashToPascal(DotToDash(str));
|
|
78
|
+
const DotToSnake = (str) => DashToSnake(DotToDash(str));
|
|
79
|
+
const DotToTrain = (str) => DashToTrain(DotToDash(str));
|
|
80
|
+
const DotToUpperDash = (str) => Uppercase(DotToDash(str));
|
|
81
|
+
const DotToUpperSnake = (str) => DashToUpperSnake(DotToDash(str));
|
|
82
|
+
function parse(input, type) {
|
|
83
|
+
return {
|
|
84
|
+
CamelToDash,
|
|
85
|
+
CamelToPascal,
|
|
86
|
+
CamelToSnake,
|
|
87
|
+
CamelToUpperDash,
|
|
88
|
+
CamelToUpperSnake,
|
|
89
|
+
DashToCamel,
|
|
90
|
+
DashToSnake,
|
|
91
|
+
DashToPascal,
|
|
92
|
+
DashToUpperSnake,
|
|
93
|
+
DashToUpperDash,
|
|
94
|
+
PascalToCamel,
|
|
95
|
+
PascalToSnake,
|
|
96
|
+
PascalToDash,
|
|
97
|
+
PascalToUpperSnake,
|
|
98
|
+
PascalToUpperDash,
|
|
99
|
+
SnakeToCamel,
|
|
100
|
+
SnakeToDash,
|
|
101
|
+
SnakeToPascal,
|
|
102
|
+
SnakeToUpperSnake,
|
|
103
|
+
SnakeToUpperDash,
|
|
104
|
+
UpperSnakeToCamel,
|
|
105
|
+
UpperSnakeToSnake,
|
|
106
|
+
UpperSnakeToDash,
|
|
107
|
+
UpperSnakeToPascal,
|
|
108
|
+
UpperSnakeToUpperDash,
|
|
109
|
+
UpperDashToCamel,
|
|
110
|
+
UpperDashToSnake,
|
|
111
|
+
UpperDashToDash,
|
|
112
|
+
UpperDashToPascal,
|
|
113
|
+
UpperDashToUpperSnake,
|
|
114
|
+
CamelToTrain,
|
|
115
|
+
CamelToDot,
|
|
116
|
+
PascalToTrain,
|
|
117
|
+
PascalToDot,
|
|
118
|
+
SnakeToTrain,
|
|
119
|
+
SnakeToDot,
|
|
120
|
+
DashToTrain,
|
|
121
|
+
DashToDot,
|
|
122
|
+
UpperSnakeToTrain,
|
|
123
|
+
UpperSnakeToDot,
|
|
124
|
+
UpperDashToTrain,
|
|
125
|
+
UpperDashToDot,
|
|
126
|
+
TrainToCamel,
|
|
127
|
+
TrainToPascal,
|
|
128
|
+
TrainToSnake,
|
|
129
|
+
TrainToDash,
|
|
130
|
+
TrainToUpperSnake,
|
|
131
|
+
TrainToUpperDash,
|
|
132
|
+
TrainToDot,
|
|
133
|
+
DotToCamel,
|
|
134
|
+
DotToPascal,
|
|
135
|
+
DotToSnake,
|
|
136
|
+
DotToDash,
|
|
137
|
+
DotToUpperSnake,
|
|
138
|
+
DotToUpperDash,
|
|
139
|
+
DotToTrain
|
|
140
|
+
}[type](input);
|
|
141
|
+
}
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/parser/objectParser.ts
|
|
144
|
+
function objectParser(input, type) {
|
|
145
|
+
const result = {};
|
|
146
|
+
for (const property of Object.keys(input)) {
|
|
147
|
+
const parsedKey = parse(property, type);
|
|
148
|
+
const value = input[property];
|
|
149
|
+
let parsedValue;
|
|
150
|
+
if (isArray(value)) parsedValue = arrayParser(value, type);
|
|
151
|
+
else if (isObject(value)) parsedValue = objectParser(value, type);
|
|
152
|
+
else parsedValue = value;
|
|
153
|
+
Object.defineProperty(result, parsedKey, {
|
|
154
|
+
value: parsedValue,
|
|
155
|
+
enumerable: true,
|
|
156
|
+
writable: true,
|
|
157
|
+
configurable: true
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
return result;
|
|
161
|
+
}
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region src/parser/arrayParser.ts
|
|
164
|
+
function arrayParser(input, type) {
|
|
165
|
+
return input.map((item) => {
|
|
166
|
+
if (isArray(item)) return arrayParser(item, type);
|
|
167
|
+
if (isObject(item)) return objectParser(item, type);
|
|
168
|
+
return item;
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/parser/parser.ts
|
|
173
|
+
function converter(input, type) {
|
|
174
|
+
let result;
|
|
175
|
+
if (isString(input)) result = parse(input, type);
|
|
176
|
+
if (isArray(input)) result = arrayParser(input, type);
|
|
177
|
+
if (isObject(input)) result = objectParser(input, type);
|
|
178
|
+
return result;
|
|
179
|
+
}
|
|
180
|
+
//#endregion
|
|
181
|
+
//#region src/camelCase/camelCase.ts
|
|
182
|
+
/**
|
|
183
|
+
* Converts a string, or the keys of an object/array (deeply), from camelCase to dash-case.
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```ts
|
|
187
|
+
* camelToDash('helloWorld'); // 'hello-world'
|
|
188
|
+
* camelToDash({ firstName: 'John' }); // { 'first-name': 'John' }
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
function camelToDash(input) {
|
|
192
|
+
return converter(input, "CamelToDash");
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Converts a string, or the keys of an object/array (deeply), from camelCase to snake_case.
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```ts
|
|
199
|
+
* camelToSnake('helloWorld'); // 'hello_world'
|
|
200
|
+
* camelToSnake({ firstName: 'John' }); // { first_name: 'John' }
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
function camelToSnake(input) {
|
|
204
|
+
return converter(input, "CamelToSnake");
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Converts a string, or the keys of an object/array (deeply), from camelCase to PascalCase.
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```ts
|
|
211
|
+
* camelToPascal('helloWorld'); // 'HelloWorld'
|
|
212
|
+
* camelToPascal({ firstName: 'John' }); // { FirstName: 'John' }
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
215
|
+
function camelToPascal(input) {
|
|
216
|
+
return converter(input, "CamelToPascal");
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Converts a string, or the keys of an object/array (deeply), from camelCase to UPPER_SNAKE_CASE.
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```ts
|
|
223
|
+
* camelToUpperSnake('helloWorld'); // 'HELLO_WORLD'
|
|
224
|
+
* camelToUpperSnake({ firstName: 'John' }); // { FIRST_NAME: 'John' }
|
|
225
|
+
* ```
|
|
226
|
+
*/
|
|
227
|
+
function camelToUpperSnake(input) {
|
|
228
|
+
return converter(input, "CamelToUpperSnake");
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Converts a string, or the keys of an object/array (deeply), from camelCase to UPPER-DASH-CASE.
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```ts
|
|
235
|
+
* camelToUpperDash('helloWorld'); // 'HELLO-WORLD'
|
|
236
|
+
* camelToUpperDash({ firstName: 'John' }); // { 'FIRST-NAME': 'John' }
|
|
237
|
+
* ```
|
|
238
|
+
*/
|
|
239
|
+
function camelToUpperDash(input) {
|
|
240
|
+
return converter(input, "CamelToUpperDash");
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Converts a string, or the keys of an object/array (deeply), from camelCase to Train-Case.
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* ```ts
|
|
247
|
+
* camelToTrain('helloWorld'); // 'Hello-World'
|
|
248
|
+
* camelToTrain({ firstName: 'John' }); // { 'First-Name': 'John' }
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
function camelToTrain(input) {
|
|
252
|
+
return converter(input, "CamelToTrain");
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Converts a string, or the keys of an object/array (deeply), from camelCase to dot.case.
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* ```ts
|
|
259
|
+
* camelToDot('helloWorld'); // 'hello.world'
|
|
260
|
+
* camelToDot({ firstName: 'John' }); // { 'first.name': 'John' }
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
function camelToDot(input) {
|
|
264
|
+
return converter(input, "CamelToDot");
|
|
265
|
+
}
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region src/dashCase/dashCase.ts
|
|
268
|
+
/**
|
|
269
|
+
* Converts a string, or the keys of an object/array (deeply), from dash-case to snake_case.
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```ts
|
|
273
|
+
* dashToSnake('hello-world'); // 'hello_world'
|
|
274
|
+
* dashToSnake({ 'first-name': 'John' }); // { first_name: 'John' }
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
277
|
+
function dashToSnake(input) {
|
|
278
|
+
return converter(input, "DashToSnake");
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Converts a string, or the keys of an object/array (deeply), from dash-case to camelCase.
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```ts
|
|
285
|
+
* dashToCamel('hello-world'); // 'helloWorld'
|
|
286
|
+
* dashToCamel({ 'first-name': 'John' }); // { firstName: 'John' }
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
289
|
+
function dashToCamel(input) {
|
|
290
|
+
return converter(input, "DashToCamel");
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Converts a string, or the keys of an object/array (deeply), from dash-case to PascalCase.
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* ```ts
|
|
297
|
+
* dashToPascal('hello-world'); // 'HelloWorld'
|
|
298
|
+
* dashToPascal({ 'first-name': 'John' }); // { FirstName: 'John' }
|
|
299
|
+
* ```
|
|
300
|
+
*/
|
|
301
|
+
function dashToPascal(input) {
|
|
302
|
+
return converter(input, "DashToPascal");
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Converts a string, or the keys of an object/array (deeply), from dash-case to UPPER_SNAKE_CASE.
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```ts
|
|
309
|
+
* dashToUpperSnake('hello-world'); // 'HELLO_WORLD'
|
|
310
|
+
* dashToUpperSnake({ 'first-name': 'John' }); // { FIRST_NAME: 'John' }
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
function dashToUpperSnake(input) {
|
|
314
|
+
return converter(input, "DashToUpperSnake");
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Converts a string, or the keys of an object/array (deeply), from dash-case to UPPER-DASH-CASE.
|
|
318
|
+
*
|
|
319
|
+
* @example
|
|
320
|
+
* ```ts
|
|
321
|
+
* dashToUpperDash('hello-world'); // 'HELLO-WORLD'
|
|
322
|
+
* dashToUpperDash({ 'first-name': 'John' }); // { 'FIRST-NAME': 'John' }
|
|
323
|
+
* ```
|
|
324
|
+
*/
|
|
325
|
+
function dashToUpperDash(input) {
|
|
326
|
+
return converter(input, "DashToUpperDash");
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Converts a string, or the keys of an object/array (deeply), from dash-case to Train-Case.
|
|
330
|
+
*
|
|
331
|
+
* @example
|
|
332
|
+
* ```ts
|
|
333
|
+
* dashToTrain('hello-world'); // 'Hello-World'
|
|
334
|
+
* dashToTrain({ 'first-name': 'John' }); // { 'First-Name': 'John' }
|
|
335
|
+
* ```
|
|
336
|
+
*/
|
|
337
|
+
function dashToTrain(input) {
|
|
338
|
+
return converter(input, "DashToTrain");
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Converts a string, or the keys of an object/array (deeply), from dash-case to dot.case.
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* ```ts
|
|
345
|
+
* dashToDot('hello-world'); // 'hello.world'
|
|
346
|
+
* dashToDot({ 'first-name': 'John' }); // { 'first.name': 'John' }
|
|
347
|
+
* ```
|
|
348
|
+
*/
|
|
349
|
+
function dashToDot(input) {
|
|
350
|
+
return converter(input, "DashToDot");
|
|
351
|
+
}
|
|
352
|
+
//#endregion
|
|
353
|
+
//#region src/pascalCase/pascalCase.ts
|
|
354
|
+
/**
|
|
355
|
+
* Converts a string, or the keys of an object/array (deeply), from PascalCase to camelCase.
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* ```ts
|
|
359
|
+
* pascalToCamel('HelloWorld'); // 'helloWorld'
|
|
360
|
+
* pascalToCamel({ FirstName: 'John' }); // { firstName: 'John' }
|
|
361
|
+
* ```
|
|
362
|
+
*/
|
|
363
|
+
function pascalToCamel(input) {
|
|
364
|
+
return converter(input, "PascalToCamel");
|
|
365
|
+
}
|
|
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
|
+
function pascalToSnake(input) {
|
|
376
|
+
return converter(input, "PascalToSnake");
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Converts a string, or the keys of an object/array (deeply), from PascalCase to dash-case.
|
|
380
|
+
*
|
|
381
|
+
* @example
|
|
382
|
+
* ```ts
|
|
383
|
+
* pascalToDash('HelloWorld'); // 'hello-world'
|
|
384
|
+
* pascalToDash({ FirstName: 'John' }); // { 'first-name': 'John' }
|
|
385
|
+
* ```
|
|
386
|
+
*/
|
|
387
|
+
function pascalToDash(input) {
|
|
388
|
+
return converter(input, "PascalToDash");
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Converts a string, or the keys of an object/array (deeply), from PascalCase to UPPER_SNAKE_CASE.
|
|
392
|
+
*
|
|
393
|
+
* @example
|
|
394
|
+
* ```ts
|
|
395
|
+
* pascalToUpperSnake('HelloWorld'); // 'HELLO_WORLD'
|
|
396
|
+
* pascalToUpperSnake({ FirstName: 'John' }); // { FIRST_NAME: 'John' }
|
|
397
|
+
* ```
|
|
398
|
+
*/
|
|
399
|
+
function pascalToUpperSnake(input) {
|
|
400
|
+
return converter(input, "PascalToUpperSnake");
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Converts a string, or the keys of an object/array (deeply), from PascalCase to UPPER-DASH-CASE.
|
|
404
|
+
*
|
|
405
|
+
* @example
|
|
406
|
+
* ```ts
|
|
407
|
+
* pascalToUpperDash('HelloWorld'); // 'HELLO-WORLD'
|
|
408
|
+
* pascalToUpperDash({ FirstName: 'John' }); // { 'FIRST-NAME': 'John' }
|
|
409
|
+
* ```
|
|
410
|
+
*/
|
|
411
|
+
function pascalToUpperDash(input) {
|
|
412
|
+
return converter(input, "PascalToUpperDash");
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Converts a string, or the keys of an object/array (deeply), from PascalCase to Train-Case.
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* ```ts
|
|
419
|
+
* pascalToTrain('HelloWorld'); // 'Hello-World'
|
|
420
|
+
* pascalToTrain({ FirstName: 'John' }); // { 'First-Name': 'John' }
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
function pascalToTrain(input) {
|
|
424
|
+
return converter(input, "PascalToTrain");
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Converts a string, or the keys of an object/array (deeply), from PascalCase to dot.case.
|
|
428
|
+
*
|
|
429
|
+
* @example
|
|
430
|
+
* ```ts
|
|
431
|
+
* pascalToDot('HelloWorld'); // 'hello.world'
|
|
432
|
+
* pascalToDot({ FirstName: 'John' }); // { 'first.name': 'John' }
|
|
433
|
+
* ```
|
|
434
|
+
*/
|
|
435
|
+
function pascalToDot(input) {
|
|
436
|
+
return converter(input, "PascalToDot");
|
|
437
|
+
}
|
|
438
|
+
//#endregion
|
|
439
|
+
//#region src/snakeCase/snakeCase.ts
|
|
440
|
+
/**
|
|
441
|
+
* Converts a string, or the keys of an object/array (deeply), from snake_case to camelCase.
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* ```ts
|
|
445
|
+
* snakeToCamel('hello_world'); // 'helloWorld'
|
|
446
|
+
* snakeToCamel({ first_name: 'John' }); // { firstName: 'John' }
|
|
447
|
+
* ```
|
|
448
|
+
*/
|
|
449
|
+
function snakeToCamel(input) {
|
|
450
|
+
return converter(input, "SnakeToCamel");
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Converts a string, or the keys of an object/array (deeply), from snake_case to dash-case.
|
|
454
|
+
*
|
|
455
|
+
* @example
|
|
456
|
+
* ```ts
|
|
457
|
+
* snakeToDash('hello_world'); // 'hello-world'
|
|
458
|
+
* snakeToDash({ first_name: 'John' }); // { 'first-name': 'John' }
|
|
459
|
+
* ```
|
|
460
|
+
*/
|
|
461
|
+
function snakeToDash(input) {
|
|
462
|
+
return converter(input, "SnakeToDash");
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Converts a string, or the keys of an object/array (deeply), from snake_case to PascalCase.
|
|
466
|
+
*
|
|
467
|
+
* @example
|
|
468
|
+
* ```ts
|
|
469
|
+
* snakeToPascal('hello_world'); // 'HelloWorld'
|
|
470
|
+
* snakeToPascal({ first_name: 'John' }); // { FirstName: 'John' }
|
|
471
|
+
* ```
|
|
472
|
+
*/
|
|
473
|
+
function snakeToPascal(input) {
|
|
474
|
+
return converter(input, "SnakeToPascal");
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Converts a string, or the keys of an object/array (deeply), from snake_case to UPPER_SNAKE_CASE.
|
|
478
|
+
*
|
|
479
|
+
* @example
|
|
480
|
+
* ```ts
|
|
481
|
+
* snakeToUpperSnake('hello_world'); // 'HELLO_WORLD'
|
|
482
|
+
* snakeToUpperSnake({ first_name: 'John' }); // { FIRST_NAME: 'John' }
|
|
483
|
+
* ```
|
|
484
|
+
*/
|
|
485
|
+
function snakeToUpperSnake(input) {
|
|
486
|
+
return converter(input, "SnakeToUpperSnake");
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Converts a string, or the keys of an object/array (deeply), from snake_case to UPPER-DASH-CASE.
|
|
490
|
+
*
|
|
491
|
+
* @example
|
|
492
|
+
* ```ts
|
|
493
|
+
* snakeToUpperDash('hello_world'); // 'HELLO-WORLD'
|
|
494
|
+
* snakeToUpperDash({ first_name: 'John' }); // { 'FIRST-NAME': 'John' }
|
|
495
|
+
* ```
|
|
496
|
+
*/
|
|
497
|
+
function snakeToUpperDash(input) {
|
|
498
|
+
return converter(input, "SnakeToUpperDash");
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Converts a string, or the keys of an object/array (deeply), from snake_case to Train-Case.
|
|
502
|
+
*
|
|
503
|
+
* @example
|
|
504
|
+
* ```ts
|
|
505
|
+
* snakeToTrain('hello_world'); // 'Hello-World'
|
|
506
|
+
* snakeToTrain({ first_name: 'John' }); // { 'First-Name': 'John' }
|
|
507
|
+
* ```
|
|
508
|
+
*/
|
|
509
|
+
function snakeToTrain(input) {
|
|
510
|
+
return converter(input, "SnakeToTrain");
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Converts a string, or the keys of an object/array (deeply), from snake_case to dot.case.
|
|
514
|
+
*
|
|
515
|
+
* @example
|
|
516
|
+
* ```ts
|
|
517
|
+
* snakeToDot('hello_world'); // 'hello.world'
|
|
518
|
+
* snakeToDot({ first_name: 'John' }); // { 'first.name': 'John' }
|
|
519
|
+
* ```
|
|
520
|
+
*/
|
|
521
|
+
function snakeToDot(input) {
|
|
522
|
+
return converter(input, "SnakeToDot");
|
|
523
|
+
}
|
|
524
|
+
//#endregion
|
|
525
|
+
//#region src/trainCase/trainCase.ts
|
|
526
|
+
/**
|
|
527
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to camelCase.
|
|
528
|
+
*
|
|
529
|
+
* @example
|
|
530
|
+
* ```ts
|
|
531
|
+
* trainToCamel('Hello-World'); // 'helloWorld'
|
|
532
|
+
* trainToCamel({ 'First-Name': 'John' }); // { firstName: 'John' }
|
|
533
|
+
* ```
|
|
534
|
+
*/
|
|
535
|
+
function trainToCamel(input) {
|
|
536
|
+
return converter(input, "TrainToCamel");
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to PascalCase.
|
|
540
|
+
*
|
|
541
|
+
* @example
|
|
542
|
+
* ```ts
|
|
543
|
+
* trainToPascal('Hello-World'); // 'HelloWorld'
|
|
544
|
+
* trainToPascal({ 'First-Name': 'John' }); // { FirstName: 'John' }
|
|
545
|
+
* ```
|
|
546
|
+
*/
|
|
547
|
+
function trainToPascal(input) {
|
|
548
|
+
return converter(input, "TrainToPascal");
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to snake_case.
|
|
552
|
+
*
|
|
553
|
+
* @example
|
|
554
|
+
* ```ts
|
|
555
|
+
* trainToSnake('Hello-World'); // 'hello_world'
|
|
556
|
+
* trainToSnake({ 'First-Name': 'John' }); // { first_name: 'John' }
|
|
557
|
+
* ```
|
|
558
|
+
*/
|
|
559
|
+
function trainToSnake(input) {
|
|
560
|
+
return converter(input, "TrainToSnake");
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to dash-case.
|
|
564
|
+
*
|
|
565
|
+
* @example
|
|
566
|
+
* ```ts
|
|
567
|
+
* trainToDash('Hello-World'); // 'hello-world'
|
|
568
|
+
* trainToDash({ 'First-Name': 'John' }); // { 'first-name': 'John' }
|
|
569
|
+
* ```
|
|
570
|
+
*/
|
|
571
|
+
function trainToDash(input) {
|
|
572
|
+
return converter(input, "TrainToDash");
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to UPPER_SNAKE_CASE.
|
|
576
|
+
*
|
|
577
|
+
* @example
|
|
578
|
+
* ```ts
|
|
579
|
+
* trainToUpperSnake('Hello-World'); // 'HELLO_WORLD'
|
|
580
|
+
* trainToUpperSnake({ 'First-Name': 'John' }); // { FIRST_NAME: 'John' }
|
|
581
|
+
* ```
|
|
582
|
+
*/
|
|
583
|
+
function trainToUpperSnake(input) {
|
|
584
|
+
return converter(input, "TrainToUpperSnake");
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to UPPER-DASH-CASE.
|
|
588
|
+
*
|
|
589
|
+
* @example
|
|
590
|
+
* ```ts
|
|
591
|
+
* trainToUpperDash('Hello-World'); // 'HELLO-WORLD'
|
|
592
|
+
* trainToUpperDash({ 'First-Name': 'John' }); // { 'FIRST-NAME': 'John' }
|
|
593
|
+
* ```
|
|
594
|
+
*/
|
|
595
|
+
function trainToUpperDash(input) {
|
|
596
|
+
return converter(input, "TrainToUpperDash");
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to dot.case.
|
|
600
|
+
*
|
|
601
|
+
* @example
|
|
602
|
+
* ```ts
|
|
603
|
+
* trainToDot('Hello-World'); // 'hello.world'
|
|
604
|
+
* trainToDot({ 'First-Name': 'John' }); // { 'first.name': 'John' }
|
|
605
|
+
* ```
|
|
606
|
+
*/
|
|
607
|
+
function trainToDot(input) {
|
|
608
|
+
return converter(input, "TrainToDot");
|
|
609
|
+
}
|
|
610
|
+
//#endregion
|
|
611
|
+
//#region src/dotCase/dotCase.ts
|
|
612
|
+
/**
|
|
613
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to camelCase.
|
|
614
|
+
*
|
|
615
|
+
* @example
|
|
616
|
+
* ```ts
|
|
617
|
+
* dotToCamel('hello.world'); // 'helloWorld'
|
|
618
|
+
* dotToCamel({ 'first.name': 'John' }); // { firstName: 'John' }
|
|
619
|
+
* ```
|
|
620
|
+
*/
|
|
621
|
+
function dotToCamel(input) {
|
|
622
|
+
return converter(input, "DotToCamel");
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to PascalCase.
|
|
626
|
+
*
|
|
627
|
+
* @example
|
|
628
|
+
* ```ts
|
|
629
|
+
* dotToPascal('hello.world'); // 'HelloWorld'
|
|
630
|
+
* dotToPascal({ 'first.name': 'John' }); // { FirstName: 'John' }
|
|
631
|
+
* ```
|
|
632
|
+
*/
|
|
633
|
+
function dotToPascal(input) {
|
|
634
|
+
return converter(input, "DotToPascal");
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to snake_case.
|
|
638
|
+
*
|
|
639
|
+
* @example
|
|
640
|
+
* ```ts
|
|
641
|
+
* dotToSnake('hello.world'); // 'hello_world'
|
|
642
|
+
* dotToSnake({ 'first.name': 'John' }); // { first_name: 'John' }
|
|
643
|
+
* ```
|
|
644
|
+
*/
|
|
645
|
+
function dotToSnake(input) {
|
|
646
|
+
return converter(input, "DotToSnake");
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to dash-case.
|
|
650
|
+
*
|
|
651
|
+
* @example
|
|
652
|
+
* ```ts
|
|
653
|
+
* dotToDash('hello.world'); // 'hello-world'
|
|
654
|
+
* dotToDash({ 'first.name': 'John' }); // { 'first-name': 'John' }
|
|
655
|
+
* ```
|
|
656
|
+
*/
|
|
657
|
+
function dotToDash(input) {
|
|
658
|
+
return converter(input, "DotToDash");
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to UPPER_SNAKE_CASE.
|
|
662
|
+
*
|
|
663
|
+
* @example
|
|
664
|
+
* ```ts
|
|
665
|
+
* dotToUpperSnake('hello.world'); // 'HELLO_WORLD'
|
|
666
|
+
* dotToUpperSnake({ 'first.name': 'John' }); // { FIRST_NAME: 'John' }
|
|
667
|
+
* ```
|
|
668
|
+
*/
|
|
669
|
+
function dotToUpperSnake(input) {
|
|
670
|
+
return converter(input, "DotToUpperSnake");
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to UPPER-DASH-CASE.
|
|
674
|
+
*
|
|
675
|
+
* @example
|
|
676
|
+
* ```ts
|
|
677
|
+
* dotToUpperDash('hello.world'); // 'HELLO-WORLD'
|
|
678
|
+
* dotToUpperDash({ 'first.name': 'John' }); // { 'FIRST-NAME': 'John' }
|
|
679
|
+
* ```
|
|
680
|
+
*/
|
|
681
|
+
function dotToUpperDash(input) {
|
|
682
|
+
return converter(input, "DotToUpperDash");
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to Train-Case.
|
|
686
|
+
*
|
|
687
|
+
* @example
|
|
688
|
+
* ```ts
|
|
689
|
+
* dotToTrain('hello.world'); // 'Hello-World'
|
|
690
|
+
* dotToTrain({ 'first.name': 'John' }); // { 'First-Name': 'John' }
|
|
691
|
+
* ```
|
|
692
|
+
*/
|
|
693
|
+
function dotToTrain(input) {
|
|
694
|
+
return converter(input, "DotToTrain");
|
|
695
|
+
}
|
|
696
|
+
//#endregion
|
|
697
|
+
//#region src/upperDashCase/upperDashCase.ts
|
|
698
|
+
/**
|
|
699
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to camelCase.
|
|
700
|
+
*
|
|
701
|
+
* @example
|
|
702
|
+
* ```ts
|
|
703
|
+
* upperDashToCamel('HELLO-WORLD'); // 'helloWorld'
|
|
704
|
+
* upperDashToCamel({ 'FIRST-NAME': 'John' }); // { firstName: 'John' }
|
|
705
|
+
* ```
|
|
706
|
+
*/
|
|
707
|
+
function upperDashToCamel(input) {
|
|
708
|
+
return converter(input, "UpperDashToCamel");
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to snake_case.
|
|
712
|
+
*
|
|
713
|
+
* @example
|
|
714
|
+
* ```ts
|
|
715
|
+
* upperDashToSnake('HELLO-WORLD'); // 'hello_world'
|
|
716
|
+
* upperDashToSnake({ 'FIRST-NAME': 'John' }); // { first_name: 'John' }
|
|
717
|
+
* ```
|
|
718
|
+
*/
|
|
719
|
+
function upperDashToSnake(input) {
|
|
720
|
+
return converter(input, "UpperDashToSnake");
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to dash-case.
|
|
724
|
+
*
|
|
725
|
+
* @example
|
|
726
|
+
* ```ts
|
|
727
|
+
* upperDashToDash('HELLO-WORLD'); // 'hello-world'
|
|
728
|
+
* upperDashToDash({ 'FIRST-NAME': 'John' }); // { 'first-name': 'John' }
|
|
729
|
+
* ```
|
|
730
|
+
*/
|
|
731
|
+
function upperDashToDash(input) {
|
|
732
|
+
return converter(input, "UpperDashToDash");
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to PascalCase.
|
|
736
|
+
*
|
|
737
|
+
* @example
|
|
738
|
+
* ```ts
|
|
739
|
+
* upperDashToPascal('HELLO-WORLD'); // 'HelloWorld'
|
|
740
|
+
* upperDashToPascal({ 'FIRST-NAME': 'John' }); // { FirstName: 'John' }
|
|
741
|
+
* ```
|
|
742
|
+
*/
|
|
743
|
+
function upperDashToPascal(input) {
|
|
744
|
+
return converter(input, "UpperDashToPascal");
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to UPPER_SNAKE_CASE.
|
|
748
|
+
*
|
|
749
|
+
* @example
|
|
750
|
+
* ```ts
|
|
751
|
+
* upperDashToUpperSnake('HELLO-WORLD'); // 'HELLO_WORLD'
|
|
752
|
+
* upperDashToUpperSnake({ 'FIRST-NAME': 'John' }); // { FIRST_NAME: 'John' }
|
|
753
|
+
* ```
|
|
754
|
+
*/
|
|
755
|
+
function upperDashToUpperSnake(input) {
|
|
756
|
+
return converter(input, "UpperDashToUpperSnake");
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to Train-Case.
|
|
760
|
+
*
|
|
761
|
+
* @example
|
|
762
|
+
* ```ts
|
|
763
|
+
* upperDashToTrain('HELLO-WORLD'); // 'Hello-World'
|
|
764
|
+
* upperDashToTrain({ 'FIRST-NAME': 'John' }); // { 'First-Name': 'John' }
|
|
765
|
+
* ```
|
|
766
|
+
*/
|
|
767
|
+
function upperDashToTrain(input) {
|
|
768
|
+
return converter(input, "UpperDashToTrain");
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to dot.case.
|
|
772
|
+
*
|
|
773
|
+
* @example
|
|
774
|
+
* ```ts
|
|
775
|
+
* upperDashToDot('HELLO-WORLD'); // 'hello.world'
|
|
776
|
+
* upperDashToDot({ 'FIRST-NAME': 'John' }); // { 'first.name': 'John' }
|
|
777
|
+
* ```
|
|
778
|
+
*/
|
|
779
|
+
function upperDashToDot(input) {
|
|
780
|
+
return converter(input, "UpperDashToDot");
|
|
781
|
+
}
|
|
782
|
+
//#endregion
|
|
783
|
+
//#region src/upperSnakeCase/upperSnakeCase.ts
|
|
784
|
+
/**
|
|
785
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to camelCase.
|
|
786
|
+
*
|
|
787
|
+
* @example
|
|
788
|
+
* ```ts
|
|
789
|
+
* upperSnakeToCamel('HELLO_WORLD'); // 'helloWorld'
|
|
790
|
+
* upperSnakeToCamel({ FIRST_NAME: 'John' }); // { firstName: 'John' }
|
|
791
|
+
* ```
|
|
792
|
+
*/
|
|
793
|
+
function upperSnakeToCamel(input) {
|
|
794
|
+
return converter(input, "UpperSnakeToCamel");
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to snake_case.
|
|
798
|
+
*
|
|
799
|
+
* @example
|
|
800
|
+
* ```ts
|
|
801
|
+
* upperSnakeToSnake('HELLO_WORLD'); // 'hello_world'
|
|
802
|
+
* upperSnakeToSnake({ FIRST_NAME: 'John' }); // { first_name: 'John' }
|
|
803
|
+
* ```
|
|
804
|
+
*/
|
|
805
|
+
function upperSnakeToSnake(input) {
|
|
806
|
+
return converter(input, "UpperSnakeToSnake");
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to dash-case.
|
|
810
|
+
*
|
|
811
|
+
* @example
|
|
812
|
+
* ```ts
|
|
813
|
+
* upperSnakeToDash('HELLO_WORLD'); // 'hello-world'
|
|
814
|
+
* upperSnakeToDash({ FIRST_NAME: 'John' }); // { 'first-name': 'John' }
|
|
815
|
+
* ```
|
|
816
|
+
*/
|
|
817
|
+
function upperSnakeToDash(input) {
|
|
818
|
+
return converter(input, "UpperSnakeToDash");
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to PascalCase.
|
|
822
|
+
*
|
|
823
|
+
* @example
|
|
824
|
+
* ```ts
|
|
825
|
+
* upperSnakeToPascal('HELLO_WORLD'); // 'HelloWorld'
|
|
826
|
+
* upperSnakeToPascal({ FIRST_NAME: 'John' }); // { FirstName: 'John' }
|
|
827
|
+
* ```
|
|
828
|
+
*/
|
|
829
|
+
function upperSnakeToPascal(input) {
|
|
830
|
+
return converter(input, "UpperSnakeToPascal");
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to UPPER-DASH-CASE.
|
|
834
|
+
*
|
|
835
|
+
* @example
|
|
836
|
+
* ```ts
|
|
837
|
+
* upperSnakeToUpperDash('HELLO_WORLD'); // 'HELLO-WORLD'
|
|
838
|
+
* upperSnakeToUpperDash({ FIRST_NAME: 'John' }); // { 'FIRST-NAME': 'John' }
|
|
839
|
+
* ```
|
|
840
|
+
*/
|
|
841
|
+
function upperSnakeToUpperDash(input) {
|
|
842
|
+
return converter(input, "UpperSnakeToUpperDash");
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to Train-Case.
|
|
846
|
+
*
|
|
847
|
+
* @example
|
|
848
|
+
* ```ts
|
|
849
|
+
* upperSnakeToTrain('HELLO_WORLD'); // 'Hello-World'
|
|
850
|
+
* upperSnakeToTrain({ FIRST_NAME: 'John' }); // { 'First-Name': 'John' }
|
|
851
|
+
* ```
|
|
852
|
+
*/
|
|
853
|
+
function upperSnakeToTrain(input) {
|
|
854
|
+
return converter(input, "UpperSnakeToTrain");
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to dot.case.
|
|
858
|
+
*
|
|
859
|
+
* @example
|
|
860
|
+
* ```ts
|
|
861
|
+
* upperSnakeToDot('HELLO_WORLD'); // 'hello.world'
|
|
862
|
+
* upperSnakeToDot({ FIRST_NAME: 'John' }); // { 'first.name': 'John' }
|
|
863
|
+
* ```
|
|
864
|
+
*/
|
|
865
|
+
function upperSnakeToDot(input) {
|
|
866
|
+
return converter(input, "UpperSnakeToDot");
|
|
867
|
+
}
|
|
868
|
+
//#endregion
|
|
869
|
+
exports.camelToDash = camelToDash;
|
|
870
|
+
exports.camelToDot = camelToDot;
|
|
871
|
+
exports.camelToPascal = camelToPascal;
|
|
872
|
+
exports.camelToSnake = camelToSnake;
|
|
873
|
+
exports.camelToTrain = camelToTrain;
|
|
874
|
+
exports.camelToUpperDash = camelToUpperDash;
|
|
875
|
+
exports.camelToUpperSnake = camelToUpperSnake;
|
|
876
|
+
exports.dashToCamel = dashToCamel;
|
|
877
|
+
exports.dashToDot = dashToDot;
|
|
878
|
+
exports.dashToPascal = dashToPascal;
|
|
879
|
+
exports.dashToSnake = dashToSnake;
|
|
880
|
+
exports.dashToTrain = dashToTrain;
|
|
881
|
+
exports.dashToUpperDash = dashToUpperDash;
|
|
882
|
+
exports.dashToUpperSnake = dashToUpperSnake;
|
|
883
|
+
exports.dotToCamel = dotToCamel;
|
|
884
|
+
exports.dotToDash = dotToDash;
|
|
885
|
+
exports.dotToPascal = dotToPascal;
|
|
886
|
+
exports.dotToSnake = dotToSnake;
|
|
887
|
+
exports.dotToTrain = dotToTrain;
|
|
888
|
+
exports.dotToUpperDash = dotToUpperDash;
|
|
889
|
+
exports.dotToUpperSnake = dotToUpperSnake;
|
|
890
|
+
exports.pascalToCamel = pascalToCamel;
|
|
891
|
+
exports.pascalToDash = pascalToDash;
|
|
892
|
+
exports.pascalToDot = pascalToDot;
|
|
893
|
+
exports.pascalToSnake = pascalToSnake;
|
|
894
|
+
exports.pascalToTrain = pascalToTrain;
|
|
895
|
+
exports.pascalToUpperDash = pascalToUpperDash;
|
|
896
|
+
exports.pascalToUpperSnake = pascalToUpperSnake;
|
|
897
|
+
exports.snakeToCamel = snakeToCamel;
|
|
898
|
+
exports.snakeToDash = snakeToDash;
|
|
899
|
+
exports.snakeToDot = snakeToDot;
|
|
900
|
+
exports.snakeToPascal = snakeToPascal;
|
|
901
|
+
exports.snakeToTrain = snakeToTrain;
|
|
902
|
+
exports.snakeToUpperDash = snakeToUpperDash;
|
|
903
|
+
exports.snakeToUpperSnake = snakeToUpperSnake;
|
|
904
|
+
exports.trainToCamel = trainToCamel;
|
|
905
|
+
exports.trainToDash = trainToDash;
|
|
906
|
+
exports.trainToDot = trainToDot;
|
|
907
|
+
exports.trainToPascal = trainToPascal;
|
|
908
|
+
exports.trainToSnake = trainToSnake;
|
|
909
|
+
exports.trainToUpperDash = trainToUpperDash;
|
|
910
|
+
exports.trainToUpperSnake = trainToUpperSnake;
|
|
911
|
+
exports.upperDashToCamel = upperDashToCamel;
|
|
912
|
+
exports.upperDashToDash = upperDashToDash;
|
|
913
|
+
exports.upperDashToDot = upperDashToDot;
|
|
914
|
+
exports.upperDashToPascal = upperDashToPascal;
|
|
915
|
+
exports.upperDashToSnake = upperDashToSnake;
|
|
916
|
+
exports.upperDashToTrain = upperDashToTrain;
|
|
917
|
+
exports.upperDashToUpperSnake = upperDashToUpperSnake;
|
|
918
|
+
exports.upperSnakeToCamel = upperSnakeToCamel;
|
|
919
|
+
exports.upperSnakeToDash = upperSnakeToDash;
|
|
920
|
+
exports.upperSnakeToDot = upperSnakeToDot;
|
|
921
|
+
exports.upperSnakeToPascal = upperSnakeToPascal;
|
|
922
|
+
exports.upperSnakeToSnake = upperSnakeToSnake;
|
|
923
|
+
exports.upperSnakeToTrain = upperSnakeToTrain;
|
|
924
|
+
exports.upperSnakeToUpperDash = upperSnakeToUpperDash;
|