@visulima/string 1.2.3 → 1.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.
Files changed (102) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +46 -0
  3. package/dist/case/camel-case.cjs +1 -59
  4. package/dist/case/camel-case.mjs +1 -57
  5. package/dist/case/capital-case.cjs +1 -51
  6. package/dist/case/capital-case.mjs +1 -49
  7. package/dist/case/constant-case.cjs +1 -11
  8. package/dist/case/constant-case.mjs +1 -9
  9. package/dist/case/dot-case.cjs +1 -11
  10. package/dist/case/dot-case.mjs +1 -9
  11. package/dist/case/flat-case.cjs +1 -11
  12. package/dist/case/flat-case.mjs +1 -9
  13. package/dist/case/flip-case.cjs +1 -61
  14. package/dist/case/flip-case.mjs +1 -57
  15. package/dist/case/identify-case.cjs +1 -69
  16. package/dist/case/identify-case.mjs +1 -67
  17. package/dist/case/index.cjs +1 -47
  18. package/dist/case/index.mjs +1 -20
  19. package/dist/case/kebab-case.cjs +1 -61
  20. package/dist/case/kebab-case.mjs +1 -57
  21. package/dist/case/lower-first.cjs +1 -13
  22. package/dist/case/lower-first.mjs +1 -11
  23. package/dist/case/no-case.cjs +1 -11
  24. package/dist/case/no-case.mjs +1 -9
  25. package/dist/case/pascal-case.cjs +1 -52
  26. package/dist/case/pascal-case.mjs +1 -50
  27. package/dist/case/pascal-snake-case.cjs +1 -32
  28. package/dist/case/pascal-snake-case.mjs +1 -30
  29. package/dist/case/path-case.cjs +1 -11
  30. package/dist/case/path-case.mjs +1 -9
  31. package/dist/case/sentence-case.cjs +1 -58
  32. package/dist/case/sentence-case.mjs +1 -56
  33. package/dist/case/snake-case.cjs +1 -11
  34. package/dist/case/snake-case.mjs +1 -9
  35. package/dist/case/split-by-case.cjs +1 -641
  36. package/dist/case/split-by-case.mjs +1 -637
  37. package/dist/case/title-case.cjs +1 -47
  38. package/dist/case/title-case.mjs +1 -45
  39. package/dist/case/train-case.cjs +1 -44
  40. package/dist/case/train-case.mjs +1 -42
  41. package/dist/case/upper-first.cjs +1 -13
  42. package/dist/case/upper-first.mjs +1 -11
  43. package/dist/get-string-truncated-width.cjs +1 -422
  44. package/dist/get-string-truncated-width.mjs +1 -418
  45. package/dist/get-string-width.cjs +1 -11
  46. package/dist/get-string-width.mjs +1 -7
  47. package/dist/index.cjs +1 -66
  48. package/dist/index.d.cts +12 -3
  49. package/dist/index.d.mts +12 -3
  50. package/dist/index.d.ts +12 -3
  51. package/dist/index.mjs +1 -29
  52. package/dist/outdent.cjs +1 -125
  53. package/dist/outdent.mjs +1 -121
  54. package/dist/packem_shared/LRUCache-Bjo6gsbC.mjs +1 -0
  55. package/dist/packem_shared/LRUCache-TYqfUYE5.cjs +1 -0
  56. package/dist/packem_shared/WrapMode-BL2dnSc8.cjs +8 -0
  57. package/dist/packem_shared/WrapMode-DxH5g69E.mjs +8 -0
  58. package/dist/packem_shared/alignText-BCKbnqhC.mjs +2 -0
  59. package/dist/packem_shared/alignText-CLZJuPP6.cjs +2 -0
  60. package/dist/packem_shared/constants-Cd17VNEv.mjs +1 -0
  61. package/dist/packem_shared/constants-D3K8u3G8.cjs +1 -0
  62. package/dist/packem_shared/generate-cache-key-BZf0GiMs.cjs +1 -0
  63. package/dist/packem_shared/generate-cache-key-DPByFaMH.mjs +1 -0
  64. package/dist/packem_shared/joinSegments-CDHNMXsF.cjs +1 -0
  65. package/dist/packem_shared/joinSegments-H7QJ7rwJ.mjs +1 -0
  66. package/dist/packem_shared/normalize-german-eszett-4k1qRtEP.mjs +1 -0
  67. package/dist/packem_shared/normalize-german-eszett-Bop4wOp9.cjs +1 -0
  68. package/dist/packem_shared/replaceString-Ce8TI_-L.cjs +1 -0
  69. package/dist/packem_shared/replaceString-D7R-5VFX.mjs +1 -0
  70. package/dist/packem_shared/slugify-B1vlQQO1.mjs +1 -0
  71. package/dist/packem_shared/slugify-CH3GI7E5.cjs +1 -0
  72. package/dist/packem_shared/transliterate-BXaP38Sh.mjs +5 -0
  73. package/dist/packem_shared/transliterate-CToQ-aeM.cjs +5 -0
  74. package/dist/slice.cjs +1 -419
  75. package/dist/slice.mjs +1 -415
  76. package/dist/test/utils.cjs +13 -74
  77. package/dist/test/utils.mjs +14 -69
  78. package/dist/test/vitest.cjs +1 -11
  79. package/dist/test/vitest.mjs +1 -7
  80. package/dist/truncate.cjs +1 -101
  81. package/dist/truncate.mjs +1 -97
  82. package/dist/utils.cjs +1 -65
  83. package/dist/utils.mjs +1 -56
  84. package/package.json +8 -1
  85. package/dist/packem_shared/LRUCache-Crb-m7cw.cjs +0 -53
  86. package/dist/packem_shared/LRUCache-udNErhWw.mjs +0 -51
  87. package/dist/packem_shared/WrapMode-BCVbMqYK.mjs +0 -545
  88. package/dist/packem_shared/WrapMode-DebG_Nll.cjs +0 -550
  89. package/dist/packem_shared/constants-6-GJ6zA-.cjs +0 -150
  90. package/dist/packem_shared/constants-CKdlkHVU.mjs +0 -99
  91. package/dist/packem_shared/generate-cache-key-D8f1auDB.cjs +0 -10
  92. package/dist/packem_shared/generate-cache-key-YSju5pj2.mjs +0 -8
  93. package/dist/packem_shared/joinSegments-BfSDBmPF.mjs +0 -46
  94. package/dist/packem_shared/joinSegments-HYXurfoq.cjs +0 -48
  95. package/dist/packem_shared/normalize-german-eszett-DJK0S2qj.cjs +0 -11
  96. package/dist/packem_shared/normalize-german-eszett-fpJ4lZL6.mjs +0 -9
  97. package/dist/packem_shared/replaceString-C7Dp5vAg.mjs +0 -200
  98. package/dist/packem_shared/replaceString-iYo1cDfZ.cjs +0 -202
  99. package/dist/packem_shared/slugify-SKjCL8DF.cjs +0 -50
  100. package/dist/packem_shared/slugify-pbxTlzeQ.mjs +0 -48
  101. package/dist/packem_shared/transliterate-4P32b49d.mjs +0 -47780
  102. package/dist/packem_shared/transliterate-CtOTNpLs.cjs +0 -47782
package/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## @visulima/string [1.3.0](https://github.com/visulima/visulima/compare/@visulima/string@1.2.3...@visulima/string@1.3.0) (2025-05-31)
2
+
3
+ ### Features
4
+
5
+ * **string:** add alignText function for text alignment and create unit tests ([688d1c4](https://github.com/visulima/visulima/commit/688d1c4056f9ef93484f9780c02b83b4507241f7))
6
+
7
+ ### Miscellaneous Chores
8
+
9
+ * **string:** update package.json to add new alignment keywords and modify build scripts ([03365cf](https://github.com/visulima/visulima/commit/03365cf3b1b533e9e0ba497b8e278b8065f7bca7))
10
+ * **string:** updated readme ([54dd1ff](https://github.com/visulima/visulima/commit/54dd1ff16a13bf1ed100b46b7c8628cbca152d96))
11
+
1
12
  ## @visulima/string [1.2.3](https://github.com/visulima/visulima/compare/@visulima/string@1.2.2...@visulima/string@1.2.3) (2025-05-30)
2
13
 
3
14
  ### Bug Fixes
package/README.md CHANGED
@@ -1032,6 +1032,52 @@ slugify("Keep C++", { replaceBefore: { "C++": "cpp" } }); // 'keep-cpp'
1032
1032
  slugify("Keep !@#$", { allowedChars: "a-z!@$" }); // 'keep!@$'
1033
1033
  ```
1034
1034
 
1035
+ ### Text Alignment
1036
+
1037
+ The `alignText` function aligns text (including multi-line strings and strings with ANSI escape codes) to the left, center, or right. It can handle both single strings (which can be split into lines based on the `split` option) and arrays of strings.
1038
+
1039
+ ```typescript
1040
+ import { alignText } from "@visulima/string";
1041
+ // For type information, you might also import:
1042
+ // import type { AlignTextOptions, StringWidthOptions } from "@visulima/string";
1043
+
1044
+ // Example 1: Aligning a single multi-line string to the right
1045
+ const text1 = "First line\nSecond, much longer line";
1046
+ const alignedText1 = alignText(text1, { align: "right" });
1047
+ // alignedText1 (string output, exact padding depends on calculated widths):
1048
+ // " First line\nSecond, much longer line"
1049
+
1050
+ // Example 2: Aligning an array of strings to the center
1051
+ const textArray = ["Short", "Medium length", "A very very long line indeed"];
1052
+ const alignedArray = alignText(textArray, { align: "center" });
1053
+ // alignedArray (array output, exact padding depends on calculated widths):
1054
+ // [
1055
+ // " Short ",
1056
+ // " Medium length ",
1057
+ // "A very very long line indeed"
1058
+ // ]
1059
+
1060
+ // Example 3: Custom padding, split, and stringWidthOptions for emojis
1061
+ const emojiText = "Line1😊*WiderLine😊😊";
1062
+ const alignedEmojiText = alignText(emojiText, {
1063
+ align: "center",
1064
+ split: "*",
1065
+ pad: "-",
1066
+ stringWidthOptions: { emojiWidth: 2 } // Crucial for correct width calculation with emojis
1067
+ });
1068
+ // alignedEmojiText (string output, exact padding depends on calculated widths):
1069
+ // "--Line1😊---\nWiderLine😊😊"
1070
+ ```
1071
+
1072
+ #### Alignment Options
1073
+
1074
+ The `alignText` function accepts an `options` object of type `AlignTextOptions` with the following properties:
1075
+
1076
+ - `align?: "center" | "left" | "right"`: Specifies the alignment direction. Defaults to `"center"`. Note: `left` alignment primarily ensures line splitting if `text` is a single string; it doesn't typically add padding on the left unless the string was not pre-split.
1077
+ - `pad?: string`: The character or string to use for padding. Defaults to `" "`.
1078
+ - `split?: string`: The character or string used to split the input `text` into multiple lines if it's provided as a single string. Defaults to `"\n"`.
1079
+ - `stringWidthOptions?: StringWidthOptions`: Options passed to an internal string width calculation function (similar to `getStringWidth`) for determining the visual width of each line. This is important for accurately handling ANSI escape codes, CJK characters, emojis, etc. Refer to the `getStringWidth` documentation for details on `StringWidthOptions`.
1080
+
1035
1081
  ## Related
1036
1082
 
1037
1083
  - [change-case](https://github.com/blakeembrey/change-case) - Simple string case utilities
@@ -1,59 +1 @@
1
- 'use strict';
2
-
3
- const constants = require('../packem_shared/constants-6-GJ6zA-.cjs');
4
- const LRUCache = require('../packem_shared/LRUCache-Crb-m7cw.cjs');
5
- const case_lowerFirst = require('./lower-first.cjs');
6
- const case_splitByCase = require('./split-by-case.cjs');
7
- const case_upperFirst = require('./upper-first.cjs');
8
- const generateCacheKey = require('../packem_shared/generate-cache-key-D8f1auDB.cjs');
9
- const joinSegments = require('../packem_shared/joinSegments-HYXurfoq.cjs');
10
- const normalizeGermanEszett = require('../packem_shared/normalize-german-eszett-DJK0S2qj.cjs');
11
-
12
- var __defProp = Object.defineProperty;
13
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
14
- const defaultCacheStore = new LRUCache(1e3);
15
- const camelCase = /* @__PURE__ */ __name((value, options) => {
16
- if (typeof value !== "string" || !value) {
17
- return "";
18
- }
19
- const shouldCache = options?.cache ?? false;
20
- const cacheStore = options?.cacheStore ?? defaultCacheStore;
21
- let cacheKey;
22
- if (shouldCache) {
23
- cacheKey = generateCacheKey.generateCacheKey(value, options);
24
- }
25
- if (shouldCache && cacheKey && cacheStore.has(cacheKey)) {
26
- return cacheStore.get(cacheKey);
27
- }
28
- let firstWord = true;
29
- const result = joinSegments(
30
- case_splitByCase.splitByCase(value, {
31
- handleAnsi: options?.handleAnsi,
32
- handleEmoji: options?.handleEmoji,
33
- knownAcronyms: options?.knownAcronyms,
34
- locale: options?.locale,
35
- normalize: options?.normalize,
36
- separators: void 0,
37
- stripAnsi: options?.stripAnsi,
38
- stripEmoji: options?.stripEmoji
39
- }).map((word) => {
40
- if (options?.handleAnsi && constants.RE_FAST_ANSI.test(word)) {
41
- return word;
42
- }
43
- word = options?.locale?.startsWith("de") ? normalizeGermanEszett.normalizeGermanEszett(word) : word;
44
- word = options?.locale ? word.toLocaleLowerCase(options.locale) : word.toLowerCase();
45
- if (firstWord) {
46
- firstWord = false;
47
- return case_lowerFirst(word, options);
48
- }
49
- return case_upperFirst(word, options);
50
- }),
51
- ""
52
- );
53
- if (shouldCache && cacheKey) {
54
- cacheStore.set(cacheKey, result);
55
- }
56
- return result;
57
- }, "camelCase");
58
-
59
- module.exports = camelCase;
1
+ "use strict";var c=Object.defineProperty;var l=(a,e)=>c(a,"name",{value:e,configurable:!0});const u=require("../packem_shared/constants-D3K8u3G8.cjs"),m=require("../packem_shared/LRUCache-TYqfUYE5.cjs"),p=require("./lower-first.cjs"),h=require("./split-by-case.cjs"),d=require("./upper-first.cjs"),q=require("../packem_shared/generate-cache-key-BZf0GiMs.cjs"),y=require("../packem_shared/joinSegments-CDHNMXsF.cjs"),f=require("../packem_shared/normalize-german-eszett-Bop4wOp9.cjs");var A=Object.defineProperty,C=l((a,e)=>A(a,"name",{value:e,configurable:!0}),"l");const j=new m(1e3),w=C((a,e)=>{if(typeof a!="string"||!a)return"";const t=e?.cache??!1,i=e?.cacheStore??j;let r;if(t&&(r=q.a(a,e)),t&&r&&i.has(r))return i.get(r);let n=!0;const o=y(h.splitByCase(a,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(s=>e?.handleAnsi&&u.R.test(s)?s:(s=e?.locale?.startsWith("de")?f.l(s):s,s=e?.locale?s.toLocaleLowerCase(e.locale):s.toLowerCase(),n?(n=!1,p(s,e)):d(s,e))),"");return t&&r&&i.set(r,o),o},"camelCase");module.exports=w;
@@ -1,57 +1 @@
1
- import { R as RE_FAST_ANSI } from '../packem_shared/constants-CKdlkHVU.mjs';
2
- import LRUCache from '../packem_shared/LRUCache-udNErhWw.mjs';
3
- import lowerFirst from './lower-first.mjs';
4
- import { splitByCase } from './split-by-case.mjs';
5
- import upperFirst from './upper-first.mjs';
6
- import { g as generateCacheKey } from '../packem_shared/generate-cache-key-YSju5pj2.mjs';
7
- import joinSegments from '../packem_shared/joinSegments-BfSDBmPF.mjs';
8
- import { n as normalizeGermanEszett } from '../packem_shared/normalize-german-eszett-fpJ4lZL6.mjs';
9
-
10
- var __defProp = Object.defineProperty;
11
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
12
- const defaultCacheStore = new LRUCache(1e3);
13
- const camelCase = /* @__PURE__ */ __name((value, options) => {
14
- if (typeof value !== "string" || !value) {
15
- return "";
16
- }
17
- const shouldCache = options?.cache ?? false;
18
- const cacheStore = options?.cacheStore ?? defaultCacheStore;
19
- let cacheKey;
20
- if (shouldCache) {
21
- cacheKey = generateCacheKey(value, options);
22
- }
23
- if (shouldCache && cacheKey && cacheStore.has(cacheKey)) {
24
- return cacheStore.get(cacheKey);
25
- }
26
- let firstWord = true;
27
- const result = joinSegments(
28
- splitByCase(value, {
29
- handleAnsi: options?.handleAnsi,
30
- handleEmoji: options?.handleEmoji,
31
- knownAcronyms: options?.knownAcronyms,
32
- locale: options?.locale,
33
- normalize: options?.normalize,
34
- separators: void 0,
35
- stripAnsi: options?.stripAnsi,
36
- stripEmoji: options?.stripEmoji
37
- }).map((word) => {
38
- if (options?.handleAnsi && RE_FAST_ANSI.test(word)) {
39
- return word;
40
- }
41
- word = options?.locale?.startsWith("de") ? normalizeGermanEszett(word) : word;
42
- word = options?.locale ? word.toLocaleLowerCase(options.locale) : word.toLowerCase();
43
- if (firstWord) {
44
- firstWord = false;
45
- return lowerFirst(word, options);
46
- }
47
- return upperFirst(word, options);
48
- }),
49
- ""
50
- );
51
- if (shouldCache && cacheKey) {
52
- cacheStore.set(cacheKey, result);
53
- }
54
- return result;
55
- }, "camelCase");
56
-
57
- export { camelCase as default };
1
+ var m=Object.defineProperty;var n=(t,o)=>m(t,"name",{value:o,configurable:!0});import{R as c}from"../packem_shared/constants-Cd17VNEv.mjs";import p from"../packem_shared/LRUCache-Bjo6gsbC.mjs";import f from"./lower-first.mjs";import{splitByCase as d}from"./split-by-case.mjs";import h from"./upper-first.mjs";import{a as A}from"../packem_shared/generate-cache-key-DPByFaMH.mjs";import u from"../packem_shared/joinSegments-H7QJ7rwJ.mjs";import{l as y}from"../packem_shared/normalize-german-eszett-4k1qRtEP.mjs";var j=Object.defineProperty,w=n((t,o)=>j(t,"name",{value:o,configurable:!0}),"l");const E=new p(1e3),R=w((t,o)=>{if(typeof t!="string"||!t)return"";const e=o?.cache??!1,s=o?.cacheStore??E;let r;if(e&&(r=A(t,o)),e&&r&&s.has(r))return s.get(r);let i=!0;const l=u(d(t,{handleAnsi:o?.handleAnsi,handleEmoji:o?.handleEmoji,knownAcronyms:o?.knownAcronyms,locale:o?.locale,normalize:o?.normalize,separators:void 0,stripAnsi:o?.stripAnsi,stripEmoji:o?.stripEmoji}).map(a=>o?.handleAnsi&&c.test(a)?a:(a=o?.locale?.startsWith("de")?y(a):a,a=o?.locale?a.toLocaleLowerCase(o.locale):a.toLowerCase(),i?(i=!1,f(a,o)):h(a,o))),"");return e&&r&&s.set(r,l),l},"camelCase");export{R as default};
@@ -1,51 +1 @@
1
- 'use strict';
2
-
3
- const constants = require('../packem_shared/constants-6-GJ6zA-.cjs');
4
- const LRUCache = require('../packem_shared/LRUCache-Crb-m7cw.cjs');
5
- const case_splitByCase = require('./split-by-case.cjs');
6
- const case_upperFirst = require('./upper-first.cjs');
7
- const generateCacheKey = require('../packem_shared/generate-cache-key-D8f1auDB.cjs');
8
- const joinSegments = require('../packem_shared/joinSegments-HYXurfoq.cjs');
9
- const normalizeGermanEszett = require('../packem_shared/normalize-german-eszett-DJK0S2qj.cjs');
10
-
11
- var __defProp = Object.defineProperty;
12
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
13
- const defaultCacheStore = new LRUCache(1e3);
14
- const capitalCase = /* @__PURE__ */ __name((value, options) => {
15
- if (typeof value !== "string") {
16
- return "";
17
- }
18
- const shouldCache = options?.cache ?? false;
19
- const cacheStore = options?.cacheStore ?? defaultCacheStore;
20
- let cacheKey;
21
- if (shouldCache) {
22
- cacheKey = generateCacheKey.generateCacheKey(value, options);
23
- }
24
- if (shouldCache && cacheKey && cacheStore.has(cacheKey)) {
25
- return cacheStore.get(cacheKey);
26
- }
27
- const words = case_splitByCase.splitByCase(value, {
28
- handleAnsi: options?.handleAnsi,
29
- handleEmoji: options?.handleEmoji,
30
- knownAcronyms: options?.knownAcronyms,
31
- locale: options?.locale,
32
- normalize: options?.normalize,
33
- separators: void 0,
34
- stripAnsi: options?.stripAnsi,
35
- stripEmoji: options?.stripEmoji
36
- });
37
- const processed = words.map((word) => {
38
- if (constants.RE_FAST_ANSI.test(word)) {
39
- return word;
40
- }
41
- const split = options?.locale?.startsWith("de") ? normalizeGermanEszett.normalizeGermanEszett(word) : word;
42
- return case_upperFirst(options?.locale ? split.toLocaleLowerCase(options.locale) : split.toLocaleLowerCase(), options);
43
- });
44
- const result = joinSegments(processed, " ");
45
- if (shouldCache && cacheKey) {
46
- cacheStore.set(cacheKey, result);
47
- }
48
- return result;
49
- }, "capitalCase");
50
-
51
- module.exports = capitalCase;
1
+ "use strict";var u=Object.defineProperty;var c=(r,e)=>u(r,"name",{value:e,configurable:!0});const m=require("../packem_shared/constants-D3K8u3G8.cjs"),p=require("../packem_shared/LRUCache-TYqfUYE5.cjs"),h=require("./split-by-case.cjs"),y=require("./upper-first.cjs"),d=require("../packem_shared/generate-cache-key-BZf0GiMs.cjs"),f=require("../packem_shared/joinSegments-CDHNMXsF.cjs"),q=require("../packem_shared/normalize-german-eszett-Bop4wOp9.cjs");var A=Object.defineProperty,C=c((r,e)=>A(r,"name",{value:e,configurable:!0}),"l");const j=new p(1e3),g=C((r,e)=>{if(typeof r!="string")return"";const t=e?.cache??!1,n=e?.cacheStore??j;let a;if(t&&(a=d.a(r,e)),t&&a&&n.has(a))return n.get(a);const l=h.splitByCase(r,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(s=>{if(m.R.test(s))return s;const o=e?.locale?.startsWith("de")?q.l(s):s;return y(e?.locale?o.toLocaleLowerCase(e.locale):o.toLocaleLowerCase(),e)}),i=f(l," ");return t&&a&&n.set(a,i),i},"capitalCase");module.exports=g;
@@ -1,49 +1 @@
1
- import { R as RE_FAST_ANSI } from '../packem_shared/constants-CKdlkHVU.mjs';
2
- import LRUCache from '../packem_shared/LRUCache-udNErhWw.mjs';
3
- import { splitByCase } from './split-by-case.mjs';
4
- import upperFirst from './upper-first.mjs';
5
- import { g as generateCacheKey } from '../packem_shared/generate-cache-key-YSju5pj2.mjs';
6
- import joinSegments from '../packem_shared/joinSegments-BfSDBmPF.mjs';
7
- import { n as normalizeGermanEszett } from '../packem_shared/normalize-german-eszett-fpJ4lZL6.mjs';
8
-
9
- var __defProp = Object.defineProperty;
10
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
11
- const defaultCacheStore = new LRUCache(1e3);
12
- const capitalCase = /* @__PURE__ */ __name((value, options) => {
13
- if (typeof value !== "string") {
14
- return "";
15
- }
16
- const shouldCache = options?.cache ?? false;
17
- const cacheStore = options?.cacheStore ?? defaultCacheStore;
18
- let cacheKey;
19
- if (shouldCache) {
20
- cacheKey = generateCacheKey(value, options);
21
- }
22
- if (shouldCache && cacheKey && cacheStore.has(cacheKey)) {
23
- return cacheStore.get(cacheKey);
24
- }
25
- const words = splitByCase(value, {
26
- handleAnsi: options?.handleAnsi,
27
- handleEmoji: options?.handleEmoji,
28
- knownAcronyms: options?.knownAcronyms,
29
- locale: options?.locale,
30
- normalize: options?.normalize,
31
- separators: void 0,
32
- stripAnsi: options?.stripAnsi,
33
- stripEmoji: options?.stripEmoji
34
- });
35
- const processed = words.map((word) => {
36
- if (RE_FAST_ANSI.test(word)) {
37
- return word;
38
- }
39
- const split = options?.locale?.startsWith("de") ? normalizeGermanEszett(word) : word;
40
- return upperFirst(options?.locale ? split.toLocaleLowerCase(options.locale) : split.toLocaleLowerCase(), options);
41
- });
42
- const result = joinSegments(processed, " ");
43
- if (shouldCache && cacheKey) {
44
- cacheStore.set(cacheKey, result);
45
- }
46
- return result;
47
- }, "capitalCase");
48
-
49
- export { capitalCase as default };
1
+ var c=Object.defineProperty;var l=(r,o)=>c(r,"name",{value:o,configurable:!0});import{R as p}from"../packem_shared/constants-Cd17VNEv.mjs";import f from"../packem_shared/LRUCache-Bjo6gsbC.mjs";import{splitByCase as u}from"./split-by-case.mjs";import A from"./upper-first.mjs";import{a as d}from"../packem_shared/generate-cache-key-DPByFaMH.mjs";import h from"../packem_shared/joinSegments-H7QJ7rwJ.mjs";import{l as y}from"../packem_shared/normalize-german-eszett-4k1qRtEP.mjs";var j=Object.defineProperty,w=l((r,o)=>j(r,"name",{value:o,configurable:!0}),"l");const E=new f(1e3),z=w((r,o)=>{if(typeof r!="string")return"";const e=o?.cache??!1,s=o?.cacheStore??E;let a;if(e&&(a=d(r,o)),e&&a&&s.has(a))return s.get(a);const m=u(r,{handleAnsi:o?.handleAnsi,handleEmoji:o?.handleEmoji,knownAcronyms:o?.knownAcronyms,locale:o?.locale,normalize:o?.normalize,separators:void 0,stripAnsi:o?.stripAnsi,stripEmoji:o?.stripEmoji}).map(t=>{if(p.test(t))return t;const n=o?.locale?.startsWith("de")?y(t):t;return A(o?.locale?n.toLocaleLowerCase(o.locale):n.toLocaleLowerCase(),o)}),i=h(m," ");return e&&a&&s.set(a,i),i},"capitalCase");export{z as default};
@@ -1,11 +1 @@
1
- 'use strict';
2
-
3
- const LRUCache = require('../packem_shared/LRUCache-Crb-m7cw.cjs');
4
- const case_kebabCase = require('./kebab-case.cjs');
5
-
6
- var __defProp = Object.defineProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- const defaultCacheStore = new LRUCache(1e3);
9
- const constantCase = /* @__PURE__ */ __name((value, options) => case_kebabCase.kebabCase(value, { cacheStore: defaultCacheStore, ...options, joiner: "_", toUpperCase: true }), "constantCase");
10
-
11
- module.exports = constantCase;
1
+ "use strict";var t=Object.defineProperty;var a=(e,r)=>t(e,"name",{value:r,configurable:!0});const s=require("../packem_shared/LRUCache-TYqfUYE5.cjs"),c=require("./kebab-case.cjs");var n=Object.defineProperty,o=a((e,r)=>n(e,"name",{value:r,configurable:!0}),"s");const u=new s(1e3),b=o((e,r)=>c.kebabCase(e,{cacheStore:u,...r,joiner:"_",toUpperCase:!0}),"constantCase");module.exports=b;
@@ -1,9 +1 @@
1
- import LRUCache from '../packem_shared/LRUCache-udNErhWw.mjs';
2
- import { kebabCase } from './kebab-case.mjs';
3
-
4
- var __defProp = Object.defineProperty;
5
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
- const defaultCacheStore = new LRUCache(1e3);
7
- const constantCase = /* @__PURE__ */ __name((value, options) => kebabCase(value, { cacheStore: defaultCacheStore, ...options, joiner: "_", toUpperCase: true }), "constantCase");
8
-
9
- export { constantCase as default };
1
+ var t=Object.defineProperty;var a=(e,r)=>t(e,"name",{value:r,configurable:!0});import o from"../packem_shared/LRUCache-Bjo6gsbC.mjs";import{kebabCase as n}from"./kebab-case.mjs";var s=Object.defineProperty,c=a((e,r)=>s(e,"name",{value:r,configurable:!0}),"s");const p=new o(1e3),u=c((e,r)=>n(e,{cacheStore:p,...r,joiner:"_",toUpperCase:!0}),"constantCase");export{u as default};
@@ -1,11 +1 @@
1
- 'use strict';
2
-
3
- const LRUCache = require('../packem_shared/LRUCache-Crb-m7cw.cjs');
4
- const case_kebabCase = require('./kebab-case.cjs');
5
-
6
- var __defProp = Object.defineProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- const defaultCacheStore = new LRUCache(1e3);
9
- const dotCase = /* @__PURE__ */ __name((value, options) => case_kebabCase.kebabCase(value, { cacheStore: defaultCacheStore, ...options, joiner: "." }), "dotCase");
10
-
11
- module.exports = dotCase;
1
+ "use strict";var s=Object.defineProperty;var a=(e,r)=>s(e,"name",{value:r,configurable:!0});const t=require("../packem_shared/LRUCache-TYqfUYE5.cjs"),c=require("./kebab-case.cjs");var o=Object.defineProperty,n=a((e,r)=>o(e,"name",{value:r,configurable:!0}),"o");const i=new t(1e3),b=n((e,r)=>c.kebabCase(e,{cacheStore:i,...r,joiner:"."}),"dotCase");module.exports=b;
@@ -1,9 +1 @@
1
- import LRUCache from '../packem_shared/LRUCache-udNErhWw.mjs';
2
- import { kebabCase } from './kebab-case.mjs';
3
-
4
- var __defProp = Object.defineProperty;
5
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
- const defaultCacheStore = new LRUCache(1e3);
7
- const dotCase = /* @__PURE__ */ __name((value, options) => kebabCase(value, { cacheStore: defaultCacheStore, ...options, joiner: "." }), "dotCase");
8
-
9
- export { dotCase as default };
1
+ var a=Object.defineProperty;var o=(e,r)=>a(e,"name",{value:r,configurable:!0});import t from"../packem_shared/LRUCache-Bjo6gsbC.mjs";import{kebabCase as n}from"./kebab-case.mjs";var i=Object.defineProperty,s=o((e,r)=>i(e,"name",{value:r,configurable:!0}),"o");const c=new t(1e3),p=s((e,r)=>n(e,{cacheStore:c,...r,joiner:"."}),"dotCase");export{p as default};
@@ -1,11 +1 @@
1
- 'use strict';
2
-
3
- const LRUCache = require('../packem_shared/LRUCache-Crb-m7cw.cjs');
4
- const case_kebabCase = require('./kebab-case.cjs');
5
-
6
- var __defProp = Object.defineProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- const defaultCacheStore = new LRUCache(1e3);
9
- const flatCase = /* @__PURE__ */ __name((value, options) => case_kebabCase.kebabCase(value, { cacheStore: defaultCacheStore, ...options, joiner: "" }), "flatCase");
10
-
11
- module.exports = flatCase;
1
+ "use strict";var s=Object.defineProperty;var r=(e,a)=>s(e,"name",{value:a,configurable:!0});const t=require("../packem_shared/LRUCache-TYqfUYE5.cjs"),c=require("./kebab-case.cjs");var n=Object.defineProperty,i=r((e,a)=>n(e,"name",{value:a,configurable:!0}),"a");const o=new t(1e3),b=i((e,a)=>c.kebabCase(e,{cacheStore:o,...a,joiner:""}),"flatCase");module.exports=b;
@@ -1,9 +1 @@
1
- import LRUCache from '../packem_shared/LRUCache-udNErhWw.mjs';
2
- import { kebabCase } from './kebab-case.mjs';
3
-
4
- var __defProp = Object.defineProperty;
5
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
- const defaultCacheStore = new LRUCache(1e3);
7
- const flatCase = /* @__PURE__ */ __name((value, options) => kebabCase(value, { cacheStore: defaultCacheStore, ...options, joiner: "" }), "flatCase");
8
-
9
- export { flatCase as default };
1
+ var o=Object.defineProperty;var r=(e,a)=>o(e,"name",{value:a,configurable:!0});import t from"../packem_shared/LRUCache-Bjo6gsbC.mjs";import{kebabCase as n}from"./kebab-case.mjs";var f=Object.defineProperty,i=r((e,a)=>f(e,"name",{value:a,configurable:!0}),"a");const s=new t(1e3),l=i((e,a)=>n(e,{cacheStore:s,...a,joiner:""}),"flatCase");export{l as default};
@@ -1,61 +1 @@
1
- 'use strict';
2
-
3
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
-
5
- const node_util = require('node:util');
6
- const constants = require('../packem_shared/constants-6-GJ6zA-.cjs');
7
- const LRUCache = require('../packem_shared/LRUCache-Crb-m7cw.cjs');
8
- const generateCacheKey = require('../packem_shared/generate-cache-key-D8f1auDB.cjs');
9
-
10
- var __defProp = Object.defineProperty;
11
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
12
- const defaultCacheStore = new LRUCache(1e3);
13
- const flipCase = /* @__PURE__ */ __name((value, options) => {
14
- if (typeof value !== "string" || value.length === 0) {
15
- return "";
16
- }
17
- const shouldCache = options?.cache ?? false;
18
- const cacheStore = options?.cacheStore ?? defaultCacheStore;
19
- let cacheKey;
20
- if (shouldCache) {
21
- cacheKey = generateCacheKey.generateCacheKey(value, options);
22
- }
23
- if (shouldCache && cacheKey && cacheStore.has(cacheKey)) {
24
- return cacheStore.get(cacheKey);
25
- }
26
- let processedValue = value;
27
- if (options?.stripEmoji) {
28
- processedValue = constants.stripEmoji(processedValue);
29
- }
30
- if (options?.stripAnsi) {
31
- processedValue = node_util.stripVTControlCharacters(processedValue);
32
- }
33
- let result = "";
34
- let index = 0;
35
- while (index < processedValue.length) {
36
- if (options?.handleAnsi && processedValue[index] === "\x1B") {
37
- let ansiSequence = processedValue[index];
38
- index++;
39
- while (index < processedValue.length && processedValue[index] !== "m") {
40
- ansiSequence += processedValue[index];
41
- index++;
42
- }
43
- if (index < processedValue.length) {
44
- ansiSequence += processedValue[index];
45
- result += ansiSequence;
46
- }
47
- index++;
48
- continue;
49
- }
50
- const char = processedValue[index];
51
- const lowerChar = options?.locale ? char.toLocaleLowerCase(options.locale) : char.toLowerCase();
52
- result += char === lowerChar ? options?.locale ? char.toLocaleUpperCase(options.locale) : char.toUpperCase() : lowerChar;
53
- index++;
54
- }
55
- if (shouldCache && cacheKey) {
56
- cacheStore.set(cacheKey, result);
57
- }
58
- return result;
59
- }, "flipCase");
60
-
61
- exports.flipCase = flipCase;
1
+ "use strict";var p=Object.defineProperty;var f=(a,e)=>p(a,"name",{value:e,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("node:util"),C=require("../packem_shared/constants-D3K8u3G8.cjs"),g=require("../packem_shared/LRUCache-TYqfUYE5.cjs"),d=require("../packem_shared/generate-cache-key-BZf0GiMs.cjs");var v=Object.defineProperty,L=f((a,e)=>v(a,"name",{value:e,configurable:!0}),"p");const b=new g(1e3),m=L((a,e)=>{if(typeof a!="string"||a.length===0)return"";const i=e?.cache??!1,s=e?.cacheStore??b;let l;if(i&&(l=d.a(a,e)),i&&l&&s.has(l))return s.get(l);let t=a;e?.stripEmoji&&(t=C.s(t)),e?.stripAnsi&&(t=h.stripVTControlCharacters(t));let n="",o=0;for(;o<t.length;){if(e?.handleAnsi&&t[o]==="\x1B"){let c=t[o];for(o++;o<t.length&&t[o]!=="m";)c+=t[o],o++;o<t.length&&(c+=t[o],n+=c),o++;continue}const r=t[o],u=e?.locale?r.toLocaleLowerCase(e.locale):r.toLowerCase();n+=r===u?e?.locale?r.toLocaleUpperCase(e.locale):r.toUpperCase():u,o++}return i&&l&&s.set(l,n),n},"flipCase");exports.flipCase=m;
@@ -1,57 +1 @@
1
- import { stripVTControlCharacters } from 'node:util';
2
- import { s as stripEmoji } from '../packem_shared/constants-CKdlkHVU.mjs';
3
- import LRUCache from '../packem_shared/LRUCache-udNErhWw.mjs';
4
- import { g as generateCacheKey } from '../packem_shared/generate-cache-key-YSju5pj2.mjs';
5
-
6
- var __defProp = Object.defineProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- const defaultCacheStore = new LRUCache(1e3);
9
- const flipCase = /* @__PURE__ */ __name((value, options) => {
10
- if (typeof value !== "string" || value.length === 0) {
11
- return "";
12
- }
13
- const shouldCache = options?.cache ?? false;
14
- const cacheStore = options?.cacheStore ?? defaultCacheStore;
15
- let cacheKey;
16
- if (shouldCache) {
17
- cacheKey = generateCacheKey(value, options);
18
- }
19
- if (shouldCache && cacheKey && cacheStore.has(cacheKey)) {
20
- return cacheStore.get(cacheKey);
21
- }
22
- let processedValue = value;
23
- if (options?.stripEmoji) {
24
- processedValue = stripEmoji(processedValue);
25
- }
26
- if (options?.stripAnsi) {
27
- processedValue = stripVTControlCharacters(processedValue);
28
- }
29
- let result = "";
30
- let index = 0;
31
- while (index < processedValue.length) {
32
- if (options?.handleAnsi && processedValue[index] === "\x1B") {
33
- let ansiSequence = processedValue[index];
34
- index++;
35
- while (index < processedValue.length && processedValue[index] !== "m") {
36
- ansiSequence += processedValue[index];
37
- index++;
38
- }
39
- if (index < processedValue.length) {
40
- ansiSequence += processedValue[index];
41
- result += ansiSequence;
42
- }
43
- index++;
44
- continue;
45
- }
46
- const char = processedValue[index];
47
- const lowerChar = options?.locale ? char.toLocaleLowerCase(options.locale) : char.toLowerCase();
48
- result += char === lowerChar ? options?.locale ? char.toLocaleUpperCase(options.locale) : char.toUpperCase() : lowerChar;
49
- index++;
50
- }
51
- if (shouldCache && cacheKey) {
52
- cacheStore.set(cacheKey, result);
53
- }
54
- return result;
55
- }, "flipCase");
56
-
57
- export { flipCase };
1
+ var m=Object.defineProperty;var f=(a,e)=>m(a,"name",{value:e,configurable:!0});import{stripVTControlCharacters as h}from"node:util";import{s as u}from"../packem_shared/constants-Cd17VNEv.mjs";import C from"../packem_shared/LRUCache-Bjo6gsbC.mjs";import{a as g}from"../packem_shared/generate-cache-key-DPByFaMH.mjs";var L=Object.defineProperty,j=f((a,e)=>L(a,"name",{value:e,configurable:!0}),"p");const v=new C(1e3),A=j((a,e)=>{if(typeof a!="string"||a.length===0)return"";const i=e?.cache??!1,s=e?.cacheStore??v;let r;if(i&&(r=g(a,e)),i&&r&&s.has(r))return s.get(r);let t=a;e?.stripEmoji&&(t=u(t)),e?.stripAnsi&&(t=h(t));let n="",o=0;for(;o<t.length;){if(e?.handleAnsi&&t[o]==="\x1B"){let c=t[o];for(o++;o<t.length&&t[o]!=="m";)c+=t[o],o++;o<t.length&&(c+=t[o],n+=c),o++;continue}const l=t[o],p=e?.locale?l.toLocaleLowerCase(e.locale):l.toLowerCase();n+=l===p?e?.locale?l.toLocaleUpperCase(e.locale):l.toUpperCase():p,o++}return i&&r&&s.set(r,n),n},"flipCase");export{A as flipCase};
@@ -1,69 +1 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- const IS_PASCAL_CASE = /^([A-Z][a-z]*)+$/;
6
- const CONTAINS_LETTER_CASE_INSENSITIVE = /[a-z]/i;
7
- const IS_UPPER_SNAKE_CASE = /^[A-Z0-9_]+$/;
8
- const IS_LOWER_SNAKE_CASE = /^[a-z0-9_]+$/;
9
- const IS_KEBAB_CASE = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
10
- const IS_LOWERCASE_WITH_SPACE = /^[a-z ]+$/;
11
- const IS_UPPERCASE = /^[A-Z][A-Z0-9]*$/;
12
- const WHITESPACE_REGEX = /\s+/;
13
- const IS_NUMERIC = /^\d+$/;
14
- const IS_CAMEL_CASE_LIKE = /^[a-z][a-z0-9]*(?:[A-Z][a-z0-9]*)+$/;
15
- const CONTAINS_PUNCTUATION_MID_WORD = /[.!?;:,](?!\s|$)/;
16
- const identifyCase = /* @__PURE__ */ __name((value) => {
17
- if (typeof value !== "string") {
18
- throw new TypeError("Expected input to be a string");
19
- }
20
- if (!value) {
21
- return "unknown";
22
- }
23
- if (!CONTAINS_LETTER_CASE_INSENSITIVE.test(value)) {
24
- return "unknown";
25
- }
26
- if (value.includes("_")) {
27
- if (IS_UPPER_SNAKE_CASE.test(value)) {
28
- return "upper_snake";
29
- }
30
- if (IS_LOWER_SNAKE_CASE.test(value)) {
31
- return "snake";
32
- }
33
- return "mixed";
34
- }
35
- if (value.includes("-")) {
36
- if (IS_KEBAB_CASE.test(value)) {
37
- return "kebab";
38
- }
39
- return "mixed";
40
- }
41
- if (IS_LOWERCASE_WITH_SPACE.test(value)) {
42
- return "lower";
43
- }
44
- if (IS_UPPERCASE.test(value)) {
45
- return "upper";
46
- }
47
- const words = value.split(WHITESPACE_REGEX);
48
- if (words.length > 1 && words.every((word) => IS_PASCAL_CASE.test(word))) {
49
- return "title";
50
- }
51
- if (words.length > 1 && IS_NUMERIC.test(words[0]) && IS_PASCAL_CASE.test(words[1])) {
52
- return "title";
53
- }
54
- if (words.length > 1 && IS_PASCAL_CASE.test(words[0]) && /^[a-z]/.test(words[1])) {
55
- return "sentence";
56
- }
57
- if (IS_PASCAL_CASE.test(value)) {
58
- return "pascal";
59
- }
60
- if (IS_CAMEL_CASE_LIKE.test(value)) {
61
- return "camel";
62
- }
63
- if (CONTAINS_PUNCTUATION_MID_WORD.test(value)) {
64
- return "unknown";
65
- }
66
- return "mixed";
67
- }, "identifyCase");
68
-
69
- module.exports = identifyCase;
1
+ "use strict";var a=Object.defineProperty;var s=(e,t)=>a(e,"name",{value:t,configurable:!0});var i=Object.defineProperty,u=s((e,t)=>i(e,"name",{value:t,configurable:!0}),"s");const n=/^([A-Z][a-z]*)+$/,o=/[a-z]/i,p=/^[A-Z0-9_]+$/,c=/^[a-z0-9_]+$/,l=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,f=/^[a-z ]+$/,z=/^[A-Z][A-Z0-9]*$/,d=/\s+/,$=/^\d+$/,g=/^[a-z][a-z0-9]*(?:[A-Z][a-z0-9]*)+$/,A=/[.!?;:,](?!\s|$)/,b=u(e=>{if(typeof e!="string")throw new TypeError("Expected input to be a string");if(!e||!o.test(e))return"unknown";if(e.includes("_"))return p.test(e)?"upper_snake":c.test(e)?"snake":"mixed";if(e.includes("-"))return l.test(e)?"kebab":"mixed";if(f.test(e))return"lower";if(z.test(e))return"upper";const t=e.split(d);return t.length>1&&t.every(r=>n.test(r))||t.length>1&&$.test(t[0])&&n.test(t[1])?"title":t.length>1&&n.test(t[0])&&/^[a-z]/.test(t[1])?"sentence":n.test(e)?"pascal":g.test(e)?"camel":A.test(e)?"unknown":"mixed"},"identifyCase");module.exports=b;
@@ -1,67 +1 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- const IS_PASCAL_CASE = /^([A-Z][a-z]*)+$/;
4
- const CONTAINS_LETTER_CASE_INSENSITIVE = /[a-z]/i;
5
- const IS_UPPER_SNAKE_CASE = /^[A-Z0-9_]+$/;
6
- const IS_LOWER_SNAKE_CASE = /^[a-z0-9_]+$/;
7
- const IS_KEBAB_CASE = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
8
- const IS_LOWERCASE_WITH_SPACE = /^[a-z ]+$/;
9
- const IS_UPPERCASE = /^[A-Z][A-Z0-9]*$/;
10
- const WHITESPACE_REGEX = /\s+/;
11
- const IS_NUMERIC = /^\d+$/;
12
- const IS_CAMEL_CASE_LIKE = /^[a-z][a-z0-9]*(?:[A-Z][a-z0-9]*)+$/;
13
- const CONTAINS_PUNCTUATION_MID_WORD = /[.!?;:,](?!\s|$)/;
14
- const identifyCase = /* @__PURE__ */ __name((value) => {
15
- if (typeof value !== "string") {
16
- throw new TypeError("Expected input to be a string");
17
- }
18
- if (!value) {
19
- return "unknown";
20
- }
21
- if (!CONTAINS_LETTER_CASE_INSENSITIVE.test(value)) {
22
- return "unknown";
23
- }
24
- if (value.includes("_")) {
25
- if (IS_UPPER_SNAKE_CASE.test(value)) {
26
- return "upper_snake";
27
- }
28
- if (IS_LOWER_SNAKE_CASE.test(value)) {
29
- return "snake";
30
- }
31
- return "mixed";
32
- }
33
- if (value.includes("-")) {
34
- if (IS_KEBAB_CASE.test(value)) {
35
- return "kebab";
36
- }
37
- return "mixed";
38
- }
39
- if (IS_LOWERCASE_WITH_SPACE.test(value)) {
40
- return "lower";
41
- }
42
- if (IS_UPPERCASE.test(value)) {
43
- return "upper";
44
- }
45
- const words = value.split(WHITESPACE_REGEX);
46
- if (words.length > 1 && words.every((word) => IS_PASCAL_CASE.test(word))) {
47
- return "title";
48
- }
49
- if (words.length > 1 && IS_NUMERIC.test(words[0]) && IS_PASCAL_CASE.test(words[1])) {
50
- return "title";
51
- }
52
- if (words.length > 1 && IS_PASCAL_CASE.test(words[0]) && /^[a-z]/.test(words[1])) {
53
- return "sentence";
54
- }
55
- if (IS_PASCAL_CASE.test(value)) {
56
- return "pascal";
57
- }
58
- if (IS_CAMEL_CASE_LIKE.test(value)) {
59
- return "camel";
60
- }
61
- if (CONTAINS_PUNCTUATION_MID_WORD.test(value)) {
62
- return "unknown";
63
- }
64
- return "mixed";
65
- }, "identifyCase");
66
-
67
- export { identifyCase as default };
1
+ var a=Object.defineProperty;var s=(e,t)=>a(e,"name",{value:t,configurable:!0});var i=Object.defineProperty,u=s((e,t)=>i(e,"name",{value:t,configurable:!0}),"s");const n=/^([A-Z][a-z]*)+$/,l=/[a-z]/i,o=/^[A-Z0-9_]+$/,p=/^[a-z0-9_]+$/,f=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,c=/^[a-z ]+$/,z=/^[A-Z][A-Z0-9]*$/,d=/\s+/,$=/^\d+$/,g=/^[a-z][a-z0-9]*(?:[A-Z][a-z0-9]*)+$/,A=/[.!?;:,](?!\s|$)/,k=u(e=>{if(typeof e!="string")throw new TypeError("Expected input to be a string");if(!e||!l.test(e))return"unknown";if(e.includes("_"))return o.test(e)?"upper_snake":p.test(e)?"snake":"mixed";if(e.includes("-"))return f.test(e)?"kebab":"mixed";if(c.test(e))return"lower";if(z.test(e))return"upper";const t=e.split(d);return t.length>1&&t.every(r=>n.test(r))||t.length>1&&$.test(t[0])&&n.test(t[1])?"title":t.length>1&&n.test(t[0])&&/^[a-z]/.test(t[1])?"sentence":n.test(e)?"pascal":g.test(e)?"camel":A.test(e)?"unknown":"mixed"},"identifyCase");export{k as default};