caseparser 4.2.0 → 4.3.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/dist/index.js CHANGED
@@ -21,6 +21,35 @@ function Uncapitalize(str) {
21
21
  return str.charAt(0).toLowerCase() + str.slice(1);
22
22
  }
23
23
  //#endregion
24
+ //#region src/parser/objectParser.ts
25
+ function objectParser(input, convertKey) {
26
+ const result = {};
27
+ for (const property of Object.keys(input)) {
28
+ const parsedKey = convertKey(property);
29
+ const value = input[property];
30
+ let parsedValue;
31
+ if (isArray(value)) parsedValue = arrayParser(value, convertKey);
32
+ else if (isObject(value)) parsedValue = objectParser(value, convertKey);
33
+ else parsedValue = value;
34
+ Object.defineProperty(result, parsedKey, {
35
+ value: parsedValue,
36
+ enumerable: true,
37
+ writable: true,
38
+ configurable: true
39
+ });
40
+ }
41
+ return result;
42
+ }
43
+ //#endregion
44
+ //#region src/parser/arrayParser.ts
45
+ function arrayParser(input, convertKey) {
46
+ return input.map((item) => {
47
+ if (isArray(item)) return arrayParser(item, convertKey);
48
+ if (isObject(item)) return objectParser(item, convertKey);
49
+ return item;
50
+ });
51
+ }
52
+ //#endregion
24
53
  //#region src/parser/stringParser.ts
25
54
  const CamelToDash = (str) => str.replace(/([A-Z])/g, (g) => "-" + g[0].toLowerCase());
26
55
  const CamelToPascal = (str) => Capitalize(str);
@@ -207,42 +236,15 @@ function parse(input, type) {
207
236
  }[type](input);
208
237
  }
209
238
  //#endregion
210
- //#region src/parser/objectParser.ts
211
- function objectParser(input, type) {
212
- const result = {};
213
- for (const property of Object.keys(input)) {
214
- const parsedKey = parse(property, type);
215
- const value = input[property];
216
- let parsedValue;
217
- if (isArray(value)) parsedValue = arrayParser(value, type);
218
- else if (isObject(value)) parsedValue = objectParser(value, type);
219
- else parsedValue = value;
220
- Object.defineProperty(result, parsedKey, {
221
- value: parsedValue,
222
- enumerable: true,
223
- writable: true,
224
- configurable: true
225
- });
226
- }
227
- return result;
228
- }
229
- //#endregion
230
- //#region src/parser/arrayParser.ts
231
- function arrayParser(input, type) {
232
- return input.map((item) => {
233
- if (isArray(item)) return arrayParser(item, type);
234
- if (isObject(item)) return objectParser(item, type);
235
- return item;
236
- });
237
- }
238
- //#endregion
239
239
  //#region src/parser/parser.ts
240
+ /** Converts a string, or the keys of an object/array (deeply), with `convertKey`. */
241
+ function convert(input, convertKey) {
242
+ if (isString(input)) return convertKey(input);
243
+ if (isArray(input)) return arrayParser(input, convertKey);
244
+ if (isObject(input)) return objectParser(input, convertKey);
245
+ }
240
246
  function converter(input, type) {
241
- let result;
242
- if (isString(input)) result = parse(input, type);
243
- if (isArray(input)) result = arrayParser(input, type);
244
- if (isObject(input)) result = objectParser(input, type);
245
- return result;
247
+ return convert(input, (key) => parse(key, type));
246
248
  }
247
249
  //#endregion
248
250
  //#region src/camelCase/camelCase.ts
@@ -254,6 +256,9 @@ function converter(input, type) {
254
256
  * camelToDash('helloWorld'); // 'hello-world'
255
257
  * camelToDash({ firstName: 'John' }); // { 'first-name': 'John' }
256
258
  * ```
259
+ *
260
+ * @deprecated Use `toDash` instead, which converts from any case. It keeps acronyms together,
261
+ * so results differ for keys like `userID` (see the migration notes in the README).
257
262
  */
258
263
  function camelToDash(input) {
259
264
  return converter(input, "CamelToDash");
@@ -266,6 +271,9 @@ function camelToDash(input) {
266
271
  * camelToSnake('helloWorld'); // 'hello_world'
267
272
  * camelToSnake({ firstName: 'John' }); // { first_name: 'John' }
268
273
  * ```
274
+ *
275
+ * @deprecated Use `toSnake` instead, which converts from any case. It keeps acronyms together,
276
+ * so results differ for keys like `userID` (see the migration notes in the README).
269
277
  */
270
278
  function camelToSnake(input) {
271
279
  return converter(input, "CamelToSnake");
@@ -278,6 +286,9 @@ function camelToSnake(input) {
278
286
  * camelToPascal('helloWorld'); // 'HelloWorld'
279
287
  * camelToPascal({ firstName: 'John' }); // { FirstName: 'John' }
280
288
  * ```
289
+ *
290
+ * @deprecated Use `toPascal` instead, which converts from any case. It keeps acronyms together,
291
+ * so results differ for keys like `userID` (see the migration notes in the README).
281
292
  */
282
293
  function camelToPascal(input) {
283
294
  return converter(input, "CamelToPascal");
@@ -290,6 +301,9 @@ function camelToPascal(input) {
290
301
  * camelToUpperSnake('helloWorld'); // 'HELLO_WORLD'
291
302
  * camelToUpperSnake({ firstName: 'John' }); // { FIRST_NAME: 'John' }
292
303
  * ```
304
+ *
305
+ * @deprecated Use `toUpperSnake` instead, which converts from any case. It keeps acronyms together,
306
+ * so results differ for keys like `userID` (see the migration notes in the README).
293
307
  */
294
308
  function camelToUpperSnake(input) {
295
309
  return converter(input, "CamelToUpperSnake");
@@ -302,6 +316,9 @@ function camelToUpperSnake(input) {
302
316
  * camelToUpperDash('helloWorld'); // 'HELLO-WORLD'
303
317
  * camelToUpperDash({ firstName: 'John' }); // { 'FIRST-NAME': 'John' }
304
318
  * ```
319
+ *
320
+ * @deprecated Use `toUpperDash` instead, which converts from any case. It keeps acronyms together,
321
+ * so results differ for keys like `userID` (see the migration notes in the README).
305
322
  */
306
323
  function camelToUpperDash(input) {
307
324
  return converter(input, "CamelToUpperDash");
@@ -314,6 +331,9 @@ function camelToUpperDash(input) {
314
331
  * camelToTrain('helloWorld'); // 'Hello-World'
315
332
  * camelToTrain({ firstName: 'John' }); // { 'First-Name': 'John' }
316
333
  * ```
334
+ *
335
+ * @deprecated Use `toTrain` instead, which converts from any case. It keeps acronyms together,
336
+ * so results differ for keys like `userID` (see the migration notes in the README).
317
337
  */
318
338
  function camelToTrain(input) {
319
339
  return converter(input, "CamelToTrain");
@@ -326,6 +346,9 @@ function camelToTrain(input) {
326
346
  * camelToDot('helloWorld'); // 'hello.world'
327
347
  * camelToDot({ firstName: 'John' }); // { 'first.name': 'John' }
328
348
  * ```
349
+ *
350
+ * @deprecated Use `toDot` instead, which converts from any case. It keeps acronyms together,
351
+ * so results differ for keys like `userID` (see the migration notes in the README).
329
352
  */
330
353
  function camelToDot(input) {
331
354
  return converter(input, "CamelToDot");
@@ -338,6 +361,9 @@ function camelToDot(input) {
338
361
  * camelToTitle('helloWorld'); // 'Hello World'
339
362
  * camelToTitle({ firstName: 'John' }); // { 'First Name': 'John' }
340
363
  * ```
364
+ *
365
+ * @deprecated Use `toTitle` instead, which converts from any case. It keeps acronyms together,
366
+ * so results differ for keys like `userID` (see the migration notes in the README).
341
367
  */
342
368
  function camelToTitle(input) {
343
369
  return converter(input, "CamelToTitle");
@@ -350,6 +376,9 @@ function camelToTitle(input) {
350
376
  * camelToSentence('helloWorld'); // 'Hello world'
351
377
  * camelToSentence({ firstName: 'John' }); // { 'First name': 'John' }
352
378
  * ```
379
+ *
380
+ * @deprecated Use `toSentence` instead, which converts from any case. It keeps acronyms together,
381
+ * so results differ for keys like `userID` (see the migration notes in the README).
353
382
  */
354
383
  function camelToSentence(input) {
355
384
  return converter(input, "CamelToSentence");
@@ -364,6 +393,9 @@ function camelToSentence(input) {
364
393
  * dashToSnake('hello-world'); // 'hello_world'
365
394
  * dashToSnake({ 'first-name': 'John' }); // { first_name: 'John' }
366
395
  * ```
396
+ *
397
+ * @deprecated Use `toSnake` instead, which converts from any case. It keeps acronyms together,
398
+ * so results differ for keys like `userID` (see the migration notes in the README).
367
399
  */
368
400
  function dashToSnake(input) {
369
401
  return converter(input, "DashToSnake");
@@ -376,6 +408,9 @@ function dashToSnake(input) {
376
408
  * dashToCamel('hello-world'); // 'helloWorld'
377
409
  * dashToCamel({ 'first-name': 'John' }); // { firstName: 'John' }
378
410
  * ```
411
+ *
412
+ * @deprecated Use `toCamel` instead, which converts from any case. It keeps acronyms together,
413
+ * so results differ for keys like `userID` (see the migration notes in the README).
379
414
  */
380
415
  function dashToCamel(input) {
381
416
  return converter(input, "DashToCamel");
@@ -388,6 +423,9 @@ function dashToCamel(input) {
388
423
  * dashToPascal('hello-world'); // 'HelloWorld'
389
424
  * dashToPascal({ 'first-name': 'John' }); // { FirstName: 'John' }
390
425
  * ```
426
+ *
427
+ * @deprecated Use `toPascal` instead, which converts from any case. It keeps acronyms together,
428
+ * so results differ for keys like `userID` (see the migration notes in the README).
391
429
  */
392
430
  function dashToPascal(input) {
393
431
  return converter(input, "DashToPascal");
@@ -400,6 +438,9 @@ function dashToPascal(input) {
400
438
  * dashToUpperSnake('hello-world'); // 'HELLO_WORLD'
401
439
  * dashToUpperSnake({ 'first-name': 'John' }); // { FIRST_NAME: 'John' }
402
440
  * ```
441
+ *
442
+ * @deprecated Use `toUpperSnake` instead, which converts from any case. It keeps acronyms together,
443
+ * so results differ for keys like `userID` (see the migration notes in the README).
403
444
  */
404
445
  function dashToUpperSnake(input) {
405
446
  return converter(input, "DashToUpperSnake");
@@ -412,6 +453,9 @@ function dashToUpperSnake(input) {
412
453
  * dashToUpperDash('hello-world'); // 'HELLO-WORLD'
413
454
  * dashToUpperDash({ 'first-name': 'John' }); // { 'FIRST-NAME': 'John' }
414
455
  * ```
456
+ *
457
+ * @deprecated Use `toUpperDash` instead, which converts from any case. It keeps acronyms together,
458
+ * so results differ for keys like `userID` (see the migration notes in the README).
415
459
  */
416
460
  function dashToUpperDash(input) {
417
461
  return converter(input, "DashToUpperDash");
@@ -424,6 +468,9 @@ function dashToUpperDash(input) {
424
468
  * dashToTrain('hello-world'); // 'Hello-World'
425
469
  * dashToTrain({ 'first-name': 'John' }); // { 'First-Name': 'John' }
426
470
  * ```
471
+ *
472
+ * @deprecated Use `toTrain` instead, which converts from any case. It keeps acronyms together,
473
+ * so results differ for keys like `userID` (see the migration notes in the README).
427
474
  */
428
475
  function dashToTrain(input) {
429
476
  return converter(input, "DashToTrain");
@@ -436,6 +483,9 @@ function dashToTrain(input) {
436
483
  * dashToDot('hello-world'); // 'hello.world'
437
484
  * dashToDot({ 'first-name': 'John' }); // { 'first.name': 'John' }
438
485
  * ```
486
+ *
487
+ * @deprecated Use `toDot` instead, which converts from any case. It keeps acronyms together,
488
+ * so results differ for keys like `userID` (see the migration notes in the README).
439
489
  */
440
490
  function dashToDot(input) {
441
491
  return converter(input, "DashToDot");
@@ -448,6 +498,9 @@ function dashToDot(input) {
448
498
  * dashToTitle('hello-world'); // 'Hello World'
449
499
  * dashToTitle({ 'first-name': 'John' }); // { 'First Name': 'John' }
450
500
  * ```
501
+ *
502
+ * @deprecated Use `toTitle` instead, which converts from any case. It keeps acronyms together,
503
+ * so results differ for keys like `userID` (see the migration notes in the README).
451
504
  */
452
505
  function dashToTitle(input) {
453
506
  return converter(input, "DashToTitle");
@@ -460,6 +513,9 @@ function dashToTitle(input) {
460
513
  * dashToSentence('hello-world'); // 'Hello world'
461
514
  * dashToSentence({ 'first-name': 'John' }); // { 'First name': 'John' }
462
515
  * ```
516
+ *
517
+ * @deprecated Use `toSentence` instead, which converts from any case. It keeps acronyms together,
518
+ * so results differ for keys like `userID` (see the migration notes in the README).
463
519
  */
464
520
  function dashToSentence(input) {
465
521
  return converter(input, "DashToSentence");
@@ -474,6 +530,9 @@ function dashToSentence(input) {
474
530
  * pascalToCamel('HelloWorld'); // 'helloWorld'
475
531
  * pascalToCamel({ FirstName: 'John' }); // { firstName: 'John' }
476
532
  * ```
533
+ *
534
+ * @deprecated Use `toCamel` instead, which converts from any case. It keeps acronyms together,
535
+ * so results differ for keys like `userID` (see the migration notes in the README).
477
536
  */
478
537
  function pascalToCamel(input) {
479
538
  return converter(input, "PascalToCamel");
@@ -486,6 +545,9 @@ function pascalToCamel(input) {
486
545
  * pascalToSnake('HelloWorld'); // 'hello_world'
487
546
  * pascalToSnake({ FirstName: 'John' }); // { first_name: 'John' }
488
547
  * ```
548
+ *
549
+ * @deprecated Use `toSnake` instead, which converts from any case. It keeps acronyms together,
550
+ * so results differ for keys like `userID` (see the migration notes in the README).
489
551
  */
490
552
  function pascalToSnake(input) {
491
553
  return converter(input, "PascalToSnake");
@@ -498,6 +560,9 @@ function pascalToSnake(input) {
498
560
  * pascalToDash('HelloWorld'); // 'hello-world'
499
561
  * pascalToDash({ FirstName: 'John' }); // { 'first-name': 'John' }
500
562
  * ```
563
+ *
564
+ * @deprecated Use `toDash` instead, which converts from any case. It keeps acronyms together,
565
+ * so results differ for keys like `userID` (see the migration notes in the README).
501
566
  */
502
567
  function pascalToDash(input) {
503
568
  return converter(input, "PascalToDash");
@@ -510,6 +575,9 @@ function pascalToDash(input) {
510
575
  * pascalToUpperSnake('HelloWorld'); // 'HELLO_WORLD'
511
576
  * pascalToUpperSnake({ FirstName: 'John' }); // { FIRST_NAME: 'John' }
512
577
  * ```
578
+ *
579
+ * @deprecated Use `toUpperSnake` instead, which converts from any case. It keeps acronyms together,
580
+ * so results differ for keys like `userID` (see the migration notes in the README).
513
581
  */
514
582
  function pascalToUpperSnake(input) {
515
583
  return converter(input, "PascalToUpperSnake");
@@ -522,6 +590,9 @@ function pascalToUpperSnake(input) {
522
590
  * pascalToUpperDash('HelloWorld'); // 'HELLO-WORLD'
523
591
  * pascalToUpperDash({ FirstName: 'John' }); // { 'FIRST-NAME': 'John' }
524
592
  * ```
593
+ *
594
+ * @deprecated Use `toUpperDash` instead, which converts from any case. It keeps acronyms together,
595
+ * so results differ for keys like `userID` (see the migration notes in the README).
525
596
  */
526
597
  function pascalToUpperDash(input) {
527
598
  return converter(input, "PascalToUpperDash");
@@ -534,6 +605,9 @@ function pascalToUpperDash(input) {
534
605
  * pascalToTrain('HelloWorld'); // 'Hello-World'
535
606
  * pascalToTrain({ FirstName: 'John' }); // { 'First-Name': 'John' }
536
607
  * ```
608
+ *
609
+ * @deprecated Use `toTrain` instead, which converts from any case. It keeps acronyms together,
610
+ * so results differ for keys like `userID` (see the migration notes in the README).
537
611
  */
538
612
  function pascalToTrain(input) {
539
613
  return converter(input, "PascalToTrain");
@@ -546,6 +620,9 @@ function pascalToTrain(input) {
546
620
  * pascalToDot('HelloWorld'); // 'hello.world'
547
621
  * pascalToDot({ FirstName: 'John' }); // { 'first.name': 'John' }
548
622
  * ```
623
+ *
624
+ * @deprecated Use `toDot` instead, which converts from any case. It keeps acronyms together,
625
+ * so results differ for keys like `userID` (see the migration notes in the README).
549
626
  */
550
627
  function pascalToDot(input) {
551
628
  return converter(input, "PascalToDot");
@@ -558,6 +635,9 @@ function pascalToDot(input) {
558
635
  * pascalToTitle('HelloWorld'); // 'Hello World'
559
636
  * pascalToTitle({ FirstName: 'John' }); // { 'First Name': 'John' }
560
637
  * ```
638
+ *
639
+ * @deprecated Use `toTitle` instead, which converts from any case. It keeps acronyms together,
640
+ * so results differ for keys like `userID` (see the migration notes in the README).
561
641
  */
562
642
  function pascalToTitle(input) {
563
643
  return converter(input, "PascalToTitle");
@@ -570,6 +650,9 @@ function pascalToTitle(input) {
570
650
  * pascalToSentence('HelloWorld'); // 'Hello world'
571
651
  * pascalToSentence({ FirstName: 'John' }); // { 'First name': 'John' }
572
652
  * ```
653
+ *
654
+ * @deprecated Use `toSentence` instead, which converts from any case. It keeps acronyms together,
655
+ * so results differ for keys like `userID` (see the migration notes in the README).
573
656
  */
574
657
  function pascalToSentence(input) {
575
658
  return converter(input, "PascalToSentence");
@@ -584,6 +667,9 @@ function pascalToSentence(input) {
584
667
  * snakeToCamel('hello_world'); // 'helloWorld'
585
668
  * snakeToCamel({ first_name: 'John' }); // { firstName: 'John' }
586
669
  * ```
670
+ *
671
+ * @deprecated Use `toCamel` instead, which converts from any case. It keeps acronyms together,
672
+ * so results differ for keys like `userID` (see the migration notes in the README).
587
673
  */
588
674
  function snakeToCamel(input) {
589
675
  return converter(input, "SnakeToCamel");
@@ -596,6 +682,9 @@ function snakeToCamel(input) {
596
682
  * snakeToDash('hello_world'); // 'hello-world'
597
683
  * snakeToDash({ first_name: 'John' }); // { 'first-name': 'John' }
598
684
  * ```
685
+ *
686
+ * @deprecated Use `toDash` instead, which converts from any case. It keeps acronyms together,
687
+ * so results differ for keys like `userID` (see the migration notes in the README).
599
688
  */
600
689
  function snakeToDash(input) {
601
690
  return converter(input, "SnakeToDash");
@@ -608,6 +697,9 @@ function snakeToDash(input) {
608
697
  * snakeToPascal('hello_world'); // 'HelloWorld'
609
698
  * snakeToPascal({ first_name: 'John' }); // { FirstName: 'John' }
610
699
  * ```
700
+ *
701
+ * @deprecated Use `toPascal` instead, which converts from any case. It keeps acronyms together,
702
+ * so results differ for keys like `userID` (see the migration notes in the README).
611
703
  */
612
704
  function snakeToPascal(input) {
613
705
  return converter(input, "SnakeToPascal");
@@ -620,6 +712,9 @@ function snakeToPascal(input) {
620
712
  * snakeToUpperSnake('hello_world'); // 'HELLO_WORLD'
621
713
  * snakeToUpperSnake({ first_name: 'John' }); // { FIRST_NAME: 'John' }
622
714
  * ```
715
+ *
716
+ * @deprecated Use `toUpperSnake` instead, which converts from any case. It keeps acronyms together,
717
+ * so results differ for keys like `userID` (see the migration notes in the README).
623
718
  */
624
719
  function snakeToUpperSnake(input) {
625
720
  return converter(input, "SnakeToUpperSnake");
@@ -632,6 +727,9 @@ function snakeToUpperSnake(input) {
632
727
  * snakeToUpperDash('hello_world'); // 'HELLO-WORLD'
633
728
  * snakeToUpperDash({ first_name: 'John' }); // { 'FIRST-NAME': 'John' }
634
729
  * ```
730
+ *
731
+ * @deprecated Use `toUpperDash` instead, which converts from any case. It keeps acronyms together,
732
+ * so results differ for keys like `userID` (see the migration notes in the README).
635
733
  */
636
734
  function snakeToUpperDash(input) {
637
735
  return converter(input, "SnakeToUpperDash");
@@ -644,6 +742,9 @@ function snakeToUpperDash(input) {
644
742
  * snakeToTrain('hello_world'); // 'Hello-World'
645
743
  * snakeToTrain({ first_name: 'John' }); // { 'First-Name': 'John' }
646
744
  * ```
745
+ *
746
+ * @deprecated Use `toTrain` instead, which converts from any case. It keeps acronyms together,
747
+ * so results differ for keys like `userID` (see the migration notes in the README).
647
748
  */
648
749
  function snakeToTrain(input) {
649
750
  return converter(input, "SnakeToTrain");
@@ -656,6 +757,9 @@ function snakeToTrain(input) {
656
757
  * snakeToDot('hello_world'); // 'hello.world'
657
758
  * snakeToDot({ first_name: 'John' }); // { 'first.name': 'John' }
658
759
  * ```
760
+ *
761
+ * @deprecated Use `toDot` instead, which converts from any case. It keeps acronyms together,
762
+ * so results differ for keys like `userID` (see the migration notes in the README).
659
763
  */
660
764
  function snakeToDot(input) {
661
765
  return converter(input, "SnakeToDot");
@@ -668,6 +772,9 @@ function snakeToDot(input) {
668
772
  * snakeToTitle('hello_world'); // 'Hello World'
669
773
  * snakeToTitle({ first_name: 'John' }); // { 'First Name': 'John' }
670
774
  * ```
775
+ *
776
+ * @deprecated Use `toTitle` instead, which converts from any case. It keeps acronyms together,
777
+ * so results differ for keys like `userID` (see the migration notes in the README).
671
778
  */
672
779
  function snakeToTitle(input) {
673
780
  return converter(input, "SnakeToTitle");
@@ -680,6 +787,9 @@ function snakeToTitle(input) {
680
787
  * snakeToSentence('hello_world'); // 'Hello world'
681
788
  * snakeToSentence({ first_name: 'John' }); // { 'First name': 'John' }
682
789
  * ```
790
+ *
791
+ * @deprecated Use `toSentence` instead, which converts from any case. It keeps acronyms together,
792
+ * so results differ for keys like `userID` (see the migration notes in the README).
683
793
  */
684
794
  function snakeToSentence(input) {
685
795
  return converter(input, "SnakeToSentence");
@@ -694,6 +804,9 @@ function snakeToSentence(input) {
694
804
  * trainToCamel('Hello-World'); // 'helloWorld'
695
805
  * trainToCamel({ 'First-Name': 'John' }); // { firstName: 'John' }
696
806
  * ```
807
+ *
808
+ * @deprecated Use `toCamel` instead, which converts from any case. It keeps acronyms together,
809
+ * so results differ for keys like `userID` (see the migration notes in the README).
697
810
  */
698
811
  function trainToCamel(input) {
699
812
  return converter(input, "TrainToCamel");
@@ -706,6 +819,9 @@ function trainToCamel(input) {
706
819
  * trainToPascal('Hello-World'); // 'HelloWorld'
707
820
  * trainToPascal({ 'First-Name': 'John' }); // { FirstName: 'John' }
708
821
  * ```
822
+ *
823
+ * @deprecated Use `toPascal` instead, which converts from any case. It keeps acronyms together,
824
+ * so results differ for keys like `userID` (see the migration notes in the README).
709
825
  */
710
826
  function trainToPascal(input) {
711
827
  return converter(input, "TrainToPascal");
@@ -718,6 +834,9 @@ function trainToPascal(input) {
718
834
  * trainToSnake('Hello-World'); // 'hello_world'
719
835
  * trainToSnake({ 'First-Name': 'John' }); // { first_name: 'John' }
720
836
  * ```
837
+ *
838
+ * @deprecated Use `toSnake` instead, which converts from any case. It keeps acronyms together,
839
+ * so results differ for keys like `userID` (see the migration notes in the README).
721
840
  */
722
841
  function trainToSnake(input) {
723
842
  return converter(input, "TrainToSnake");
@@ -730,6 +849,9 @@ function trainToSnake(input) {
730
849
  * trainToDash('Hello-World'); // 'hello-world'
731
850
  * trainToDash({ 'First-Name': 'John' }); // { 'first-name': 'John' }
732
851
  * ```
852
+ *
853
+ * @deprecated Use `toDash` instead, which converts from any case. It keeps acronyms together,
854
+ * so results differ for keys like `userID` (see the migration notes in the README).
733
855
  */
734
856
  function trainToDash(input) {
735
857
  return converter(input, "TrainToDash");
@@ -742,6 +864,9 @@ function trainToDash(input) {
742
864
  * trainToUpperSnake('Hello-World'); // 'HELLO_WORLD'
743
865
  * trainToUpperSnake({ 'First-Name': 'John' }); // { FIRST_NAME: 'John' }
744
866
  * ```
867
+ *
868
+ * @deprecated Use `toUpperSnake` instead, which converts from any case. It keeps acronyms together,
869
+ * so results differ for keys like `userID` (see the migration notes in the README).
745
870
  */
746
871
  function trainToUpperSnake(input) {
747
872
  return converter(input, "TrainToUpperSnake");
@@ -754,6 +879,9 @@ function trainToUpperSnake(input) {
754
879
  * trainToUpperDash('Hello-World'); // 'HELLO-WORLD'
755
880
  * trainToUpperDash({ 'First-Name': 'John' }); // { 'FIRST-NAME': 'John' }
756
881
  * ```
882
+ *
883
+ * @deprecated Use `toUpperDash` instead, which converts from any case. It keeps acronyms together,
884
+ * so results differ for keys like `userID` (see the migration notes in the README).
757
885
  */
758
886
  function trainToUpperDash(input) {
759
887
  return converter(input, "TrainToUpperDash");
@@ -766,6 +894,9 @@ function trainToUpperDash(input) {
766
894
  * trainToDot('Hello-World'); // 'hello.world'
767
895
  * trainToDot({ 'First-Name': 'John' }); // { 'first.name': 'John' }
768
896
  * ```
897
+ *
898
+ * @deprecated Use `toDot` instead, which converts from any case. It keeps acronyms together,
899
+ * so results differ for keys like `userID` (see the migration notes in the README).
769
900
  */
770
901
  function trainToDot(input) {
771
902
  return converter(input, "TrainToDot");
@@ -778,6 +909,9 @@ function trainToDot(input) {
778
909
  * trainToTitle('Hello-World'); // 'Hello World'
779
910
  * trainToTitle({ 'First-Name': 'John' }); // { 'First Name': 'John' }
780
911
  * ```
912
+ *
913
+ * @deprecated Use `toTitle` instead, which converts from any case. It keeps acronyms together,
914
+ * so results differ for keys like `userID` (see the migration notes in the README).
781
915
  */
782
916
  function trainToTitle(input) {
783
917
  return converter(input, "TrainToTitle");
@@ -790,6 +924,9 @@ function trainToTitle(input) {
790
924
  * trainToSentence('Hello-World'); // 'Hello world'
791
925
  * trainToSentence({ 'First-Name': 'John' }); // { 'First name': 'John' }
792
926
  * ```
927
+ *
928
+ * @deprecated Use `toSentence` instead, which converts from any case. It keeps acronyms together,
929
+ * so results differ for keys like `userID` (see the migration notes in the README).
793
930
  */
794
931
  function trainToSentence(input) {
795
932
  return converter(input, "TrainToSentence");
@@ -804,6 +941,9 @@ function trainToSentence(input) {
804
941
  * dotToCamel('hello.world'); // 'helloWorld'
805
942
  * dotToCamel({ 'first.name': 'John' }); // { firstName: 'John' }
806
943
  * ```
944
+ *
945
+ * @deprecated Use `toCamel` instead, which converts from any case. It keeps acronyms together,
946
+ * so results differ for keys like `userID` (see the migration notes in the README).
807
947
  */
808
948
  function dotToCamel(input) {
809
949
  return converter(input, "DotToCamel");
@@ -816,6 +956,9 @@ function dotToCamel(input) {
816
956
  * dotToPascal('hello.world'); // 'HelloWorld'
817
957
  * dotToPascal({ 'first.name': 'John' }); // { FirstName: 'John' }
818
958
  * ```
959
+ *
960
+ * @deprecated Use `toPascal` instead, which converts from any case. It keeps acronyms together,
961
+ * so results differ for keys like `userID` (see the migration notes in the README).
819
962
  */
820
963
  function dotToPascal(input) {
821
964
  return converter(input, "DotToPascal");
@@ -828,6 +971,9 @@ function dotToPascal(input) {
828
971
  * dotToSnake('hello.world'); // 'hello_world'
829
972
  * dotToSnake({ 'first.name': 'John' }); // { first_name: 'John' }
830
973
  * ```
974
+ *
975
+ * @deprecated Use `toSnake` instead, which converts from any case. It keeps acronyms together,
976
+ * so results differ for keys like `userID` (see the migration notes in the README).
831
977
  */
832
978
  function dotToSnake(input) {
833
979
  return converter(input, "DotToSnake");
@@ -840,6 +986,9 @@ function dotToSnake(input) {
840
986
  * dotToDash('hello.world'); // 'hello-world'
841
987
  * dotToDash({ 'first.name': 'John' }); // { 'first-name': 'John' }
842
988
  * ```
989
+ *
990
+ * @deprecated Use `toDash` instead, which converts from any case. It keeps acronyms together,
991
+ * so results differ for keys like `userID` (see the migration notes in the README).
843
992
  */
844
993
  function dotToDash(input) {
845
994
  return converter(input, "DotToDash");
@@ -852,6 +1001,9 @@ function dotToDash(input) {
852
1001
  * dotToUpperSnake('hello.world'); // 'HELLO_WORLD'
853
1002
  * dotToUpperSnake({ 'first.name': 'John' }); // { FIRST_NAME: 'John' }
854
1003
  * ```
1004
+ *
1005
+ * @deprecated Use `toUpperSnake` instead, which converts from any case. It keeps acronyms together,
1006
+ * so results differ for keys like `userID` (see the migration notes in the README).
855
1007
  */
856
1008
  function dotToUpperSnake(input) {
857
1009
  return converter(input, "DotToUpperSnake");
@@ -864,6 +1016,9 @@ function dotToUpperSnake(input) {
864
1016
  * dotToUpperDash('hello.world'); // 'HELLO-WORLD'
865
1017
  * dotToUpperDash({ 'first.name': 'John' }); // { 'FIRST-NAME': 'John' }
866
1018
  * ```
1019
+ *
1020
+ * @deprecated Use `toUpperDash` instead, which converts from any case. It keeps acronyms together,
1021
+ * so results differ for keys like `userID` (see the migration notes in the README).
867
1022
  */
868
1023
  function dotToUpperDash(input) {
869
1024
  return converter(input, "DotToUpperDash");
@@ -876,6 +1031,9 @@ function dotToUpperDash(input) {
876
1031
  * dotToTrain('hello.world'); // 'Hello-World'
877
1032
  * dotToTrain({ 'first.name': 'John' }); // { 'First-Name': 'John' }
878
1033
  * ```
1034
+ *
1035
+ * @deprecated Use `toTrain` instead, which converts from any case. It keeps acronyms together,
1036
+ * so results differ for keys like `userID` (see the migration notes in the README).
879
1037
  */
880
1038
  function dotToTrain(input) {
881
1039
  return converter(input, "DotToTrain");
@@ -888,6 +1046,9 @@ function dotToTrain(input) {
888
1046
  * dotToTitle('hello.world'); // 'Hello World'
889
1047
  * dotToTitle({ 'first.name': 'John' }); // { 'First Name': 'John' }
890
1048
  * ```
1049
+ *
1050
+ * @deprecated Use `toTitle` instead, which converts from any case. It keeps acronyms together,
1051
+ * so results differ for keys like `userID` (see the migration notes in the README).
891
1052
  */
892
1053
  function dotToTitle(input) {
893
1054
  return converter(input, "DotToTitle");
@@ -900,6 +1061,9 @@ function dotToTitle(input) {
900
1061
  * dotToSentence('hello.world'); // 'Hello world'
901
1062
  * dotToSentence({ 'first.name': 'John' }); // { 'First name': 'John' }
902
1063
  * ```
1064
+ *
1065
+ * @deprecated Use `toSentence` instead, which converts from any case. It keeps acronyms together,
1066
+ * so results differ for keys like `userID` (see the migration notes in the README).
903
1067
  */
904
1068
  function dotToSentence(input) {
905
1069
  return converter(input, "DotToSentence");
@@ -914,6 +1078,9 @@ function dotToSentence(input) {
914
1078
  * titleToCamel('Hello World'); // 'helloWorld'
915
1079
  * titleToCamel({ 'First Name': 'John' }); // { firstName: 'John' }
916
1080
  * ```
1081
+ *
1082
+ * @deprecated Use `toCamel` instead, which converts from any case. It keeps acronyms together,
1083
+ * so results differ for keys like `userID` (see the migration notes in the README).
917
1084
  */
918
1085
  function titleToCamel(input) {
919
1086
  return converter(input, "TitleToCamel");
@@ -926,6 +1093,9 @@ function titleToCamel(input) {
926
1093
  * titleToPascal('Hello World'); // 'HelloWorld'
927
1094
  * titleToPascal({ 'First Name': 'John' }); // { FirstName: 'John' }
928
1095
  * ```
1096
+ *
1097
+ * @deprecated Use `toPascal` instead, which converts from any case. It keeps acronyms together,
1098
+ * so results differ for keys like `userID` (see the migration notes in the README).
929
1099
  */
930
1100
  function titleToPascal(input) {
931
1101
  return converter(input, "TitleToPascal");
@@ -938,6 +1108,9 @@ function titleToPascal(input) {
938
1108
  * titleToSnake('Hello World'); // 'hello_world'
939
1109
  * titleToSnake({ 'First Name': 'John' }); // { first_name: 'John' }
940
1110
  * ```
1111
+ *
1112
+ * @deprecated Use `toSnake` instead, which converts from any case. It keeps acronyms together,
1113
+ * so results differ for keys like `userID` (see the migration notes in the README).
941
1114
  */
942
1115
  function titleToSnake(input) {
943
1116
  return converter(input, "TitleToSnake");
@@ -950,6 +1123,9 @@ function titleToSnake(input) {
950
1123
  * titleToDash('Hello World'); // 'hello-world'
951
1124
  * titleToDash({ 'First Name': 'John' }); // { 'first-name': 'John' }
952
1125
  * ```
1126
+ *
1127
+ * @deprecated Use `toDash` instead, which converts from any case. It keeps acronyms together,
1128
+ * so results differ for keys like `userID` (see the migration notes in the README).
953
1129
  */
954
1130
  function titleToDash(input) {
955
1131
  return converter(input, "TitleToDash");
@@ -962,6 +1138,9 @@ function titleToDash(input) {
962
1138
  * titleToUpperSnake('Hello World'); // 'HELLO_WORLD'
963
1139
  * titleToUpperSnake({ 'First Name': 'John' }); // { FIRST_NAME: 'John' }
964
1140
  * ```
1141
+ *
1142
+ * @deprecated Use `toUpperSnake` instead, which converts from any case. It keeps acronyms together,
1143
+ * so results differ for keys like `userID` (see the migration notes in the README).
965
1144
  */
966
1145
  function titleToUpperSnake(input) {
967
1146
  return converter(input, "TitleToUpperSnake");
@@ -974,6 +1153,9 @@ function titleToUpperSnake(input) {
974
1153
  * titleToUpperDash('Hello World'); // 'HELLO-WORLD'
975
1154
  * titleToUpperDash({ 'First Name': 'John' }); // { 'FIRST-NAME': 'John' }
976
1155
  * ```
1156
+ *
1157
+ * @deprecated Use `toUpperDash` instead, which converts from any case. It keeps acronyms together,
1158
+ * so results differ for keys like `userID` (see the migration notes in the README).
977
1159
  */
978
1160
  function titleToUpperDash(input) {
979
1161
  return converter(input, "TitleToUpperDash");
@@ -986,6 +1168,9 @@ function titleToUpperDash(input) {
986
1168
  * titleToTrain('Hello World'); // 'Hello-World'
987
1169
  * titleToTrain({ 'First Name': 'John' }); // { 'First-Name': 'John' }
988
1170
  * ```
1171
+ *
1172
+ * @deprecated Use `toTrain` instead, which converts from any case. It keeps acronyms together,
1173
+ * so results differ for keys like `userID` (see the migration notes in the README).
989
1174
  */
990
1175
  function titleToTrain(input) {
991
1176
  return converter(input, "TitleToTrain");
@@ -998,6 +1183,9 @@ function titleToTrain(input) {
998
1183
  * titleToDot('Hello World'); // 'hello.world'
999
1184
  * titleToDot({ 'First Name': 'John' }); // { 'first.name': 'John' }
1000
1185
  * ```
1186
+ *
1187
+ * @deprecated Use `toDot` instead, which converts from any case. It keeps acronyms together,
1188
+ * so results differ for keys like `userID` (see the migration notes in the README).
1001
1189
  */
1002
1190
  function titleToDot(input) {
1003
1191
  return converter(input, "TitleToDot");
@@ -1010,6 +1198,9 @@ function titleToDot(input) {
1010
1198
  * titleToSentence('Hello World'); // 'Hello world'
1011
1199
  * titleToSentence({ 'First Name': 'John' }); // { 'First name': 'John' }
1012
1200
  * ```
1201
+ *
1202
+ * @deprecated Use `toSentence` instead, which converts from any case. It keeps acronyms together,
1203
+ * so results differ for keys like `userID` (see the migration notes in the README).
1013
1204
  */
1014
1205
  function titleToSentence(input) {
1015
1206
  return converter(input, "TitleToSentence");
@@ -1024,6 +1215,9 @@ function titleToSentence(input) {
1024
1215
  * sentenceToCamel('Hello world'); // 'helloWorld'
1025
1216
  * sentenceToCamel({ 'First name': 'John' }); // { firstName: 'John' }
1026
1217
  * ```
1218
+ *
1219
+ * @deprecated Use `toCamel` instead, which converts from any case. It keeps acronyms together,
1220
+ * so results differ for keys like `userID` (see the migration notes in the README).
1027
1221
  */
1028
1222
  function sentenceToCamel(input) {
1029
1223
  return converter(input, "SentenceToCamel");
@@ -1036,6 +1230,9 @@ function sentenceToCamel(input) {
1036
1230
  * sentenceToPascal('Hello world'); // 'HelloWorld'
1037
1231
  * sentenceToPascal({ 'First name': 'John' }); // { FirstName: 'John' }
1038
1232
  * ```
1233
+ *
1234
+ * @deprecated Use `toPascal` instead, which converts from any case. It keeps acronyms together,
1235
+ * so results differ for keys like `userID` (see the migration notes in the README).
1039
1236
  */
1040
1237
  function sentenceToPascal(input) {
1041
1238
  return converter(input, "SentenceToPascal");
@@ -1048,6 +1245,9 @@ function sentenceToPascal(input) {
1048
1245
  * sentenceToSnake('Hello world'); // 'hello_world'
1049
1246
  * sentenceToSnake({ 'First name': 'John' }); // { first_name: 'John' }
1050
1247
  * ```
1248
+ *
1249
+ * @deprecated Use `toSnake` instead, which converts from any case. It keeps acronyms together,
1250
+ * so results differ for keys like `userID` (see the migration notes in the README).
1051
1251
  */
1052
1252
  function sentenceToSnake(input) {
1053
1253
  return converter(input, "SentenceToSnake");
@@ -1060,6 +1260,9 @@ function sentenceToSnake(input) {
1060
1260
  * sentenceToDash('Hello world'); // 'hello-world'
1061
1261
  * sentenceToDash({ 'First name': 'John' }); // { 'first-name': 'John' }
1062
1262
  * ```
1263
+ *
1264
+ * @deprecated Use `toDash` instead, which converts from any case. It keeps acronyms together,
1265
+ * so results differ for keys like `userID` (see the migration notes in the README).
1063
1266
  */
1064
1267
  function sentenceToDash(input) {
1065
1268
  return converter(input, "SentenceToDash");
@@ -1072,6 +1275,9 @@ function sentenceToDash(input) {
1072
1275
  * sentenceToUpperSnake('Hello world'); // 'HELLO_WORLD'
1073
1276
  * sentenceToUpperSnake({ 'First name': 'John' }); // { FIRST_NAME: 'John' }
1074
1277
  * ```
1278
+ *
1279
+ * @deprecated Use `toUpperSnake` instead, which converts from any case. It keeps acronyms together,
1280
+ * so results differ for keys like `userID` (see the migration notes in the README).
1075
1281
  */
1076
1282
  function sentenceToUpperSnake(input) {
1077
1283
  return converter(input, "SentenceToUpperSnake");
@@ -1084,6 +1290,9 @@ function sentenceToUpperSnake(input) {
1084
1290
  * sentenceToUpperDash('Hello world'); // 'HELLO-WORLD'
1085
1291
  * sentenceToUpperDash({ 'First name': 'John' }); // { 'FIRST-NAME': 'John' }
1086
1292
  * ```
1293
+ *
1294
+ * @deprecated Use `toUpperDash` instead, which converts from any case. It keeps acronyms together,
1295
+ * so results differ for keys like `userID` (see the migration notes in the README).
1087
1296
  */
1088
1297
  function sentenceToUpperDash(input) {
1089
1298
  return converter(input, "SentenceToUpperDash");
@@ -1096,6 +1305,9 @@ function sentenceToUpperDash(input) {
1096
1305
  * sentenceToTrain('Hello world'); // 'Hello-World'
1097
1306
  * sentenceToTrain({ 'First name': 'John' }); // { 'First-Name': 'John' }
1098
1307
  * ```
1308
+ *
1309
+ * @deprecated Use `toTrain` instead, which converts from any case. It keeps acronyms together,
1310
+ * so results differ for keys like `userID` (see the migration notes in the README).
1099
1311
  */
1100
1312
  function sentenceToTrain(input) {
1101
1313
  return converter(input, "SentenceToTrain");
@@ -1108,6 +1320,9 @@ function sentenceToTrain(input) {
1108
1320
  * sentenceToDot('Hello world'); // 'hello.world'
1109
1321
  * sentenceToDot({ 'First name': 'John' }); // { 'first.name': 'John' }
1110
1322
  * ```
1323
+ *
1324
+ * @deprecated Use `toDot` instead, which converts from any case. It keeps acronyms together,
1325
+ * so results differ for keys like `userID` (see the migration notes in the README).
1111
1326
  */
1112
1327
  function sentenceToDot(input) {
1113
1328
  return converter(input, "SentenceToDot");
@@ -1120,6 +1335,9 @@ function sentenceToDot(input) {
1120
1335
  * sentenceToTitle('Hello world'); // 'Hello World'
1121
1336
  * sentenceToTitle({ 'First name': 'John' }); // { 'First Name': 'John' }
1122
1337
  * ```
1338
+ *
1339
+ * @deprecated Use `toTitle` instead, which converts from any case. It keeps acronyms together,
1340
+ * so results differ for keys like `userID` (see the migration notes in the README).
1123
1341
  */
1124
1342
  function sentenceToTitle(input) {
1125
1343
  return converter(input, "SentenceToTitle");
@@ -1134,6 +1352,9 @@ function sentenceToTitle(input) {
1134
1352
  * upperDashToCamel('HELLO-WORLD'); // 'helloWorld'
1135
1353
  * upperDashToCamel({ 'FIRST-NAME': 'John' }); // { firstName: 'John' }
1136
1354
  * ```
1355
+ *
1356
+ * @deprecated Use `toCamel` instead, which converts from any case. It keeps acronyms together,
1357
+ * so results differ for keys like `userID` (see the migration notes in the README).
1137
1358
  */
1138
1359
  function upperDashToCamel(input) {
1139
1360
  return converter(input, "UpperDashToCamel");
@@ -1146,6 +1367,9 @@ function upperDashToCamel(input) {
1146
1367
  * upperDashToSnake('HELLO-WORLD'); // 'hello_world'
1147
1368
  * upperDashToSnake({ 'FIRST-NAME': 'John' }); // { first_name: 'John' }
1148
1369
  * ```
1370
+ *
1371
+ * @deprecated Use `toSnake` instead, which converts from any case. It keeps acronyms together,
1372
+ * so results differ for keys like `userID` (see the migration notes in the README).
1149
1373
  */
1150
1374
  function upperDashToSnake(input) {
1151
1375
  return converter(input, "UpperDashToSnake");
@@ -1158,6 +1382,9 @@ function upperDashToSnake(input) {
1158
1382
  * upperDashToDash('HELLO-WORLD'); // 'hello-world'
1159
1383
  * upperDashToDash({ 'FIRST-NAME': 'John' }); // { 'first-name': 'John' }
1160
1384
  * ```
1385
+ *
1386
+ * @deprecated Use `toDash` instead, which converts from any case. It keeps acronyms together,
1387
+ * so results differ for keys like `userID` (see the migration notes in the README).
1161
1388
  */
1162
1389
  function upperDashToDash(input) {
1163
1390
  return converter(input, "UpperDashToDash");
@@ -1170,6 +1397,9 @@ function upperDashToDash(input) {
1170
1397
  * upperDashToPascal('HELLO-WORLD'); // 'HelloWorld'
1171
1398
  * upperDashToPascal({ 'FIRST-NAME': 'John' }); // { FirstName: 'John' }
1172
1399
  * ```
1400
+ *
1401
+ * @deprecated Use `toPascal` instead, which converts from any case. It keeps acronyms together,
1402
+ * so results differ for keys like `userID` (see the migration notes in the README).
1173
1403
  */
1174
1404
  function upperDashToPascal(input) {
1175
1405
  return converter(input, "UpperDashToPascal");
@@ -1182,6 +1412,9 @@ function upperDashToPascal(input) {
1182
1412
  * upperDashToUpperSnake('HELLO-WORLD'); // 'HELLO_WORLD'
1183
1413
  * upperDashToUpperSnake({ 'FIRST-NAME': 'John' }); // { FIRST_NAME: 'John' }
1184
1414
  * ```
1415
+ *
1416
+ * @deprecated Use `toUpperSnake` instead, which converts from any case. It keeps acronyms together,
1417
+ * so results differ for keys like `userID` (see the migration notes in the README).
1185
1418
  */
1186
1419
  function upperDashToUpperSnake(input) {
1187
1420
  return converter(input, "UpperDashToUpperSnake");
@@ -1194,6 +1427,9 @@ function upperDashToUpperSnake(input) {
1194
1427
  * upperDashToTrain('HELLO-WORLD'); // 'Hello-World'
1195
1428
  * upperDashToTrain({ 'FIRST-NAME': 'John' }); // { 'First-Name': 'John' }
1196
1429
  * ```
1430
+ *
1431
+ * @deprecated Use `toTrain` instead, which converts from any case. It keeps acronyms together,
1432
+ * so results differ for keys like `userID` (see the migration notes in the README).
1197
1433
  */
1198
1434
  function upperDashToTrain(input) {
1199
1435
  return converter(input, "UpperDashToTrain");
@@ -1206,6 +1442,9 @@ function upperDashToTrain(input) {
1206
1442
  * upperDashToDot('HELLO-WORLD'); // 'hello.world'
1207
1443
  * upperDashToDot({ 'FIRST-NAME': 'John' }); // { 'first.name': 'John' }
1208
1444
  * ```
1445
+ *
1446
+ * @deprecated Use `toDot` instead, which converts from any case. It keeps acronyms together,
1447
+ * so results differ for keys like `userID` (see the migration notes in the README).
1209
1448
  */
1210
1449
  function upperDashToDot(input) {
1211
1450
  return converter(input, "UpperDashToDot");
@@ -1218,6 +1457,9 @@ function upperDashToDot(input) {
1218
1457
  * upperDashToTitle('HELLO-WORLD'); // 'Hello World'
1219
1458
  * upperDashToTitle({ 'FIRST-NAME': 'John' }); // { 'First Name': 'John' }
1220
1459
  * ```
1460
+ *
1461
+ * @deprecated Use `toTitle` instead, which converts from any case. It keeps acronyms together,
1462
+ * so results differ for keys like `userID` (see the migration notes in the README).
1221
1463
  */
1222
1464
  function upperDashToTitle(input) {
1223
1465
  return converter(input, "UpperDashToTitle");
@@ -1230,6 +1472,9 @@ function upperDashToTitle(input) {
1230
1472
  * upperDashToSentence('HELLO-WORLD'); // 'Hello world'
1231
1473
  * upperDashToSentence({ 'FIRST-NAME': 'John' }); // { 'First name': 'John' }
1232
1474
  * ```
1475
+ *
1476
+ * @deprecated Use `toSentence` instead, which converts from any case. It keeps acronyms together,
1477
+ * so results differ for keys like `userID` (see the migration notes in the README).
1233
1478
  */
1234
1479
  function upperDashToSentence(input) {
1235
1480
  return converter(input, "UpperDashToSentence");
@@ -1244,6 +1489,9 @@ function upperDashToSentence(input) {
1244
1489
  * upperSnakeToCamel('HELLO_WORLD'); // 'helloWorld'
1245
1490
  * upperSnakeToCamel({ FIRST_NAME: 'John' }); // { firstName: 'John' }
1246
1491
  * ```
1492
+ *
1493
+ * @deprecated Use `toCamel` instead, which converts from any case. It keeps acronyms together,
1494
+ * so results differ for keys like `userID` (see the migration notes in the README).
1247
1495
  */
1248
1496
  function upperSnakeToCamel(input) {
1249
1497
  return converter(input, "UpperSnakeToCamel");
@@ -1256,6 +1504,9 @@ function upperSnakeToCamel(input) {
1256
1504
  * upperSnakeToSnake('HELLO_WORLD'); // 'hello_world'
1257
1505
  * upperSnakeToSnake({ FIRST_NAME: 'John' }); // { first_name: 'John' }
1258
1506
  * ```
1507
+ *
1508
+ * @deprecated Use `toSnake` instead, which converts from any case. It keeps acronyms together,
1509
+ * so results differ for keys like `userID` (see the migration notes in the README).
1259
1510
  */
1260
1511
  function upperSnakeToSnake(input) {
1261
1512
  return converter(input, "UpperSnakeToSnake");
@@ -1268,6 +1519,9 @@ function upperSnakeToSnake(input) {
1268
1519
  * upperSnakeToDash('HELLO_WORLD'); // 'hello-world'
1269
1520
  * upperSnakeToDash({ FIRST_NAME: 'John' }); // { 'first-name': 'John' }
1270
1521
  * ```
1522
+ *
1523
+ * @deprecated Use `toDash` instead, which converts from any case. It keeps acronyms together,
1524
+ * so results differ for keys like `userID` (see the migration notes in the README).
1271
1525
  */
1272
1526
  function upperSnakeToDash(input) {
1273
1527
  return converter(input, "UpperSnakeToDash");
@@ -1280,6 +1534,9 @@ function upperSnakeToDash(input) {
1280
1534
  * upperSnakeToPascal('HELLO_WORLD'); // 'HelloWorld'
1281
1535
  * upperSnakeToPascal({ FIRST_NAME: 'John' }); // { FirstName: 'John' }
1282
1536
  * ```
1537
+ *
1538
+ * @deprecated Use `toPascal` instead, which converts from any case. It keeps acronyms together,
1539
+ * so results differ for keys like `userID` (see the migration notes in the README).
1283
1540
  */
1284
1541
  function upperSnakeToPascal(input) {
1285
1542
  return converter(input, "UpperSnakeToPascal");
@@ -1292,6 +1549,9 @@ function upperSnakeToPascal(input) {
1292
1549
  * upperSnakeToUpperDash('HELLO_WORLD'); // 'HELLO-WORLD'
1293
1550
  * upperSnakeToUpperDash({ FIRST_NAME: 'John' }); // { 'FIRST-NAME': 'John' }
1294
1551
  * ```
1552
+ *
1553
+ * @deprecated Use `toUpperDash` instead, which converts from any case. It keeps acronyms together,
1554
+ * so results differ for keys like `userID` (see the migration notes in the README).
1295
1555
  */
1296
1556
  function upperSnakeToUpperDash(input) {
1297
1557
  return converter(input, "UpperSnakeToUpperDash");
@@ -1304,6 +1564,9 @@ function upperSnakeToUpperDash(input) {
1304
1564
  * upperSnakeToTrain('HELLO_WORLD'); // 'Hello-World'
1305
1565
  * upperSnakeToTrain({ FIRST_NAME: 'John' }); // { 'First-Name': 'John' }
1306
1566
  * ```
1567
+ *
1568
+ * @deprecated Use `toTrain` instead, which converts from any case. It keeps acronyms together,
1569
+ * so results differ for keys like `userID` (see the migration notes in the README).
1307
1570
  */
1308
1571
  function upperSnakeToTrain(input) {
1309
1572
  return converter(input, "UpperSnakeToTrain");
@@ -1316,6 +1579,9 @@ function upperSnakeToTrain(input) {
1316
1579
  * upperSnakeToDot('HELLO_WORLD'); // 'hello.world'
1317
1580
  * upperSnakeToDot({ FIRST_NAME: 'John' }); // { 'first.name': 'John' }
1318
1581
  * ```
1582
+ *
1583
+ * @deprecated Use `toDot` instead, which converts from any case. It keeps acronyms together,
1584
+ * so results differ for keys like `userID` (see the migration notes in the README).
1319
1585
  */
1320
1586
  function upperSnakeToDot(input) {
1321
1587
  return converter(input, "UpperSnakeToDot");
@@ -1328,6 +1594,9 @@ function upperSnakeToDot(input) {
1328
1594
  * upperSnakeToTitle('HELLO_WORLD'); // 'Hello World'
1329
1595
  * upperSnakeToTitle({ FIRST_NAME: 'John' }); // { 'First Name': 'John' }
1330
1596
  * ```
1597
+ *
1598
+ * @deprecated Use `toTitle` instead, which converts from any case. It keeps acronyms together,
1599
+ * so results differ for keys like `userID` (see the migration notes in the README).
1331
1600
  */
1332
1601
  function upperSnakeToTitle(input) {
1333
1602
  return converter(input, "UpperSnakeToTitle");
@@ -1340,9 +1609,177 @@ function upperSnakeToTitle(input) {
1340
1609
  * upperSnakeToSentence('HELLO_WORLD'); // 'Hello world'
1341
1610
  * upperSnakeToSentence({ FIRST_NAME: 'John' }); // { 'First name': 'John' }
1342
1611
  * ```
1612
+ *
1613
+ * @deprecated Use `toSentence` instead, which converts from any case. It keeps acronyms together,
1614
+ * so results differ for keys like `userID` (see the migration notes in the README).
1343
1615
  */
1344
1616
  function upperSnakeToSentence(input) {
1345
1617
  return converter(input, "UpperSnakeToSentence");
1346
1618
  }
1347
1619
  //#endregion
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 };
1620
+ //#region src/anyCase/words.ts
1621
+ const isSeparator = (c) => c === "_" || c === "-" || c === "." || c === " ";
1622
+ const isUpper = (c) => c !== c.toLowerCase();
1623
+ const isLower = (c) => c !== c.toUpperCase();
1624
+ /**
1625
+ * Splits a string in any case into lowercase words: on `_`, `-`, `.` and spaces,
1626
+ * before an uppercase letter that follows a lowercase letter or a digit (`helloWorld`),
1627
+ * and before the last letter of an acronym (`XMLHttp`). Mirrors the `Words` type.
1628
+ */
1629
+ function words(str) {
1630
+ const result = [];
1631
+ let word = "";
1632
+ let prev = "";
1633
+ const push = () => {
1634
+ if (word) result.push(word.toLowerCase());
1635
+ word = "";
1636
+ };
1637
+ for (let i = 0; i < str.length; i++) {
1638
+ const c = str[i];
1639
+ if (isSeparator(c)) {
1640
+ push();
1641
+ prev = "";
1642
+ continue;
1643
+ }
1644
+ const next = str.charAt(i + 1);
1645
+ if (isUpper(c) && word && (!isUpper(prev) || next && isLower(next))) push();
1646
+ word += c;
1647
+ prev = c;
1648
+ }
1649
+ push();
1650
+ return result;
1651
+ }
1652
+ const ToCamel = (str) => words(str).map((w, i) => i ? Capitalize(w) : w).join("");
1653
+ const ToPascal = (str) => words(str).map(Capitalize).join("");
1654
+ const ToSnake = (str) => words(str).join("_");
1655
+ const ToDash = (str) => words(str).join("-");
1656
+ const ToUpperSnake = (str) => words(str).join("_").toUpperCase();
1657
+ const ToUpperDash = (str) => words(str).join("-").toUpperCase();
1658
+ const ToTrain = (str) => words(str).map(Capitalize).join("-");
1659
+ const ToDot = (str) => words(str).join(".");
1660
+ const ToTitle = (str) => words(str).map(Capitalize).join(" ");
1661
+ const ToSentence = (str) => Capitalize(words(str).join(" "));
1662
+ //#endregion
1663
+ //#region src/anyCase/anyCase.ts
1664
+ /**
1665
+ * Converts a string, or the keys of an object/array (deeply), from any case to camelCase.
1666
+ *
1667
+ * @example
1668
+ * ```ts
1669
+ * toCamel('hello_world'); // 'helloWorld'
1670
+ * toCamel({ first_name: 'John', userID: 1 }); // { firstName: 'John', userId: 1 }
1671
+ * ```
1672
+ */
1673
+ function toCamel(input) {
1674
+ return convert(input, ToCamel);
1675
+ }
1676
+ /**
1677
+ * Converts a string, or the keys of an object/array (deeply), from any case to PascalCase.
1678
+ *
1679
+ * @example
1680
+ * ```ts
1681
+ * toPascal('hello-world'); // 'HelloWorld'
1682
+ * toPascal({ 'first-name': 'John', userID: 1 }); // { FirstName: 'John', UserId: 1 }
1683
+ * ```
1684
+ */
1685
+ function toPascal(input) {
1686
+ return convert(input, ToPascal);
1687
+ }
1688
+ /**
1689
+ * Converts a string, or the keys of an object/array (deeply), from any case to snake_case.
1690
+ *
1691
+ * @example
1692
+ * ```ts
1693
+ * toSnake('helloWorld'); // 'hello_world'
1694
+ * toSnake({ firstName: 'John', userID: 1 }); // { first_name: 'John', user_id: 1 }
1695
+ * ```
1696
+ */
1697
+ function toSnake(input) {
1698
+ return convert(input, ToSnake);
1699
+ }
1700
+ /**
1701
+ * Converts a string, or the keys of an object/array (deeply), from any case to dash-case.
1702
+ *
1703
+ * @example
1704
+ * ```ts
1705
+ * toDash('HELLO_WORLD'); // 'hello-world'
1706
+ * toDash({ FIRST_NAME: 'John', userID: 1 }); // { 'first-name': 'John', 'user-id': 1 }
1707
+ * ```
1708
+ */
1709
+ function toDash(input) {
1710
+ return convert(input, ToDash);
1711
+ }
1712
+ /**
1713
+ * Converts a string, or the keys of an object/array (deeply), from any case to UPPER_SNAKE_CASE.
1714
+ *
1715
+ * @example
1716
+ * ```ts
1717
+ * toUpperSnake('hello-world'); // 'HELLO_WORLD'
1718
+ * toUpperSnake({ 'first-name': 'John', userID: 1 }); // { FIRST_NAME: 'John', USER_ID: 1 }
1719
+ * ```
1720
+ */
1721
+ function toUpperSnake(input) {
1722
+ return convert(input, ToUpperSnake);
1723
+ }
1724
+ /**
1725
+ * Converts a string, or the keys of an object/array (deeply), from any case to UPPER-DASH-CASE.
1726
+ *
1727
+ * @example
1728
+ * ```ts
1729
+ * toUpperDash('helloWorld'); // 'HELLO-WORLD'
1730
+ * toUpperDash({ firstName: 'John', userID: 1 }); // { 'FIRST-NAME': 'John', 'USER-ID': 1 }
1731
+ * ```
1732
+ */
1733
+ function toUpperDash(input) {
1734
+ return convert(input, ToUpperDash);
1735
+ }
1736
+ /**
1737
+ * Converts a string, or the keys of an object/array (deeply), from any case to Train-Case.
1738
+ *
1739
+ * @example
1740
+ * ```ts
1741
+ * toTrain('hello_world'); // 'Hello-World'
1742
+ * toTrain({ first_name: 'John', userID: 1 }); // { 'First-Name': 'John', 'User-Id': 1 }
1743
+ * ```
1744
+ */
1745
+ function toTrain(input) {
1746
+ return convert(input, ToTrain);
1747
+ }
1748
+ /**
1749
+ * Converts a string, or the keys of an object/array (deeply), from any case to dot.case.
1750
+ *
1751
+ * @example
1752
+ * ```ts
1753
+ * toDot('HelloWorld'); // 'hello.world'
1754
+ * toDot({ FirstName: 'John', userID: 1 }); // { 'first.name': 'John', 'user.id': 1 }
1755
+ * ```
1756
+ */
1757
+ function toDot(input) {
1758
+ return convert(input, ToDot);
1759
+ }
1760
+ /**
1761
+ * Converts a string, or the keys of an object/array (deeply), from any case to Title Case.
1762
+ *
1763
+ * @example
1764
+ * ```ts
1765
+ * toTitle('hello_world'); // 'Hello World'
1766
+ * toTitle({ first_name: 'John', userID: 1 }); // { 'First Name': 'John', 'User Id': 1 }
1767
+ * ```
1768
+ */
1769
+ function toTitle(input) {
1770
+ return convert(input, ToTitle);
1771
+ }
1772
+ /**
1773
+ * Converts a string, or the keys of an object/array (deeply), from any case to Sentence case.
1774
+ *
1775
+ * @example
1776
+ * ```ts
1777
+ * toSentence('helloWorld'); // 'Hello world'
1778
+ * toSentence({ firstName: 'John', userID: 1 }); // { 'First name': 'John', 'User id': 1 }
1779
+ * ```
1780
+ */
1781
+ function toSentence(input) {
1782
+ return convert(input, ToSentence);
1783
+ }
1784
+ //#endregion
1785
+ 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, toCamel, toDash, toDot, toPascal, toSentence, toSnake, toTitle, toTrain, toUpperDash, toUpperSnake, 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 };