caseparser 4.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 +70 -142
- package/dist/index.cjs +395 -1
- package/dist/index.d.cts +300 -8
- package/dist/index.d.ts +300 -8
- package/dist/index.js +370 -2
- package/package.json +15 -7
package/dist/index.cjs
CHANGED
|
@@ -28,31 +28,57 @@ const CamelToPascal = (str) => Capitalize(str);
|
|
|
28
28
|
const CamelToSnake = (str) => str.replace(/([A-Z])/g, (g) => "_" + g[0].toLowerCase());
|
|
29
29
|
const CamelToUpperDash = (str) => Uppercase(CamelToDash(str));
|
|
30
30
|
const CamelToUpperSnake = (str) => Uppercase(CamelToSnake(str));
|
|
31
|
+
const CamelToTrain = (str) => DashToTrain(CamelToDash(str));
|
|
32
|
+
const CamelToDot = (str) => DashToDot(CamelToDash(str));
|
|
31
33
|
const DashToCamel = (str) => str.replace(/(\-\w)/g, (g) => g[1].toUpperCase());
|
|
32
34
|
const DashToPascal = (str) => Capitalize(DashToCamel(str));
|
|
33
35
|
const DashToSnake = (str) => str.replace(/(\-)/g, "_");
|
|
34
36
|
const DashToUpperDash = (str) => Uppercase(str);
|
|
35
37
|
const DashToUpperSnake = (str) => Uppercase(DashToSnake(str));
|
|
38
|
+
const DashToTrain = (str) => str.split("-").map(Capitalize).join("-");
|
|
39
|
+
const DashToDot = (str) => str.replace(/(\-)/g, ".");
|
|
36
40
|
const PascalToCamel = (str) => Uncapitalize(str);
|
|
37
41
|
const PascalToDash = (str) => CamelToDash(Uncapitalize(str));
|
|
38
42
|
const PascalToSnake = (str) => CamelToSnake(Uncapitalize(str));
|
|
39
43
|
const PascalToUpperDash = (str) => Uppercase(PascalToDash(str));
|
|
40
44
|
const PascalToUpperSnake = (str) => Uppercase(PascalToSnake(str));
|
|
45
|
+
const PascalToTrain = (str) => DashToTrain(PascalToDash(str));
|
|
46
|
+
const PascalToDot = (str) => DashToDot(PascalToDash(str));
|
|
41
47
|
const SnakeToCamel = (str) => str.replace(/(\_\w)/g, (g) => g[1].toUpperCase());
|
|
42
48
|
const SnakeToDash = (str) => str.replace(/(\_)/g, "-");
|
|
43
49
|
const SnakeToPascal = (str) => Capitalize(SnakeToCamel(str));
|
|
44
50
|
const SnakeToUpperDash = (str) => Uppercase(SnakeToDash(str));
|
|
51
|
+
const SnakeToTrain = (str) => DashToTrain(SnakeToDash(str));
|
|
52
|
+
const SnakeToDot = (str) => DashToDot(SnakeToDash(str));
|
|
45
53
|
const SnakeToUpperSnake = (str) => Uppercase(str);
|
|
46
54
|
const UpperDashToCamel = (str) => DashToCamel(Lowercase(str));
|
|
47
55
|
const UpperDashToDash = (str) => Lowercase(str);
|
|
48
56
|
const UpperDashToPascal = (str) => Capitalize(UpperDashToCamel(str));
|
|
49
57
|
const UpperDashToSnake = (str) => DashToSnake(UpperDashToDash(str));
|
|
50
58
|
const UpperDashToUpperSnake = (str) => Uppercase(UpperDashToSnake(str));
|
|
59
|
+
const UpperDashToTrain = (str) => DashToTrain(UpperDashToDash(str));
|
|
60
|
+
const UpperDashToDot = (str) => DashToDot(UpperDashToDash(str));
|
|
51
61
|
const UpperSnakeToCamel = (str) => SnakeToCamel(Lowercase(str));
|
|
52
62
|
const UpperSnakeToDash = (str) => str.replace(/(\_)/g, "-").toLowerCase();
|
|
53
63
|
const UpperSnakeToPascal = (str) => SnakeToPascal(Lowercase(str));
|
|
54
64
|
const UpperSnakeToSnake = (str) => Lowercase(str);
|
|
55
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));
|
|
56
82
|
function parse(input, type) {
|
|
57
83
|
return {
|
|
58
84
|
CamelToDash,
|
|
@@ -84,7 +110,33 @@ function parse(input, type) {
|
|
|
84
110
|
UpperDashToSnake,
|
|
85
111
|
UpperDashToDash,
|
|
86
112
|
UpperDashToPascal,
|
|
87
|
-
UpperDashToUpperSnake
|
|
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
|
|
88
140
|
}[type](input);
|
|
89
141
|
}
|
|
90
142
|
//#endregion
|
|
@@ -187,6 +239,30 @@ function camelToUpperSnake(input) {
|
|
|
187
239
|
function camelToUpperDash(input) {
|
|
188
240
|
return converter(input, "CamelToUpperDash");
|
|
189
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
|
+
}
|
|
190
266
|
//#endregion
|
|
191
267
|
//#region src/dashCase/dashCase.ts
|
|
192
268
|
/**
|
|
@@ -249,6 +325,30 @@ function dashToUpperSnake(input) {
|
|
|
249
325
|
function dashToUpperDash(input) {
|
|
250
326
|
return converter(input, "DashToUpperDash");
|
|
251
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
|
+
}
|
|
252
352
|
//#endregion
|
|
253
353
|
//#region src/pascalCase/pascalCase.ts
|
|
254
354
|
/**
|
|
@@ -311,6 +411,30 @@ function pascalToUpperSnake(input) {
|
|
|
311
411
|
function pascalToUpperDash(input) {
|
|
312
412
|
return converter(input, "PascalToUpperDash");
|
|
313
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
|
+
}
|
|
314
438
|
//#endregion
|
|
315
439
|
//#region src/snakeCase/snakeCase.ts
|
|
316
440
|
/**
|
|
@@ -373,6 +497,202 @@ function snakeToUpperSnake(input) {
|
|
|
373
497
|
function snakeToUpperDash(input) {
|
|
374
498
|
return converter(input, "SnakeToUpperDash");
|
|
375
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
|
+
}
|
|
376
696
|
//#endregion
|
|
377
697
|
//#region src/upperDashCase/upperDashCase.ts
|
|
378
698
|
/**
|
|
@@ -435,6 +755,30 @@ function upperDashToPascal(input) {
|
|
|
435
755
|
function upperDashToUpperSnake(input) {
|
|
436
756
|
return converter(input, "UpperDashToUpperSnake");
|
|
437
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
|
+
}
|
|
438
782
|
//#endregion
|
|
439
783
|
//#region src/upperSnakeCase/upperSnakeCase.ts
|
|
440
784
|
/**
|
|
@@ -497,34 +841,84 @@ function upperSnakeToPascal(input) {
|
|
|
497
841
|
function upperSnakeToUpperDash(input) {
|
|
498
842
|
return converter(input, "UpperSnakeToUpperDash");
|
|
499
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
|
+
}
|
|
500
868
|
//#endregion
|
|
501
869
|
exports.camelToDash = camelToDash;
|
|
870
|
+
exports.camelToDot = camelToDot;
|
|
502
871
|
exports.camelToPascal = camelToPascal;
|
|
503
872
|
exports.camelToSnake = camelToSnake;
|
|
873
|
+
exports.camelToTrain = camelToTrain;
|
|
504
874
|
exports.camelToUpperDash = camelToUpperDash;
|
|
505
875
|
exports.camelToUpperSnake = camelToUpperSnake;
|
|
506
876
|
exports.dashToCamel = dashToCamel;
|
|
877
|
+
exports.dashToDot = dashToDot;
|
|
507
878
|
exports.dashToPascal = dashToPascal;
|
|
508
879
|
exports.dashToSnake = dashToSnake;
|
|
880
|
+
exports.dashToTrain = dashToTrain;
|
|
509
881
|
exports.dashToUpperDash = dashToUpperDash;
|
|
510
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;
|
|
511
890
|
exports.pascalToCamel = pascalToCamel;
|
|
512
891
|
exports.pascalToDash = pascalToDash;
|
|
892
|
+
exports.pascalToDot = pascalToDot;
|
|
513
893
|
exports.pascalToSnake = pascalToSnake;
|
|
894
|
+
exports.pascalToTrain = pascalToTrain;
|
|
514
895
|
exports.pascalToUpperDash = pascalToUpperDash;
|
|
515
896
|
exports.pascalToUpperSnake = pascalToUpperSnake;
|
|
516
897
|
exports.snakeToCamel = snakeToCamel;
|
|
517
898
|
exports.snakeToDash = snakeToDash;
|
|
899
|
+
exports.snakeToDot = snakeToDot;
|
|
518
900
|
exports.snakeToPascal = snakeToPascal;
|
|
901
|
+
exports.snakeToTrain = snakeToTrain;
|
|
519
902
|
exports.snakeToUpperDash = snakeToUpperDash;
|
|
520
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;
|
|
521
911
|
exports.upperDashToCamel = upperDashToCamel;
|
|
522
912
|
exports.upperDashToDash = upperDashToDash;
|
|
913
|
+
exports.upperDashToDot = upperDashToDot;
|
|
523
914
|
exports.upperDashToPascal = upperDashToPascal;
|
|
524
915
|
exports.upperDashToSnake = upperDashToSnake;
|
|
916
|
+
exports.upperDashToTrain = upperDashToTrain;
|
|
525
917
|
exports.upperDashToUpperSnake = upperDashToUpperSnake;
|
|
526
918
|
exports.upperSnakeToCamel = upperSnakeToCamel;
|
|
527
919
|
exports.upperSnakeToDash = upperSnakeToDash;
|
|
920
|
+
exports.upperSnakeToDot = upperSnakeToDot;
|
|
528
921
|
exports.upperSnakeToPascal = upperSnakeToPascal;
|
|
529
922
|
exports.upperSnakeToSnake = upperSnakeToSnake;
|
|
923
|
+
exports.upperSnakeToTrain = upperSnakeToTrain;
|
|
530
924
|
exports.upperSnakeToUpperDash = upperSnakeToUpperDash;
|