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.js
CHANGED
|
@@ -27,31 +27,91 @@ const CamelToPascal = (str) => Capitalize(str);
|
|
|
27
27
|
const CamelToSnake = (str) => str.replace(/([A-Z])/g, (g) => "_" + g[0].toLowerCase());
|
|
28
28
|
const CamelToUpperDash = (str) => Uppercase(CamelToDash(str));
|
|
29
29
|
const CamelToUpperSnake = (str) => Uppercase(CamelToSnake(str));
|
|
30
|
+
const CamelToTrain = (str) => DashToTrain(CamelToDash(str));
|
|
31
|
+
const CamelToDot = (str) => DashToDot(CamelToDash(str));
|
|
30
32
|
const DashToCamel = (str) => str.replace(/(\-\w)/g, (g) => g[1].toUpperCase());
|
|
31
33
|
const DashToPascal = (str) => Capitalize(DashToCamel(str));
|
|
32
34
|
const DashToSnake = (str) => str.replace(/(\-)/g, "_");
|
|
33
35
|
const DashToUpperDash = (str) => Uppercase(str);
|
|
34
36
|
const DashToUpperSnake = (str) => Uppercase(DashToSnake(str));
|
|
37
|
+
const DashToTrain = (str) => str.split("-").map(Capitalize).join("-");
|
|
38
|
+
const DashToDot = (str) => str.replace(/(\-)/g, ".");
|
|
35
39
|
const PascalToCamel = (str) => Uncapitalize(str);
|
|
36
40
|
const PascalToDash = (str) => CamelToDash(Uncapitalize(str));
|
|
37
41
|
const PascalToSnake = (str) => CamelToSnake(Uncapitalize(str));
|
|
38
42
|
const PascalToUpperDash = (str) => Uppercase(PascalToDash(str));
|
|
39
43
|
const PascalToUpperSnake = (str) => Uppercase(PascalToSnake(str));
|
|
44
|
+
const PascalToTrain = (str) => DashToTrain(PascalToDash(str));
|
|
45
|
+
const PascalToDot = (str) => DashToDot(PascalToDash(str));
|
|
40
46
|
const SnakeToCamel = (str) => str.replace(/(\_\w)/g, (g) => g[1].toUpperCase());
|
|
41
47
|
const SnakeToDash = (str) => str.replace(/(\_)/g, "-");
|
|
42
48
|
const SnakeToPascal = (str) => Capitalize(SnakeToCamel(str));
|
|
43
49
|
const SnakeToUpperDash = (str) => Uppercase(SnakeToDash(str));
|
|
50
|
+
const SnakeToTrain = (str) => DashToTrain(SnakeToDash(str));
|
|
51
|
+
const SnakeToDot = (str) => DashToDot(SnakeToDash(str));
|
|
44
52
|
const SnakeToUpperSnake = (str) => Uppercase(str);
|
|
45
53
|
const UpperDashToCamel = (str) => DashToCamel(Lowercase(str));
|
|
46
54
|
const UpperDashToDash = (str) => Lowercase(str);
|
|
47
55
|
const UpperDashToPascal = (str) => Capitalize(UpperDashToCamel(str));
|
|
48
56
|
const UpperDashToSnake = (str) => DashToSnake(UpperDashToDash(str));
|
|
49
57
|
const UpperDashToUpperSnake = (str) => Uppercase(UpperDashToSnake(str));
|
|
58
|
+
const UpperDashToTrain = (str) => DashToTrain(UpperDashToDash(str));
|
|
59
|
+
const UpperDashToDot = (str) => DashToDot(UpperDashToDash(str));
|
|
50
60
|
const UpperSnakeToCamel = (str) => SnakeToCamel(Lowercase(str));
|
|
51
61
|
const UpperSnakeToDash = (str) => str.replace(/(\_)/g, "-").toLowerCase();
|
|
52
62
|
const UpperSnakeToPascal = (str) => SnakeToPascal(Lowercase(str));
|
|
53
63
|
const UpperSnakeToSnake = (str) => Lowercase(str);
|
|
54
64
|
const UpperSnakeToUpperDash = (str) => Uppercase(UpperSnakeToDash(str));
|
|
65
|
+
const UpperSnakeToTrain = (str) => DashToTrain(UpperSnakeToDash(str));
|
|
66
|
+
const UpperSnakeToDot = (str) => DashToDot(UpperSnakeToDash(str));
|
|
67
|
+
const TrainToCamel = (str) => DashToCamel(TrainToDash(str));
|
|
68
|
+
const TrainToDash = (str) => Lowercase(str);
|
|
69
|
+
const TrainToDot = (str) => DashToDot(TrainToDash(str));
|
|
70
|
+
const TrainToPascal = (str) => DashToPascal(TrainToDash(str));
|
|
71
|
+
const TrainToSnake = (str) => DashToSnake(TrainToDash(str));
|
|
72
|
+
const TrainToUpperDash = (str) => Uppercase(str);
|
|
73
|
+
const TrainToUpperSnake = (str) => DashToUpperSnake(TrainToDash(str));
|
|
74
|
+
const DotToCamel = (str) => DashToCamel(DotToDash(str));
|
|
75
|
+
const DotToDash = (str) => str.replace(/(\.)/g, "-");
|
|
76
|
+
const DotToPascal = (str) => DashToPascal(DotToDash(str));
|
|
77
|
+
const DotToSnake = (str) => DashToSnake(DotToDash(str));
|
|
78
|
+
const DotToTrain = (str) => DashToTrain(DotToDash(str));
|
|
79
|
+
const DotToUpperDash = (str) => Uppercase(DotToDash(str));
|
|
80
|
+
const DotToUpperSnake = (str) => DashToUpperSnake(DotToDash(str));
|
|
81
|
+
const DashToTitle = (str) => str.split("-").map(Capitalize).join(" ");
|
|
82
|
+
const DashToSentence = (str) => Capitalize(str.replace(/(\-)/g, " "));
|
|
83
|
+
const CamelToTitle = (str) => DashToTitle(CamelToDash(str));
|
|
84
|
+
const CamelToSentence = (str) => DashToSentence(CamelToDash(str));
|
|
85
|
+
const PascalToTitle = (str) => DashToTitle(PascalToDash(str));
|
|
86
|
+
const PascalToSentence = (str) => DashToSentence(PascalToDash(str));
|
|
87
|
+
const SnakeToTitle = (str) => DashToTitle(SnakeToDash(str));
|
|
88
|
+
const SnakeToSentence = (str) => DashToSentence(SnakeToDash(str));
|
|
89
|
+
const UpperSnakeToTitle = (str) => DashToTitle(UpperSnakeToDash(str));
|
|
90
|
+
const UpperSnakeToSentence = (str) => DashToSentence(UpperSnakeToDash(str));
|
|
91
|
+
const UpperDashToTitle = (str) => DashToTitle(UpperDashToDash(str));
|
|
92
|
+
const UpperDashToSentence = (str) => DashToSentence(UpperDashToDash(str));
|
|
93
|
+
const TrainToTitle = (str) => DashToTitle(TrainToDash(str));
|
|
94
|
+
const TrainToSentence = (str) => DashToSentence(TrainToDash(str));
|
|
95
|
+
const DotToTitle = (str) => DashToTitle(DotToDash(str));
|
|
96
|
+
const DotToSentence = (str) => DashToSentence(DotToDash(str));
|
|
97
|
+
const TitleToDash = (str) => Lowercase(str).replace(/( )/g, "-");
|
|
98
|
+
const TitleToCamel = (str) => DashToCamel(TitleToDash(str));
|
|
99
|
+
const TitleToPascal = (str) => DashToPascal(TitleToDash(str));
|
|
100
|
+
const TitleToSnake = (str) => DashToSnake(TitleToDash(str));
|
|
101
|
+
const TitleToUpperSnake = (str) => DashToUpperSnake(TitleToDash(str));
|
|
102
|
+
const TitleToUpperDash = (str) => DashToUpperDash(TitleToDash(str));
|
|
103
|
+
const TitleToTrain = (str) => DashToTrain(TitleToDash(str));
|
|
104
|
+
const TitleToDot = (str) => DashToDot(TitleToDash(str));
|
|
105
|
+
const TitleToSentence = (str) => DashToSentence(TitleToDash(str));
|
|
106
|
+
const SentenceToDash = (str) => Lowercase(str).replace(/( )/g, "-");
|
|
107
|
+
const SentenceToCamel = (str) => DashToCamel(SentenceToDash(str));
|
|
108
|
+
const SentenceToPascal = (str) => DashToPascal(SentenceToDash(str));
|
|
109
|
+
const SentenceToSnake = (str) => DashToSnake(SentenceToDash(str));
|
|
110
|
+
const SentenceToUpperSnake = (str) => DashToUpperSnake(SentenceToDash(str));
|
|
111
|
+
const SentenceToUpperDash = (str) => DashToUpperDash(SentenceToDash(str));
|
|
112
|
+
const SentenceToTrain = (str) => DashToTrain(SentenceToDash(str));
|
|
113
|
+
const SentenceToDot = (str) => DashToDot(SentenceToDash(str));
|
|
114
|
+
const SentenceToTitle = (str) => DashToTitle(SentenceToDash(str));
|
|
55
115
|
function parse(input, type) {
|
|
56
116
|
return {
|
|
57
117
|
CamelToDash,
|
|
@@ -83,7 +143,67 @@ function parse(input, type) {
|
|
|
83
143
|
UpperDashToSnake,
|
|
84
144
|
UpperDashToDash,
|
|
85
145
|
UpperDashToPascal,
|
|
86
|
-
UpperDashToUpperSnake
|
|
146
|
+
UpperDashToUpperSnake,
|
|
147
|
+
CamelToTrain,
|
|
148
|
+
CamelToDot,
|
|
149
|
+
PascalToTrain,
|
|
150
|
+
PascalToDot,
|
|
151
|
+
SnakeToTrain,
|
|
152
|
+
SnakeToDot,
|
|
153
|
+
DashToTrain,
|
|
154
|
+
DashToDot,
|
|
155
|
+
UpperSnakeToTrain,
|
|
156
|
+
UpperSnakeToDot,
|
|
157
|
+
UpperDashToTrain,
|
|
158
|
+
UpperDashToDot,
|
|
159
|
+
TrainToCamel,
|
|
160
|
+
TrainToPascal,
|
|
161
|
+
TrainToSnake,
|
|
162
|
+
TrainToDash,
|
|
163
|
+
TrainToUpperSnake,
|
|
164
|
+
TrainToUpperDash,
|
|
165
|
+
TrainToDot,
|
|
166
|
+
DotToCamel,
|
|
167
|
+
DotToPascal,
|
|
168
|
+
DotToSnake,
|
|
169
|
+
DotToDash,
|
|
170
|
+
DotToUpperSnake,
|
|
171
|
+
DotToUpperDash,
|
|
172
|
+
DotToTrain,
|
|
173
|
+
CamelToTitle,
|
|
174
|
+
CamelToSentence,
|
|
175
|
+
PascalToTitle,
|
|
176
|
+
PascalToSentence,
|
|
177
|
+
SnakeToTitle,
|
|
178
|
+
SnakeToSentence,
|
|
179
|
+
DashToTitle,
|
|
180
|
+
DashToSentence,
|
|
181
|
+
UpperSnakeToTitle,
|
|
182
|
+
UpperSnakeToSentence,
|
|
183
|
+
UpperDashToTitle,
|
|
184
|
+
UpperDashToSentence,
|
|
185
|
+
TrainToTitle,
|
|
186
|
+
TrainToSentence,
|
|
187
|
+
DotToTitle,
|
|
188
|
+
DotToSentence,
|
|
189
|
+
TitleToCamel,
|
|
190
|
+
TitleToPascal,
|
|
191
|
+
TitleToSnake,
|
|
192
|
+
TitleToDash,
|
|
193
|
+
TitleToUpperSnake,
|
|
194
|
+
TitleToUpperDash,
|
|
195
|
+
TitleToTrain,
|
|
196
|
+
TitleToDot,
|
|
197
|
+
TitleToSentence,
|
|
198
|
+
SentenceToCamel,
|
|
199
|
+
SentenceToPascal,
|
|
200
|
+
SentenceToSnake,
|
|
201
|
+
SentenceToDash,
|
|
202
|
+
SentenceToUpperSnake,
|
|
203
|
+
SentenceToUpperDash,
|
|
204
|
+
SentenceToTrain,
|
|
205
|
+
SentenceToDot,
|
|
206
|
+
SentenceToTitle
|
|
87
207
|
}[type](input);
|
|
88
208
|
}
|
|
89
209
|
//#endregion
|
|
@@ -186,6 +306,54 @@ function camelToUpperSnake(input) {
|
|
|
186
306
|
function camelToUpperDash(input) {
|
|
187
307
|
return converter(input, "CamelToUpperDash");
|
|
188
308
|
}
|
|
309
|
+
/**
|
|
310
|
+
* Converts a string, or the keys of an object/array (deeply), from camelCase to Train-Case.
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```ts
|
|
314
|
+
* camelToTrain('helloWorld'); // 'Hello-World'
|
|
315
|
+
* camelToTrain({ firstName: 'John' }); // { 'First-Name': 'John' }
|
|
316
|
+
* ```
|
|
317
|
+
*/
|
|
318
|
+
function camelToTrain(input) {
|
|
319
|
+
return converter(input, "CamelToTrain");
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Converts a string, or the keys of an object/array (deeply), from camelCase to dot.case.
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* ```ts
|
|
326
|
+
* camelToDot('helloWorld'); // 'hello.world'
|
|
327
|
+
* camelToDot({ firstName: 'John' }); // { 'first.name': 'John' }
|
|
328
|
+
* ```
|
|
329
|
+
*/
|
|
330
|
+
function camelToDot(input) {
|
|
331
|
+
return converter(input, "CamelToDot");
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Converts a string, or the keys of an object/array (deeply), from camelCase to Title Case.
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* ```ts
|
|
338
|
+
* camelToTitle('helloWorld'); // 'Hello World'
|
|
339
|
+
* camelToTitle({ firstName: 'John' }); // { 'First Name': 'John' }
|
|
340
|
+
* ```
|
|
341
|
+
*/
|
|
342
|
+
function camelToTitle(input) {
|
|
343
|
+
return converter(input, "CamelToTitle");
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Converts a string, or the keys of an object/array (deeply), from camelCase to Sentence case.
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* ```ts
|
|
350
|
+
* camelToSentence('helloWorld'); // 'Hello world'
|
|
351
|
+
* camelToSentence({ firstName: 'John' }); // { 'First name': 'John' }
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
function camelToSentence(input) {
|
|
355
|
+
return converter(input, "CamelToSentence");
|
|
356
|
+
}
|
|
189
357
|
//#endregion
|
|
190
358
|
//#region src/dashCase/dashCase.ts
|
|
191
359
|
/**
|
|
@@ -248,6 +416,54 @@ function dashToUpperSnake(input) {
|
|
|
248
416
|
function dashToUpperDash(input) {
|
|
249
417
|
return converter(input, "DashToUpperDash");
|
|
250
418
|
}
|
|
419
|
+
/**
|
|
420
|
+
* Converts a string, or the keys of an object/array (deeply), from dash-case to Train-Case.
|
|
421
|
+
*
|
|
422
|
+
* @example
|
|
423
|
+
* ```ts
|
|
424
|
+
* dashToTrain('hello-world'); // 'Hello-World'
|
|
425
|
+
* dashToTrain({ 'first-name': 'John' }); // { 'First-Name': 'John' }
|
|
426
|
+
* ```
|
|
427
|
+
*/
|
|
428
|
+
function dashToTrain(input) {
|
|
429
|
+
return converter(input, "DashToTrain");
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Converts a string, or the keys of an object/array (deeply), from dash-case to dot.case.
|
|
433
|
+
*
|
|
434
|
+
* @example
|
|
435
|
+
* ```ts
|
|
436
|
+
* dashToDot('hello-world'); // 'hello.world'
|
|
437
|
+
* dashToDot({ 'first-name': 'John' }); // { 'first.name': 'John' }
|
|
438
|
+
* ```
|
|
439
|
+
*/
|
|
440
|
+
function dashToDot(input) {
|
|
441
|
+
return converter(input, "DashToDot");
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Converts a string, or the keys of an object/array (deeply), from dash-case to Title Case.
|
|
445
|
+
*
|
|
446
|
+
* @example
|
|
447
|
+
* ```ts
|
|
448
|
+
* dashToTitle('hello-world'); // 'Hello World'
|
|
449
|
+
* dashToTitle({ 'first-name': 'John' }); // { 'First Name': 'John' }
|
|
450
|
+
* ```
|
|
451
|
+
*/
|
|
452
|
+
function dashToTitle(input) {
|
|
453
|
+
return converter(input, "DashToTitle");
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Converts a string, or the keys of an object/array (deeply), from dash-case to Sentence case.
|
|
457
|
+
*
|
|
458
|
+
* @example
|
|
459
|
+
* ```ts
|
|
460
|
+
* dashToSentence('hello-world'); // 'Hello world'
|
|
461
|
+
* dashToSentence({ 'first-name': 'John' }); // { 'First name': 'John' }
|
|
462
|
+
* ```
|
|
463
|
+
*/
|
|
464
|
+
function dashToSentence(input) {
|
|
465
|
+
return converter(input, "DashToSentence");
|
|
466
|
+
}
|
|
251
467
|
//#endregion
|
|
252
468
|
//#region src/pascalCase/pascalCase.ts
|
|
253
469
|
/**
|
|
@@ -310,6 +526,54 @@ function pascalToUpperSnake(input) {
|
|
|
310
526
|
function pascalToUpperDash(input) {
|
|
311
527
|
return converter(input, "PascalToUpperDash");
|
|
312
528
|
}
|
|
529
|
+
/**
|
|
530
|
+
* Converts a string, or the keys of an object/array (deeply), from PascalCase to Train-Case.
|
|
531
|
+
*
|
|
532
|
+
* @example
|
|
533
|
+
* ```ts
|
|
534
|
+
* pascalToTrain('HelloWorld'); // 'Hello-World'
|
|
535
|
+
* pascalToTrain({ FirstName: 'John' }); // { 'First-Name': 'John' }
|
|
536
|
+
* ```
|
|
537
|
+
*/
|
|
538
|
+
function pascalToTrain(input) {
|
|
539
|
+
return converter(input, "PascalToTrain");
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Converts a string, or the keys of an object/array (deeply), from PascalCase to dot.case.
|
|
543
|
+
*
|
|
544
|
+
* @example
|
|
545
|
+
* ```ts
|
|
546
|
+
* pascalToDot('HelloWorld'); // 'hello.world'
|
|
547
|
+
* pascalToDot({ FirstName: 'John' }); // { 'first.name': 'John' }
|
|
548
|
+
* ```
|
|
549
|
+
*/
|
|
550
|
+
function pascalToDot(input) {
|
|
551
|
+
return converter(input, "PascalToDot");
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Converts a string, or the keys of an object/array (deeply), from PascalCase to Title Case.
|
|
555
|
+
*
|
|
556
|
+
* @example
|
|
557
|
+
* ```ts
|
|
558
|
+
* pascalToTitle('HelloWorld'); // 'Hello World'
|
|
559
|
+
* pascalToTitle({ FirstName: 'John' }); // { 'First Name': 'John' }
|
|
560
|
+
* ```
|
|
561
|
+
*/
|
|
562
|
+
function pascalToTitle(input) {
|
|
563
|
+
return converter(input, "PascalToTitle");
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Converts a string, or the keys of an object/array (deeply), from PascalCase to Sentence case.
|
|
567
|
+
*
|
|
568
|
+
* @example
|
|
569
|
+
* ```ts
|
|
570
|
+
* pascalToSentence('HelloWorld'); // 'Hello world'
|
|
571
|
+
* pascalToSentence({ FirstName: 'John' }); // { 'First name': 'John' }
|
|
572
|
+
* ```
|
|
573
|
+
*/
|
|
574
|
+
function pascalToSentence(input) {
|
|
575
|
+
return converter(input, "PascalToSentence");
|
|
576
|
+
}
|
|
313
577
|
//#endregion
|
|
314
578
|
//#region src/snakeCase/snakeCase.ts
|
|
315
579
|
/**
|
|
@@ -372,6 +636,494 @@ function snakeToUpperSnake(input) {
|
|
|
372
636
|
function snakeToUpperDash(input) {
|
|
373
637
|
return converter(input, "SnakeToUpperDash");
|
|
374
638
|
}
|
|
639
|
+
/**
|
|
640
|
+
* Converts a string, or the keys of an object/array (deeply), from snake_case to Train-Case.
|
|
641
|
+
*
|
|
642
|
+
* @example
|
|
643
|
+
* ```ts
|
|
644
|
+
* snakeToTrain('hello_world'); // 'Hello-World'
|
|
645
|
+
* snakeToTrain({ first_name: 'John' }); // { 'First-Name': 'John' }
|
|
646
|
+
* ```
|
|
647
|
+
*/
|
|
648
|
+
function snakeToTrain(input) {
|
|
649
|
+
return converter(input, "SnakeToTrain");
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Converts a string, or the keys of an object/array (deeply), from snake_case to dot.case.
|
|
653
|
+
*
|
|
654
|
+
* @example
|
|
655
|
+
* ```ts
|
|
656
|
+
* snakeToDot('hello_world'); // 'hello.world'
|
|
657
|
+
* snakeToDot({ first_name: 'John' }); // { 'first.name': 'John' }
|
|
658
|
+
* ```
|
|
659
|
+
*/
|
|
660
|
+
function snakeToDot(input) {
|
|
661
|
+
return converter(input, "SnakeToDot");
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Converts a string, or the keys of an object/array (deeply), from snake_case to Title Case.
|
|
665
|
+
*
|
|
666
|
+
* @example
|
|
667
|
+
* ```ts
|
|
668
|
+
* snakeToTitle('hello_world'); // 'Hello World'
|
|
669
|
+
* snakeToTitle({ first_name: 'John' }); // { 'First Name': 'John' }
|
|
670
|
+
* ```
|
|
671
|
+
*/
|
|
672
|
+
function snakeToTitle(input) {
|
|
673
|
+
return converter(input, "SnakeToTitle");
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Converts a string, or the keys of an object/array (deeply), from snake_case to Sentence case.
|
|
677
|
+
*
|
|
678
|
+
* @example
|
|
679
|
+
* ```ts
|
|
680
|
+
* snakeToSentence('hello_world'); // 'Hello world'
|
|
681
|
+
* snakeToSentence({ first_name: 'John' }); // { 'First name': 'John' }
|
|
682
|
+
* ```
|
|
683
|
+
*/
|
|
684
|
+
function snakeToSentence(input) {
|
|
685
|
+
return converter(input, "SnakeToSentence");
|
|
686
|
+
}
|
|
687
|
+
//#endregion
|
|
688
|
+
//#region src/trainCase/trainCase.ts
|
|
689
|
+
/**
|
|
690
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to camelCase.
|
|
691
|
+
*
|
|
692
|
+
* @example
|
|
693
|
+
* ```ts
|
|
694
|
+
* trainToCamel('Hello-World'); // 'helloWorld'
|
|
695
|
+
* trainToCamel({ 'First-Name': 'John' }); // { firstName: 'John' }
|
|
696
|
+
* ```
|
|
697
|
+
*/
|
|
698
|
+
function trainToCamel(input) {
|
|
699
|
+
return converter(input, "TrainToCamel");
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to PascalCase.
|
|
703
|
+
*
|
|
704
|
+
* @example
|
|
705
|
+
* ```ts
|
|
706
|
+
* trainToPascal('Hello-World'); // 'HelloWorld'
|
|
707
|
+
* trainToPascal({ 'First-Name': 'John' }); // { FirstName: 'John' }
|
|
708
|
+
* ```
|
|
709
|
+
*/
|
|
710
|
+
function trainToPascal(input) {
|
|
711
|
+
return converter(input, "TrainToPascal");
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to snake_case.
|
|
715
|
+
*
|
|
716
|
+
* @example
|
|
717
|
+
* ```ts
|
|
718
|
+
* trainToSnake('Hello-World'); // 'hello_world'
|
|
719
|
+
* trainToSnake({ 'First-Name': 'John' }); // { first_name: 'John' }
|
|
720
|
+
* ```
|
|
721
|
+
*/
|
|
722
|
+
function trainToSnake(input) {
|
|
723
|
+
return converter(input, "TrainToSnake");
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to dash-case.
|
|
727
|
+
*
|
|
728
|
+
* @example
|
|
729
|
+
* ```ts
|
|
730
|
+
* trainToDash('Hello-World'); // 'hello-world'
|
|
731
|
+
* trainToDash({ 'First-Name': 'John' }); // { 'first-name': 'John' }
|
|
732
|
+
* ```
|
|
733
|
+
*/
|
|
734
|
+
function trainToDash(input) {
|
|
735
|
+
return converter(input, "TrainToDash");
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to UPPER_SNAKE_CASE.
|
|
739
|
+
*
|
|
740
|
+
* @example
|
|
741
|
+
* ```ts
|
|
742
|
+
* trainToUpperSnake('Hello-World'); // 'HELLO_WORLD'
|
|
743
|
+
* trainToUpperSnake({ 'First-Name': 'John' }); // { FIRST_NAME: 'John' }
|
|
744
|
+
* ```
|
|
745
|
+
*/
|
|
746
|
+
function trainToUpperSnake(input) {
|
|
747
|
+
return converter(input, "TrainToUpperSnake");
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to UPPER-DASH-CASE.
|
|
751
|
+
*
|
|
752
|
+
* @example
|
|
753
|
+
* ```ts
|
|
754
|
+
* trainToUpperDash('Hello-World'); // 'HELLO-WORLD'
|
|
755
|
+
* trainToUpperDash({ 'First-Name': 'John' }); // { 'FIRST-NAME': 'John' }
|
|
756
|
+
* ```
|
|
757
|
+
*/
|
|
758
|
+
function trainToUpperDash(input) {
|
|
759
|
+
return converter(input, "TrainToUpperDash");
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to dot.case.
|
|
763
|
+
*
|
|
764
|
+
* @example
|
|
765
|
+
* ```ts
|
|
766
|
+
* trainToDot('Hello-World'); // 'hello.world'
|
|
767
|
+
* trainToDot({ 'First-Name': 'John' }); // { 'first.name': 'John' }
|
|
768
|
+
* ```
|
|
769
|
+
*/
|
|
770
|
+
function trainToDot(input) {
|
|
771
|
+
return converter(input, "TrainToDot");
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to Title Case.
|
|
775
|
+
*
|
|
776
|
+
* @example
|
|
777
|
+
* ```ts
|
|
778
|
+
* trainToTitle('Hello-World'); // 'Hello World'
|
|
779
|
+
* trainToTitle({ 'First-Name': 'John' }); // { 'First Name': 'John' }
|
|
780
|
+
* ```
|
|
781
|
+
*/
|
|
782
|
+
function trainToTitle(input) {
|
|
783
|
+
return converter(input, "TrainToTitle");
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Converts a string, or the keys of an object/array (deeply), from Train-Case to Sentence case.
|
|
787
|
+
*
|
|
788
|
+
* @example
|
|
789
|
+
* ```ts
|
|
790
|
+
* trainToSentence('Hello-World'); // 'Hello world'
|
|
791
|
+
* trainToSentence({ 'First-Name': 'John' }); // { 'First name': 'John' }
|
|
792
|
+
* ```
|
|
793
|
+
*/
|
|
794
|
+
function trainToSentence(input) {
|
|
795
|
+
return converter(input, "TrainToSentence");
|
|
796
|
+
}
|
|
797
|
+
//#endregion
|
|
798
|
+
//#region src/dotCase/dotCase.ts
|
|
799
|
+
/**
|
|
800
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to camelCase.
|
|
801
|
+
*
|
|
802
|
+
* @example
|
|
803
|
+
* ```ts
|
|
804
|
+
* dotToCamel('hello.world'); // 'helloWorld'
|
|
805
|
+
* dotToCamel({ 'first.name': 'John' }); // { firstName: 'John' }
|
|
806
|
+
* ```
|
|
807
|
+
*/
|
|
808
|
+
function dotToCamel(input) {
|
|
809
|
+
return converter(input, "DotToCamel");
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to PascalCase.
|
|
813
|
+
*
|
|
814
|
+
* @example
|
|
815
|
+
* ```ts
|
|
816
|
+
* dotToPascal('hello.world'); // 'HelloWorld'
|
|
817
|
+
* dotToPascal({ 'first.name': 'John' }); // { FirstName: 'John' }
|
|
818
|
+
* ```
|
|
819
|
+
*/
|
|
820
|
+
function dotToPascal(input) {
|
|
821
|
+
return converter(input, "DotToPascal");
|
|
822
|
+
}
|
|
823
|
+
/**
|
|
824
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to snake_case.
|
|
825
|
+
*
|
|
826
|
+
* @example
|
|
827
|
+
* ```ts
|
|
828
|
+
* dotToSnake('hello.world'); // 'hello_world'
|
|
829
|
+
* dotToSnake({ 'first.name': 'John' }); // { first_name: 'John' }
|
|
830
|
+
* ```
|
|
831
|
+
*/
|
|
832
|
+
function dotToSnake(input) {
|
|
833
|
+
return converter(input, "DotToSnake");
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to dash-case.
|
|
837
|
+
*
|
|
838
|
+
* @example
|
|
839
|
+
* ```ts
|
|
840
|
+
* dotToDash('hello.world'); // 'hello-world'
|
|
841
|
+
* dotToDash({ 'first.name': 'John' }); // { 'first-name': 'John' }
|
|
842
|
+
* ```
|
|
843
|
+
*/
|
|
844
|
+
function dotToDash(input) {
|
|
845
|
+
return converter(input, "DotToDash");
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to UPPER_SNAKE_CASE.
|
|
849
|
+
*
|
|
850
|
+
* @example
|
|
851
|
+
* ```ts
|
|
852
|
+
* dotToUpperSnake('hello.world'); // 'HELLO_WORLD'
|
|
853
|
+
* dotToUpperSnake({ 'first.name': 'John' }); // { FIRST_NAME: 'John' }
|
|
854
|
+
* ```
|
|
855
|
+
*/
|
|
856
|
+
function dotToUpperSnake(input) {
|
|
857
|
+
return converter(input, "DotToUpperSnake");
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to UPPER-DASH-CASE.
|
|
861
|
+
*
|
|
862
|
+
* @example
|
|
863
|
+
* ```ts
|
|
864
|
+
* dotToUpperDash('hello.world'); // 'HELLO-WORLD'
|
|
865
|
+
* dotToUpperDash({ 'first.name': 'John' }); // { 'FIRST-NAME': 'John' }
|
|
866
|
+
* ```
|
|
867
|
+
*/
|
|
868
|
+
function dotToUpperDash(input) {
|
|
869
|
+
return converter(input, "DotToUpperDash");
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to Train-Case.
|
|
873
|
+
*
|
|
874
|
+
* @example
|
|
875
|
+
* ```ts
|
|
876
|
+
* dotToTrain('hello.world'); // 'Hello-World'
|
|
877
|
+
* dotToTrain({ 'first.name': 'John' }); // { 'First-Name': 'John' }
|
|
878
|
+
* ```
|
|
879
|
+
*/
|
|
880
|
+
function dotToTrain(input) {
|
|
881
|
+
return converter(input, "DotToTrain");
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to Title Case.
|
|
885
|
+
*
|
|
886
|
+
* @example
|
|
887
|
+
* ```ts
|
|
888
|
+
* dotToTitle('hello.world'); // 'Hello World'
|
|
889
|
+
* dotToTitle({ 'first.name': 'John' }); // { 'First Name': 'John' }
|
|
890
|
+
* ```
|
|
891
|
+
*/
|
|
892
|
+
function dotToTitle(input) {
|
|
893
|
+
return converter(input, "DotToTitle");
|
|
894
|
+
}
|
|
895
|
+
/**
|
|
896
|
+
* Converts a string, or the keys of an object/array (deeply), from dot.case to Sentence case.
|
|
897
|
+
*
|
|
898
|
+
* @example
|
|
899
|
+
* ```ts
|
|
900
|
+
* dotToSentence('hello.world'); // 'Hello world'
|
|
901
|
+
* dotToSentence({ 'first.name': 'John' }); // { 'First name': 'John' }
|
|
902
|
+
* ```
|
|
903
|
+
*/
|
|
904
|
+
function dotToSentence(input) {
|
|
905
|
+
return converter(input, "DotToSentence");
|
|
906
|
+
}
|
|
907
|
+
//#endregion
|
|
908
|
+
//#region src/titleCase/titleCase.ts
|
|
909
|
+
/**
|
|
910
|
+
* Converts a string, or the keys of an object/array (deeply), from Title Case to camelCase.
|
|
911
|
+
*
|
|
912
|
+
* @example
|
|
913
|
+
* ```ts
|
|
914
|
+
* titleToCamel('Hello World'); // 'helloWorld'
|
|
915
|
+
* titleToCamel({ 'First Name': 'John' }); // { firstName: 'John' }
|
|
916
|
+
* ```
|
|
917
|
+
*/
|
|
918
|
+
function titleToCamel(input) {
|
|
919
|
+
return converter(input, "TitleToCamel");
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* Converts a string, or the keys of an object/array (deeply), from Title Case to PascalCase.
|
|
923
|
+
*
|
|
924
|
+
* @example
|
|
925
|
+
* ```ts
|
|
926
|
+
* titleToPascal('Hello World'); // 'HelloWorld'
|
|
927
|
+
* titleToPascal({ 'First Name': 'John' }); // { FirstName: 'John' }
|
|
928
|
+
* ```
|
|
929
|
+
*/
|
|
930
|
+
function titleToPascal(input) {
|
|
931
|
+
return converter(input, "TitleToPascal");
|
|
932
|
+
}
|
|
933
|
+
/**
|
|
934
|
+
* Converts a string, or the keys of an object/array (deeply), from Title Case to snake_case.
|
|
935
|
+
*
|
|
936
|
+
* @example
|
|
937
|
+
* ```ts
|
|
938
|
+
* titleToSnake('Hello World'); // 'hello_world'
|
|
939
|
+
* titleToSnake({ 'First Name': 'John' }); // { first_name: 'John' }
|
|
940
|
+
* ```
|
|
941
|
+
*/
|
|
942
|
+
function titleToSnake(input) {
|
|
943
|
+
return converter(input, "TitleToSnake");
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* Converts a string, or the keys of an object/array (deeply), from Title Case to dash-case.
|
|
947
|
+
*
|
|
948
|
+
* @example
|
|
949
|
+
* ```ts
|
|
950
|
+
* titleToDash('Hello World'); // 'hello-world'
|
|
951
|
+
* titleToDash({ 'First Name': 'John' }); // { 'first-name': 'John' }
|
|
952
|
+
* ```
|
|
953
|
+
*/
|
|
954
|
+
function titleToDash(input) {
|
|
955
|
+
return converter(input, "TitleToDash");
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* Converts a string, or the keys of an object/array (deeply), from Title Case to UPPER_SNAKE_CASE.
|
|
959
|
+
*
|
|
960
|
+
* @example
|
|
961
|
+
* ```ts
|
|
962
|
+
* titleToUpperSnake('Hello World'); // 'HELLO_WORLD'
|
|
963
|
+
* titleToUpperSnake({ 'First Name': 'John' }); // { FIRST_NAME: 'John' }
|
|
964
|
+
* ```
|
|
965
|
+
*/
|
|
966
|
+
function titleToUpperSnake(input) {
|
|
967
|
+
return converter(input, "TitleToUpperSnake");
|
|
968
|
+
}
|
|
969
|
+
/**
|
|
970
|
+
* Converts a string, or the keys of an object/array (deeply), from Title Case to UPPER-DASH-CASE.
|
|
971
|
+
*
|
|
972
|
+
* @example
|
|
973
|
+
* ```ts
|
|
974
|
+
* titleToUpperDash('Hello World'); // 'HELLO-WORLD'
|
|
975
|
+
* titleToUpperDash({ 'First Name': 'John' }); // { 'FIRST-NAME': 'John' }
|
|
976
|
+
* ```
|
|
977
|
+
*/
|
|
978
|
+
function titleToUpperDash(input) {
|
|
979
|
+
return converter(input, "TitleToUpperDash");
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* Converts a string, or the keys of an object/array (deeply), from Title Case to Train-Case.
|
|
983
|
+
*
|
|
984
|
+
* @example
|
|
985
|
+
* ```ts
|
|
986
|
+
* titleToTrain('Hello World'); // 'Hello-World'
|
|
987
|
+
* titleToTrain({ 'First Name': 'John' }); // { 'First-Name': 'John' }
|
|
988
|
+
* ```
|
|
989
|
+
*/
|
|
990
|
+
function titleToTrain(input) {
|
|
991
|
+
return converter(input, "TitleToTrain");
|
|
992
|
+
}
|
|
993
|
+
/**
|
|
994
|
+
* Converts a string, or the keys of an object/array (deeply), from Title Case to dot.case.
|
|
995
|
+
*
|
|
996
|
+
* @example
|
|
997
|
+
* ```ts
|
|
998
|
+
* titleToDot('Hello World'); // 'hello.world'
|
|
999
|
+
* titleToDot({ 'First Name': 'John' }); // { 'first.name': 'John' }
|
|
1000
|
+
* ```
|
|
1001
|
+
*/
|
|
1002
|
+
function titleToDot(input) {
|
|
1003
|
+
return converter(input, "TitleToDot");
|
|
1004
|
+
}
|
|
1005
|
+
/**
|
|
1006
|
+
* Converts a string, or the keys of an object/array (deeply), from Title Case to Sentence case.
|
|
1007
|
+
*
|
|
1008
|
+
* @example
|
|
1009
|
+
* ```ts
|
|
1010
|
+
* titleToSentence('Hello World'); // 'Hello world'
|
|
1011
|
+
* titleToSentence({ 'First Name': 'John' }); // { 'First name': 'John' }
|
|
1012
|
+
* ```
|
|
1013
|
+
*/
|
|
1014
|
+
function titleToSentence(input) {
|
|
1015
|
+
return converter(input, "TitleToSentence");
|
|
1016
|
+
}
|
|
1017
|
+
//#endregion
|
|
1018
|
+
//#region src/sentenceCase/sentenceCase.ts
|
|
1019
|
+
/**
|
|
1020
|
+
* Converts a string, or the keys of an object/array (deeply), from Sentence case to camelCase.
|
|
1021
|
+
*
|
|
1022
|
+
* @example
|
|
1023
|
+
* ```ts
|
|
1024
|
+
* sentenceToCamel('Hello world'); // 'helloWorld'
|
|
1025
|
+
* sentenceToCamel({ 'First name': 'John' }); // { firstName: 'John' }
|
|
1026
|
+
* ```
|
|
1027
|
+
*/
|
|
1028
|
+
function sentenceToCamel(input) {
|
|
1029
|
+
return converter(input, "SentenceToCamel");
|
|
1030
|
+
}
|
|
1031
|
+
/**
|
|
1032
|
+
* Converts a string, or the keys of an object/array (deeply), from Sentence case to PascalCase.
|
|
1033
|
+
*
|
|
1034
|
+
* @example
|
|
1035
|
+
* ```ts
|
|
1036
|
+
* sentenceToPascal('Hello world'); // 'HelloWorld'
|
|
1037
|
+
* sentenceToPascal({ 'First name': 'John' }); // { FirstName: 'John' }
|
|
1038
|
+
* ```
|
|
1039
|
+
*/
|
|
1040
|
+
function sentenceToPascal(input) {
|
|
1041
|
+
return converter(input, "SentenceToPascal");
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* Converts a string, or the keys of an object/array (deeply), from Sentence case to snake_case.
|
|
1045
|
+
*
|
|
1046
|
+
* @example
|
|
1047
|
+
* ```ts
|
|
1048
|
+
* sentenceToSnake('Hello world'); // 'hello_world'
|
|
1049
|
+
* sentenceToSnake({ 'First name': 'John' }); // { first_name: 'John' }
|
|
1050
|
+
* ```
|
|
1051
|
+
*/
|
|
1052
|
+
function sentenceToSnake(input) {
|
|
1053
|
+
return converter(input, "SentenceToSnake");
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* Converts a string, or the keys of an object/array (deeply), from Sentence case to dash-case.
|
|
1057
|
+
*
|
|
1058
|
+
* @example
|
|
1059
|
+
* ```ts
|
|
1060
|
+
* sentenceToDash('Hello world'); // 'hello-world'
|
|
1061
|
+
* sentenceToDash({ 'First name': 'John' }); // { 'first-name': 'John' }
|
|
1062
|
+
* ```
|
|
1063
|
+
*/
|
|
1064
|
+
function sentenceToDash(input) {
|
|
1065
|
+
return converter(input, "SentenceToDash");
|
|
1066
|
+
}
|
|
1067
|
+
/**
|
|
1068
|
+
* Converts a string, or the keys of an object/array (deeply), from Sentence case to UPPER_SNAKE_CASE.
|
|
1069
|
+
*
|
|
1070
|
+
* @example
|
|
1071
|
+
* ```ts
|
|
1072
|
+
* sentenceToUpperSnake('Hello world'); // 'HELLO_WORLD'
|
|
1073
|
+
* sentenceToUpperSnake({ 'First name': 'John' }); // { FIRST_NAME: 'John' }
|
|
1074
|
+
* ```
|
|
1075
|
+
*/
|
|
1076
|
+
function sentenceToUpperSnake(input) {
|
|
1077
|
+
return converter(input, "SentenceToUpperSnake");
|
|
1078
|
+
}
|
|
1079
|
+
/**
|
|
1080
|
+
* Converts a string, or the keys of an object/array (deeply), from Sentence case to UPPER-DASH-CASE.
|
|
1081
|
+
*
|
|
1082
|
+
* @example
|
|
1083
|
+
* ```ts
|
|
1084
|
+
* sentenceToUpperDash('Hello world'); // 'HELLO-WORLD'
|
|
1085
|
+
* sentenceToUpperDash({ 'First name': 'John' }); // { 'FIRST-NAME': 'John' }
|
|
1086
|
+
* ```
|
|
1087
|
+
*/
|
|
1088
|
+
function sentenceToUpperDash(input) {
|
|
1089
|
+
return converter(input, "SentenceToUpperDash");
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* Converts a string, or the keys of an object/array (deeply), from Sentence case to Train-Case.
|
|
1093
|
+
*
|
|
1094
|
+
* @example
|
|
1095
|
+
* ```ts
|
|
1096
|
+
* sentenceToTrain('Hello world'); // 'Hello-World'
|
|
1097
|
+
* sentenceToTrain({ 'First name': 'John' }); // { 'First-Name': 'John' }
|
|
1098
|
+
* ```
|
|
1099
|
+
*/
|
|
1100
|
+
function sentenceToTrain(input) {
|
|
1101
|
+
return converter(input, "SentenceToTrain");
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Converts a string, or the keys of an object/array (deeply), from Sentence case to dot.case.
|
|
1105
|
+
*
|
|
1106
|
+
* @example
|
|
1107
|
+
* ```ts
|
|
1108
|
+
* sentenceToDot('Hello world'); // 'hello.world'
|
|
1109
|
+
* sentenceToDot({ 'First name': 'John' }); // { 'first.name': 'John' }
|
|
1110
|
+
* ```
|
|
1111
|
+
*/
|
|
1112
|
+
function sentenceToDot(input) {
|
|
1113
|
+
return converter(input, "SentenceToDot");
|
|
1114
|
+
}
|
|
1115
|
+
/**
|
|
1116
|
+
* Converts a string, or the keys of an object/array (deeply), from Sentence case to Title Case.
|
|
1117
|
+
*
|
|
1118
|
+
* @example
|
|
1119
|
+
* ```ts
|
|
1120
|
+
* sentenceToTitle('Hello world'); // 'Hello World'
|
|
1121
|
+
* sentenceToTitle({ 'First name': 'John' }); // { 'First Name': 'John' }
|
|
1122
|
+
* ```
|
|
1123
|
+
*/
|
|
1124
|
+
function sentenceToTitle(input) {
|
|
1125
|
+
return converter(input, "SentenceToTitle");
|
|
1126
|
+
}
|
|
375
1127
|
//#endregion
|
|
376
1128
|
//#region src/upperDashCase/upperDashCase.ts
|
|
377
1129
|
/**
|
|
@@ -434,6 +1186,54 @@ function upperDashToPascal(input) {
|
|
|
434
1186
|
function upperDashToUpperSnake(input) {
|
|
435
1187
|
return converter(input, "UpperDashToUpperSnake");
|
|
436
1188
|
}
|
|
1189
|
+
/**
|
|
1190
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to Train-Case.
|
|
1191
|
+
*
|
|
1192
|
+
* @example
|
|
1193
|
+
* ```ts
|
|
1194
|
+
* upperDashToTrain('HELLO-WORLD'); // 'Hello-World'
|
|
1195
|
+
* upperDashToTrain({ 'FIRST-NAME': 'John' }); // { 'First-Name': 'John' }
|
|
1196
|
+
* ```
|
|
1197
|
+
*/
|
|
1198
|
+
function upperDashToTrain(input) {
|
|
1199
|
+
return converter(input, "UpperDashToTrain");
|
|
1200
|
+
}
|
|
1201
|
+
/**
|
|
1202
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to dot.case.
|
|
1203
|
+
*
|
|
1204
|
+
* @example
|
|
1205
|
+
* ```ts
|
|
1206
|
+
* upperDashToDot('HELLO-WORLD'); // 'hello.world'
|
|
1207
|
+
* upperDashToDot({ 'FIRST-NAME': 'John' }); // { 'first.name': 'John' }
|
|
1208
|
+
* ```
|
|
1209
|
+
*/
|
|
1210
|
+
function upperDashToDot(input) {
|
|
1211
|
+
return converter(input, "UpperDashToDot");
|
|
1212
|
+
}
|
|
1213
|
+
/**
|
|
1214
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to Title Case.
|
|
1215
|
+
*
|
|
1216
|
+
* @example
|
|
1217
|
+
* ```ts
|
|
1218
|
+
* upperDashToTitle('HELLO-WORLD'); // 'Hello World'
|
|
1219
|
+
* upperDashToTitle({ 'FIRST-NAME': 'John' }); // { 'First Name': 'John' }
|
|
1220
|
+
* ```
|
|
1221
|
+
*/
|
|
1222
|
+
function upperDashToTitle(input) {
|
|
1223
|
+
return converter(input, "UpperDashToTitle");
|
|
1224
|
+
}
|
|
1225
|
+
/**
|
|
1226
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER-DASH-CASE to Sentence case.
|
|
1227
|
+
*
|
|
1228
|
+
* @example
|
|
1229
|
+
* ```ts
|
|
1230
|
+
* upperDashToSentence('HELLO-WORLD'); // 'Hello world'
|
|
1231
|
+
* upperDashToSentence({ 'FIRST-NAME': 'John' }); // { 'First name': 'John' }
|
|
1232
|
+
* ```
|
|
1233
|
+
*/
|
|
1234
|
+
function upperDashToSentence(input) {
|
|
1235
|
+
return converter(input, "UpperDashToSentence");
|
|
1236
|
+
}
|
|
437
1237
|
//#endregion
|
|
438
1238
|
//#region src/upperSnakeCase/upperSnakeCase.ts
|
|
439
1239
|
/**
|
|
@@ -496,5 +1296,53 @@ function upperSnakeToPascal(input) {
|
|
|
496
1296
|
function upperSnakeToUpperDash(input) {
|
|
497
1297
|
return converter(input, "UpperSnakeToUpperDash");
|
|
498
1298
|
}
|
|
1299
|
+
/**
|
|
1300
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to Train-Case.
|
|
1301
|
+
*
|
|
1302
|
+
* @example
|
|
1303
|
+
* ```ts
|
|
1304
|
+
* upperSnakeToTrain('HELLO_WORLD'); // 'Hello-World'
|
|
1305
|
+
* upperSnakeToTrain({ FIRST_NAME: 'John' }); // { 'First-Name': 'John' }
|
|
1306
|
+
* ```
|
|
1307
|
+
*/
|
|
1308
|
+
function upperSnakeToTrain(input) {
|
|
1309
|
+
return converter(input, "UpperSnakeToTrain");
|
|
1310
|
+
}
|
|
1311
|
+
/**
|
|
1312
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to dot.case.
|
|
1313
|
+
*
|
|
1314
|
+
* @example
|
|
1315
|
+
* ```ts
|
|
1316
|
+
* upperSnakeToDot('HELLO_WORLD'); // 'hello.world'
|
|
1317
|
+
* upperSnakeToDot({ FIRST_NAME: 'John' }); // { 'first.name': 'John' }
|
|
1318
|
+
* ```
|
|
1319
|
+
*/
|
|
1320
|
+
function upperSnakeToDot(input) {
|
|
1321
|
+
return converter(input, "UpperSnakeToDot");
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to Title Case.
|
|
1325
|
+
*
|
|
1326
|
+
* @example
|
|
1327
|
+
* ```ts
|
|
1328
|
+
* upperSnakeToTitle('HELLO_WORLD'); // 'Hello World'
|
|
1329
|
+
* upperSnakeToTitle({ FIRST_NAME: 'John' }); // { 'First Name': 'John' }
|
|
1330
|
+
* ```
|
|
1331
|
+
*/
|
|
1332
|
+
function upperSnakeToTitle(input) {
|
|
1333
|
+
return converter(input, "UpperSnakeToTitle");
|
|
1334
|
+
}
|
|
1335
|
+
/**
|
|
1336
|
+
* Converts a string, or the keys of an object/array (deeply), from UPPER_SNAKE_CASE to Sentence case.
|
|
1337
|
+
*
|
|
1338
|
+
* @example
|
|
1339
|
+
* ```ts
|
|
1340
|
+
* upperSnakeToSentence('HELLO_WORLD'); // 'Hello world'
|
|
1341
|
+
* upperSnakeToSentence({ FIRST_NAME: 'John' }); // { 'First name': 'John' }
|
|
1342
|
+
* ```
|
|
1343
|
+
*/
|
|
1344
|
+
function upperSnakeToSentence(input) {
|
|
1345
|
+
return converter(input, "UpperSnakeToSentence");
|
|
1346
|
+
}
|
|
499
1347
|
//#endregion
|
|
500
|
-
export { camelToDash, camelToPascal, camelToSnake, camelToUpperDash, camelToUpperSnake, dashToCamel, dashToPascal, dashToSnake, dashToUpperDash, dashToUpperSnake, pascalToCamel, pascalToDash, pascalToSnake, pascalToUpperDash, pascalToUpperSnake, snakeToCamel, snakeToDash, snakeToPascal, snakeToUpperDash, snakeToUpperSnake, upperDashToCamel, upperDashToDash, upperDashToPascal, upperDashToSnake, upperDashToUpperSnake, upperSnakeToCamel, upperSnakeToDash, upperSnakeToPascal, upperSnakeToSnake, upperSnakeToUpperDash };
|
|
1348
|
+
export { camelToDash, camelToDot, camelToPascal, camelToSentence, camelToSnake, camelToTitle, camelToTrain, camelToUpperDash, camelToUpperSnake, dashToCamel, dashToDot, dashToPascal, dashToSentence, dashToSnake, dashToTitle, dashToTrain, dashToUpperDash, dashToUpperSnake, dotToCamel, dotToDash, dotToPascal, dotToSentence, dotToSnake, dotToTitle, dotToTrain, dotToUpperDash, dotToUpperSnake, pascalToCamel, pascalToDash, pascalToDot, pascalToSentence, pascalToSnake, pascalToTitle, pascalToTrain, pascalToUpperDash, pascalToUpperSnake, sentenceToCamel, sentenceToDash, sentenceToDot, sentenceToPascal, sentenceToSnake, sentenceToTitle, sentenceToTrain, sentenceToUpperDash, sentenceToUpperSnake, snakeToCamel, snakeToDash, snakeToDot, snakeToPascal, snakeToSentence, snakeToTitle, snakeToTrain, snakeToUpperDash, snakeToUpperSnake, titleToCamel, titleToDash, titleToDot, titleToPascal, titleToSentence, titleToSnake, titleToTrain, titleToUpperDash, titleToUpperSnake, trainToCamel, trainToDash, trainToDot, trainToPascal, trainToSentence, trainToSnake, trainToTitle, trainToUpperDash, trainToUpperSnake, upperDashToCamel, upperDashToDash, upperDashToDot, upperDashToPascal, upperDashToSentence, upperDashToSnake, upperDashToTitle, upperDashToTrain, upperDashToUpperSnake, upperSnakeToCamel, upperSnakeToDash, upperSnakeToDot, upperSnakeToPascal, upperSnakeToSentence, upperSnakeToSnake, upperSnakeToTitle, upperSnakeToTrain, upperSnakeToUpperDash };
|