@visulima/string 1.2.2 → 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 (196) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +46 -0
  4. package/dist/case/camel-case.cjs +1 -59
  5. package/dist/case/camel-case.d.cts +2 -2
  6. package/dist/case/camel-case.d.mts +2 -2
  7. package/dist/case/camel-case.d.ts +2 -2
  8. package/dist/case/camel-case.mjs +1 -57
  9. package/dist/case/capital-case.cjs +1 -51
  10. package/dist/case/capital-case.d.cts +2 -2
  11. package/dist/case/capital-case.d.mts +2 -2
  12. package/dist/case/capital-case.d.ts +2 -2
  13. package/dist/case/capital-case.mjs +1 -49
  14. package/dist/case/constant-case.cjs +1 -11
  15. package/dist/case/constant-case.d.cts +2 -2
  16. package/dist/case/constant-case.d.mts +2 -2
  17. package/dist/case/constant-case.d.ts +2 -2
  18. package/dist/case/constant-case.mjs +1 -9
  19. package/dist/case/dot-case.cjs +1 -11
  20. package/dist/case/dot-case.d.cts +2 -2
  21. package/dist/case/dot-case.d.mts +2 -2
  22. package/dist/case/dot-case.d.ts +2 -2
  23. package/dist/case/dot-case.mjs +1 -9
  24. package/dist/case/flat-case.cjs +1 -11
  25. package/dist/case/flat-case.d.cts +2 -2
  26. package/dist/case/flat-case.d.mts +2 -2
  27. package/dist/case/flat-case.d.ts +2 -2
  28. package/dist/case/flat-case.mjs +1 -9
  29. package/dist/case/flip-case.cjs +1 -61
  30. package/dist/case/flip-case.d.cts +4 -3
  31. package/dist/case/flip-case.d.mts +4 -3
  32. package/dist/case/flip-case.d.ts +4 -3
  33. package/dist/case/flip-case.mjs +1 -57
  34. package/dist/case/identify-case.cjs +1 -69
  35. package/dist/case/identify-case.d.cts +2 -2
  36. package/dist/case/identify-case.d.mts +2 -2
  37. package/dist/case/identify-case.d.ts +2 -2
  38. package/dist/case/identify-case.mjs +1 -67
  39. package/dist/case/index.cjs +1 -47
  40. package/dist/case/index.d.cts +2 -2
  41. package/dist/case/index.d.mts +2 -2
  42. package/dist/case/index.d.ts +2 -2
  43. package/dist/case/index.mjs +1 -20
  44. package/dist/case/kebab-case.cjs +1 -61
  45. package/dist/case/kebab-case.d.cts +4 -3
  46. package/dist/case/kebab-case.d.mts +4 -3
  47. package/dist/case/kebab-case.d.ts +4 -3
  48. package/dist/case/kebab-case.mjs +1 -57
  49. package/dist/case/lower-first.cjs +1 -13
  50. package/dist/case/lower-first.d.cts +2 -2
  51. package/dist/case/lower-first.d.mts +2 -2
  52. package/dist/case/lower-first.d.ts +2 -2
  53. package/dist/case/lower-first.mjs +1 -11
  54. package/dist/case/no-case.cjs +1 -11
  55. package/dist/case/no-case.d.cts +2 -2
  56. package/dist/case/no-case.d.mts +2 -2
  57. package/dist/case/no-case.d.ts +2 -2
  58. package/dist/case/no-case.mjs +1 -9
  59. package/dist/case/pascal-case.cjs +1 -52
  60. package/dist/case/pascal-case.d.cts +2 -2
  61. package/dist/case/pascal-case.d.mts +2 -2
  62. package/dist/case/pascal-case.d.ts +2 -2
  63. package/dist/case/pascal-case.mjs +1 -50
  64. package/dist/case/pascal-snake-case.cjs +1 -32
  65. package/dist/case/pascal-snake-case.d.cts +2 -2
  66. package/dist/case/pascal-snake-case.d.mts +2 -2
  67. package/dist/case/pascal-snake-case.d.ts +2 -2
  68. package/dist/case/pascal-snake-case.mjs +1 -30
  69. package/dist/case/path-case.cjs +1 -11
  70. package/dist/case/path-case.d.cts +2 -2
  71. package/dist/case/path-case.d.mts +2 -2
  72. package/dist/case/path-case.d.ts +2 -2
  73. package/dist/case/path-case.mjs +1 -9
  74. package/dist/case/sentence-case.cjs +1 -58
  75. package/dist/case/sentence-case.d.cts +2 -2
  76. package/dist/case/sentence-case.d.mts +2 -2
  77. package/dist/case/sentence-case.d.ts +2 -2
  78. package/dist/case/sentence-case.mjs +1 -56
  79. package/dist/case/snake-case.cjs +1 -11
  80. package/dist/case/snake-case.d.cts +2 -2
  81. package/dist/case/snake-case.d.mts +2 -2
  82. package/dist/case/snake-case.d.ts +2 -2
  83. package/dist/case/snake-case.mjs +1 -9
  84. package/dist/case/split-by-case.cjs +1 -641
  85. package/dist/case/split-by-case.d.cts +4 -3
  86. package/dist/case/split-by-case.d.mts +4 -3
  87. package/dist/case/split-by-case.d.ts +4 -3
  88. package/dist/case/split-by-case.mjs +1 -637
  89. package/dist/case/title-case.cjs +1 -47
  90. package/dist/case/title-case.d.cts +2 -2
  91. package/dist/case/title-case.d.mts +2 -2
  92. package/dist/case/title-case.d.ts +2 -2
  93. package/dist/case/title-case.mjs +1 -45
  94. package/dist/case/train-case.cjs +1 -44
  95. package/dist/case/train-case.d.cts +2 -2
  96. package/dist/case/train-case.d.mts +2 -2
  97. package/dist/case/train-case.d.ts +2 -2
  98. package/dist/case/train-case.mjs +1 -42
  99. package/dist/case/upper-first.cjs +1 -13
  100. package/dist/case/upper-first.d.cts +2 -2
  101. package/dist/case/upper-first.d.mts +2 -2
  102. package/dist/case/upper-first.d.ts +2 -2
  103. package/dist/case/upper-first.mjs +1 -11
  104. package/dist/get-string-truncated-width.cjs +1 -422
  105. package/dist/get-string-truncated-width.d.cts +2 -1
  106. package/dist/get-string-truncated-width.d.mts +2 -1
  107. package/dist/get-string-truncated-width.d.ts +2 -1
  108. package/dist/get-string-truncated-width.mjs +1 -418
  109. package/dist/get-string-width.cjs +1 -11
  110. package/dist/get-string-width.d.cts +2 -1
  111. package/dist/get-string-width.d.mts +2 -1
  112. package/dist/get-string-width.d.ts +2 -1
  113. package/dist/get-string-width.mjs +1 -7
  114. package/dist/index.cjs +1 -66
  115. package/dist/index.d.cts +15 -5
  116. package/dist/index.d.mts +15 -5
  117. package/dist/index.d.ts +15 -5
  118. package/dist/index.mjs +1 -29
  119. package/dist/native-string-types.d.cts +1 -1
  120. package/dist/native-string-types.d.mts +1 -1
  121. package/dist/native-string-types.d.ts +1 -1
  122. package/dist/outdent.cjs +1 -125
  123. package/dist/outdent.d.cts +2 -1
  124. package/dist/outdent.d.mts +2 -1
  125. package/dist/outdent.d.ts +2 -1
  126. package/dist/outdent.mjs +1 -121
  127. package/dist/packem_shared/LRUCache-Bjo6gsbC.mjs +1 -0
  128. package/dist/packem_shared/LRUCache-TYqfUYE5.cjs +1 -0
  129. package/dist/packem_shared/WrapMode-BL2dnSc8.cjs +8 -0
  130. package/dist/packem_shared/WrapMode-DxH5g69E.mjs +8 -0
  131. package/dist/packem_shared/alignText-BCKbnqhC.mjs +2 -0
  132. package/dist/packem_shared/alignText-CLZJuPP6.cjs +2 -0
  133. package/dist/packem_shared/constants-Cd17VNEv.mjs +1 -0
  134. package/dist/packem_shared/constants-D3K8u3G8.cjs +1 -0
  135. package/dist/packem_shared/generate-cache-key-BZf0GiMs.cjs +1 -0
  136. package/dist/packem_shared/generate-cache-key-DPByFaMH.mjs +1 -0
  137. package/dist/packem_shared/joinSegments-CDHNMXsF.cjs +1 -0
  138. package/dist/packem_shared/joinSegments-H7QJ7rwJ.mjs +1 -0
  139. package/dist/packem_shared/normalize-german-eszett-4k1qRtEP.mjs +1 -0
  140. package/dist/packem_shared/normalize-german-eszett-Bop4wOp9.cjs +1 -0
  141. package/dist/packem_shared/replaceString-Ce8TI_-L.cjs +1 -0
  142. package/dist/packem_shared/replaceString-D7R-5VFX.mjs +1 -0
  143. package/dist/packem_shared/slugify-B1vlQQO1.mjs +1 -0
  144. package/dist/packem_shared/slugify-CH3GI7E5.cjs +1 -0
  145. package/dist/packem_shared/transliterate-BXaP38Sh.mjs +5 -0
  146. package/dist/packem_shared/transliterate-CToQ-aeM.cjs +5 -0
  147. package/dist/packem_shared/{types-DmfKbIaI.d.ts → types-BSdIWVzn.d.cts} +2 -1
  148. package/dist/packem_shared/{types-DmfKbIaI.d.cts → types-BSdIWVzn.d.mts} +2 -1
  149. package/dist/packem_shared/{types-DmfKbIaI.d.mts → types-BSdIWVzn.d.ts} +2 -1
  150. package/dist/packem_shared/{types-DcGtApe2.d.ts → types-BfGNLD2K.d.ts} +1 -1
  151. package/dist/packem_shared/{types-C5Pk8B8Q.d.cts → types-DrtiqNkK.d.cts} +1 -1
  152. package/dist/packem_shared/{types-_jqW_ZOt.d.mts → types-mlwFVBiS.d.mts} +1 -1
  153. package/dist/slice.cjs +1 -419
  154. package/dist/slice.d.cts +2 -1
  155. package/dist/slice.d.mts +2 -1
  156. package/dist/slice.d.ts +2 -1
  157. package/dist/slice.mjs +1 -415
  158. package/dist/test/utils.cjs +13 -74
  159. package/dist/test/utils.d.cts +2 -1
  160. package/dist/test/utils.d.mts +2 -1
  161. package/dist/test/utils.d.ts +2 -1
  162. package/dist/test/utils.mjs +14 -69
  163. package/dist/test/vitest.cjs +1 -11
  164. package/dist/test/vitest.d.cts +2 -1
  165. package/dist/test/vitest.d.mts +2 -1
  166. package/dist/test/vitest.d.ts +2 -1
  167. package/dist/test/vitest.mjs +1 -7
  168. package/dist/truncate.cjs +1 -101
  169. package/dist/truncate.d.cts +2 -1
  170. package/dist/truncate.d.mts +2 -1
  171. package/dist/truncate.d.ts +2 -1
  172. package/dist/truncate.mjs +1 -97
  173. package/dist/utils.cjs +1 -65
  174. package/dist/utils.d.cts +1 -1
  175. package/dist/utils.d.mts +1 -1
  176. package/dist/utils.d.ts +1 -1
  177. package/dist/utils.mjs +1 -56
  178. package/package.json +9 -6
  179. package/dist/packem_shared/LRUCache-Crb-m7cw.cjs +0 -53
  180. package/dist/packem_shared/LRUCache-udNErhWw.mjs +0 -51
  181. package/dist/packem_shared/WrapMode-B-WBY1mj.mjs +0 -545
  182. package/dist/packem_shared/WrapMode-Dsqu9BaX.cjs +0 -550
  183. package/dist/packem_shared/constants-CKuHriHc.cjs +0 -151
  184. package/dist/packem_shared/constants-CsGLUb4U.mjs +0 -100
  185. package/dist/packem_shared/generate-cache-key-D8f1auDB.cjs +0 -10
  186. package/dist/packem_shared/generate-cache-key-YSju5pj2.mjs +0 -8
  187. package/dist/packem_shared/joinSegments-B_7bxy5J.cjs +0 -48
  188. package/dist/packem_shared/joinSegments-BovQ2h_P.mjs +0 -46
  189. package/dist/packem_shared/normalize-german-eszett-DJK0S2qj.cjs +0 -11
  190. package/dist/packem_shared/normalize-german-eszett-fpJ4lZL6.mjs +0 -9
  191. package/dist/packem_shared/replaceString-C7Dp5vAg.mjs +0 -200
  192. package/dist/packem_shared/replaceString-iYo1cDfZ.cjs +0 -202
  193. package/dist/packem_shared/slugify-DhE59J2A.mjs +0 -48
  194. package/dist/packem_shared/slugify-jh6PftAT.cjs +0 -50
  195. package/dist/packem_shared/transliterate-BEci5RC8.cjs +0 -47782
  196. package/dist/packem_shared/transliterate-DwSldp0o.mjs +0 -47780
@@ -1,8 +1,9 @@
1
- import { C as CaseOptions, d as FlipCase } from '../packem_shared/types-_jqW_ZOt.mjs';
2
- import '../packem_shared/types-DmfKbIaI.mjs';
1
+ import { C as CaseOptions, d as FlipCase } from '../packem_shared/types-mlwFVBiS.mjs';
2
+ import '../packem_shared/types-BSdIWVzn.mjs';
3
3
  import '../packem_shared/lru-cache-B_t27XwI.mjs';
4
4
 
5
5
  type FlipOptions = Omit<CaseOptions, "handleEmoji">;
6
6
  declare const flipCase: <T extends string = string>(value?: T, options?: FlipOptions) => FlipCase<T>;
7
7
 
8
- export { type FlipOptions, flipCase };
8
+ export { flipCase };
9
+ export type { FlipOptions };
@@ -1,8 +1,9 @@
1
- import { C as CaseOptions, d as FlipCase } from '../packem_shared/types-DcGtApe2.js';
2
- import '../packem_shared/types-DmfKbIaI.js';
1
+ import { C as CaseOptions, d as FlipCase } from '../packem_shared/types-BfGNLD2K.js';
2
+ import '../packem_shared/types-BSdIWVzn.js';
3
3
  import '../packem_shared/lru-cache-B_t27XwI.js';
4
4
 
5
5
  type FlipOptions = Omit<CaseOptions, "handleEmoji">;
6
6
  declare const flipCase: <T extends string = string>(value?: T, options?: FlipOptions) => FlipCase<T>;
7
7
 
8
- export { type FlipOptions, flipCase };
8
+ export { flipCase };
9
+ export type { FlipOptions };
@@ -1,57 +1 @@
1
- import { stripVTControlCharacters } from 'node:util';
2
- import { s as stripEmoji } from '../packem_shared/constants-CsGLUb4U.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,5 +1,5 @@
1
- import { I as IdentifyCase } from '../packem_shared/types-C5Pk8B8Q.cjs';
2
- import '../packem_shared/types-DmfKbIaI.cjs';
1
+ import { I as IdentifyCase } from '../packem_shared/types-DrtiqNkK.cjs';
2
+ import '../packem_shared/types-BSdIWVzn.cjs';
3
3
  import '../packem_shared/lru-cache-B_t27XwI.cjs';
4
4
 
5
5
  declare const identifyCase: <T extends string = string>(value?: T) => IdentifyCase<T>;
@@ -1,5 +1,5 @@
1
- import { I as IdentifyCase } from '../packem_shared/types-_jqW_ZOt.mjs';
2
- import '../packem_shared/types-DmfKbIaI.mjs';
1
+ import { I as IdentifyCase } from '../packem_shared/types-mlwFVBiS.mjs';
2
+ import '../packem_shared/types-BSdIWVzn.mjs';
3
3
  import '../packem_shared/lru-cache-B_t27XwI.mjs';
4
4
 
5
5
  declare const identifyCase: <T extends string = string>(value?: T) => IdentifyCase<T>;
@@ -1,5 +1,5 @@
1
- import { I as IdentifyCase } from '../packem_shared/types-DcGtApe2.js';
2
- import '../packem_shared/types-DmfKbIaI.js';
1
+ import { I as IdentifyCase } from '../packem_shared/types-BfGNLD2K.js';
2
+ import '../packem_shared/types-BSdIWVzn.js';
3
3
  import '../packem_shared/lru-cache-B_t27XwI.js';
4
4
 
5
5
  declare const identifyCase: <T extends string = string>(value?: T) => IdentifyCase<T>;
@@ -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};
@@ -1,47 +1 @@
1
- 'use strict';
2
-
3
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
-
5
- const case_camelCase = require('./camel-case.cjs');
6
- const case_capitalCase = require('./capital-case.cjs');
7
- const case_constantCase = require('./constant-case.cjs');
8
- const case_dotCase = require('./dot-case.cjs');
9
- const case_flatCase = require('./flat-case.cjs');
10
- const case_flipCase = require('./flip-case.cjs');
11
- const case_identifyCase = require('./identify-case.cjs');
12
- const case_kebabCase = require('./kebab-case.cjs');
13
- const case_lowerFirst = require('./lower-first.cjs');
14
- const case_noCase = require('./no-case.cjs');
15
- const case_pascalCase = require('./pascal-case.cjs');
16
- const case_pascalSnakeCase = require('./pascal-snake-case.cjs');
17
- const case_pathCase = require('./path-case.cjs');
18
- const case_sentenceCase = require('./sentence-case.cjs');
19
- const case_snakeCase = require('./snake-case.cjs');
20
- const case_splitByCase = require('./split-by-case.cjs');
21
- const case_titleCase = require('./title-case.cjs');
22
- const case_trainCase = require('./train-case.cjs');
23
- const case_upperFirst = require('./upper-first.cjs');
24
- const joinSegments = require('../packem_shared/joinSegments-B_7bxy5J.cjs');
25
-
26
-
27
-
28
- exports.camelCase = case_camelCase;
29
- exports.capitalCase = case_capitalCase;
30
- exports.constantCase = case_constantCase;
31
- exports.dotCase = case_dotCase;
32
- exports.flatCase = case_flatCase;
33
- exports.flipCase = case_flipCase.flipCase;
34
- exports.identifyCase = case_identifyCase;
35
- exports.kebabCase = case_kebabCase.kebabCase;
36
- exports.lowerFirst = case_lowerFirst;
37
- exports.noCase = case_noCase;
38
- exports.pascalCase = case_pascalCase;
39
- exports.pascalSnakeCase = case_pascalSnakeCase;
40
- exports.pathCase = case_pathCase;
41
- exports.sentenceCase = case_sentenceCase;
42
- exports.snakeCase = case_snakeCase;
43
- exports.splitByCase = case_splitByCase.splitByCase;
44
- exports.titleCase = case_titleCase;
45
- exports.trainCase = case_trainCase;
46
- exports.upperFirst = case_upperFirst;
47
- exports.joinSegments = joinSegments;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./camel-case.cjs"),a=require("./capital-case.cjs"),s=require("./constant-case.cjs"),r=require("./dot-case.cjs"),i=require("./flat-case.cjs"),t=require("./flip-case.cjs"),C=require("./identify-case.cjs"),c=require("./kebab-case.cjs"),u=require("./lower-first.cjs"),l=require("./no-case.cjs"),n=require("./pascal-case.cjs"),_=require("./pascal-snake-case.cjs"),q=require("./path-case.cjs"),p=require("./sentence-case.cjs"),o=require("./snake-case.cjs"),b=require("./split-by-case.cjs"),f=require("./title-case.cjs"),d=require("./train-case.cjs"),k=require("./upper-first.cjs"),y=require("../packem_shared/joinSegments-CDHNMXsF.cjs");exports.camelCase=e;exports.capitalCase=a;exports.constantCase=s;exports.dotCase=r;exports.flatCase=i;exports.flipCase=t.flipCase;exports.identifyCase=C;exports.kebabCase=c.kebabCase;exports.lowerFirst=u;exports.noCase=l;exports.pascalCase=n;exports.pascalSnakeCase=_;exports.pathCase=q;exports.sentenceCase=p;exports.snakeCase=o;exports.splitByCase=b.splitByCase;exports.titleCase=f;exports.trainCase=d;exports.upperFirst=k;exports.joinSegments=y;
@@ -1,4 +1,4 @@
1
- export { N as NodeLocale } from '../packem_shared/types-DmfKbIaI.cjs';
1
+ export { N as NodeLocale } from '../packem_shared/types-BSdIWVzn.cjs';
2
2
  export { default as camelCase } from './camel-case.cjs';
3
3
  export { default as capitalCase } from './capital-case.cjs';
4
4
  export { default as constantCase } from './constant-case.cjs';
@@ -17,7 +17,7 @@ export { default as snakeCase } from './snake-case.cjs';
17
17
  export { SplitOptions, splitByCase } from './split-by-case.cjs';
18
18
  export { default as titleCase } from './title-case.cjs';
19
19
  export { default as trainCase } from './train-case.cjs';
20
- export { a as CamelCase, b as CapitalCase, C as CaseOptions, c as ConstantCase, D as DotCase, F as FlatCase, d as FlipCase, I as IdentifyCase, K as KebabCase, L as LocaleOptions, e as LowerFirst, N as NoCase, P as PascalCase, f as PascalSnakeCase, g as PathCase, S as SentenceCase, h as SnakeCase, i as SplitByCase, T as TitleCase, j as TrainCase, U as UpperFirst } from '../packem_shared/types-C5Pk8B8Q.cjs';
20
+ export { a as CamelCase, b as CapitalCase, C as CaseOptions, c as ConstantCase, D as DotCase, F as FlatCase, d as FlipCase, I as IdentifyCase, K as KebabCase, L as LocaleOptions, e as LowerFirst, N as NoCase, P as PascalCase, f as PascalSnakeCase, g as PathCase, S as SentenceCase, h as SnakeCase, i as SplitByCase, T as TitleCase, j as TrainCase, U as UpperFirst } from '../packem_shared/types-DrtiqNkK.cjs';
21
21
  export { default as upperFirst } from './upper-first.cjs';
22
22
  import '../packem_shared/lru-cache-B_t27XwI.cjs';
23
23
 
@@ -1,4 +1,4 @@
1
- export { N as NodeLocale } from '../packem_shared/types-DmfKbIaI.mjs';
1
+ export { N as NodeLocale } from '../packem_shared/types-BSdIWVzn.mjs';
2
2
  export { default as camelCase } from './camel-case.mjs';
3
3
  export { default as capitalCase } from './capital-case.mjs';
4
4
  export { default as constantCase } from './constant-case.mjs';
@@ -17,7 +17,7 @@ export { default as snakeCase } from './snake-case.mjs';
17
17
  export { SplitOptions, splitByCase } from './split-by-case.mjs';
18
18
  export { default as titleCase } from './title-case.mjs';
19
19
  export { default as trainCase } from './train-case.mjs';
20
- export { a as CamelCase, b as CapitalCase, C as CaseOptions, c as ConstantCase, D as DotCase, F as FlatCase, d as FlipCase, I as IdentifyCase, K as KebabCase, L as LocaleOptions, e as LowerFirst, N as NoCase, P as PascalCase, f as PascalSnakeCase, g as PathCase, S as SentenceCase, h as SnakeCase, i as SplitByCase, T as TitleCase, j as TrainCase, U as UpperFirst } from '../packem_shared/types-_jqW_ZOt.mjs';
20
+ export { a as CamelCase, b as CapitalCase, C as CaseOptions, c as ConstantCase, D as DotCase, F as FlatCase, d as FlipCase, I as IdentifyCase, K as KebabCase, L as LocaleOptions, e as LowerFirst, N as NoCase, P as PascalCase, f as PascalSnakeCase, g as PathCase, S as SentenceCase, h as SnakeCase, i as SplitByCase, T as TitleCase, j as TrainCase, U as UpperFirst } from '../packem_shared/types-mlwFVBiS.mjs';
21
21
  export { default as upperFirst } from './upper-first.mjs';
22
22
  import '../packem_shared/lru-cache-B_t27XwI.mjs';
23
23
 
@@ -1,4 +1,4 @@
1
- export { N as NodeLocale } from '../packem_shared/types-DmfKbIaI.js';
1
+ export { N as NodeLocale } from '../packem_shared/types-BSdIWVzn.js';
2
2
  export { default as camelCase } from './camel-case.js';
3
3
  export { default as capitalCase } from './capital-case.js';
4
4
  export { default as constantCase } from './constant-case.js';
@@ -17,7 +17,7 @@ export { default as snakeCase } from './snake-case.js';
17
17
  export { SplitOptions, splitByCase } from './split-by-case.js';
18
18
  export { default as titleCase } from './title-case.js';
19
19
  export { default as trainCase } from './train-case.js';
20
- export { a as CamelCase, b as CapitalCase, C as CaseOptions, c as ConstantCase, D as DotCase, F as FlatCase, d as FlipCase, I as IdentifyCase, K as KebabCase, L as LocaleOptions, e as LowerFirst, N as NoCase, P as PascalCase, f as PascalSnakeCase, g as PathCase, S as SentenceCase, h as SnakeCase, i as SplitByCase, T as TitleCase, j as TrainCase, U as UpperFirst } from '../packem_shared/types-DcGtApe2.js';
20
+ export { a as CamelCase, b as CapitalCase, C as CaseOptions, c as ConstantCase, D as DotCase, F as FlatCase, d as FlipCase, I as IdentifyCase, K as KebabCase, L as LocaleOptions, e as LowerFirst, N as NoCase, P as PascalCase, f as PascalSnakeCase, g as PathCase, S as SentenceCase, h as SnakeCase, i as SplitByCase, T as TitleCase, j as TrainCase, U as UpperFirst } from '../packem_shared/types-BfGNLD2K.js';
21
21
  export { default as upperFirst } from './upper-first.js';
22
22
  import '../packem_shared/lru-cache-B_t27XwI.js';
23
23
 
@@ -1,20 +1 @@
1
- export { default as camelCase } from './camel-case.mjs';
2
- export { default as capitalCase } from './capital-case.mjs';
3
- export { default as constantCase } from './constant-case.mjs';
4
- export { default as dotCase } from './dot-case.mjs';
5
- export { default as flatCase } from './flat-case.mjs';
6
- export { flipCase } from './flip-case.mjs';
7
- export { default as identifyCase } from './identify-case.mjs';
8
- export { kebabCase } from './kebab-case.mjs';
9
- export { default as lowerFirst } from './lower-first.mjs';
10
- export { default as noCase } from './no-case.mjs';
11
- export { default as pascalCase } from './pascal-case.mjs';
12
- export { default as pascalSnakeCase } from './pascal-snake-case.mjs';
13
- export { default as pathCase } from './path-case.mjs';
14
- export { default as sentenceCase } from './sentence-case.mjs';
15
- export { default as snakeCase } from './snake-case.mjs';
16
- export { splitByCase } from './split-by-case.mjs';
17
- export { default as titleCase } from './title-case.mjs';
18
- export { default as trainCase } from './train-case.mjs';
19
- export { default as upperFirst } from './upper-first.mjs';
20
- export { default as joinSegments } from '../packem_shared/joinSegments-BovQ2h_P.mjs';
1
+ import{default as t}from"./camel-case.mjs";import{default as r}from"./capital-case.mjs";import{default as f}from"./constant-case.mjs";import{default as l}from"./dot-case.mjs";import{default as x}from"./flat-case.mjs";import{flipCase as u}from"./flip-case.mjs";import{default as n}from"./identify-case.mjs";import{kebabCase as c}from"./kebab-case.mjs";import{default as b}from"./lower-first.mjs";import{default as F}from"./no-case.mjs";import{default as g}from"./pascal-case.mjs";import{default as j}from"./pascal-snake-case.mjs";import{default as B}from"./path-case.mjs";import{default as v}from"./sentence-case.mjs";import{default as A}from"./snake-case.mjs";import{splitByCase as E}from"./split-by-case.mjs";import{default as H}from"./title-case.mjs";import{default as J}from"./train-case.mjs";import{default as L}from"./upper-first.mjs";import{default as N}from"../packem_shared/joinSegments-H7QJ7rwJ.mjs";export{t as camelCase,r as capitalCase,f as constantCase,l as dotCase,x as flatCase,u as flipCase,n as identifyCase,N as joinSegments,c as kebabCase,b as lowerFirst,F as noCase,g as pascalCase,j as pascalSnakeCase,B as pathCase,v as sentenceCase,A as snakeCase,E as splitByCase,H as titleCase,J as trainCase,L as upperFirst};
@@ -1,61 +1 @@
1
- 'use strict';
2
-
3
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
-
5
- const constants = require('../packem_shared/constants-CKuHriHc.cjs');
6
- const LRUCache = require('../packem_shared/LRUCache-Crb-m7cw.cjs');
7
- const case_splitByCase = require('./split-by-case.cjs');
8
- const generateCacheKey = require('../packem_shared/generate-cache-key-D8f1auDB.cjs');
9
- const joinSegments = require('../packem_shared/joinSegments-B_7bxy5J.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 kebabCase = /* @__PURE__ */ __name((value, options) => {
16
- if (typeof value !== "string") {
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
- const words = case_splitByCase.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
- });
38
- const processed = words.map((word) => {
39
- if (options?.handleAnsi && constants.RE_FAST_ANSI.test(word)) {
40
- return word;
41
- }
42
- if (options?.toUpperCase) {
43
- if (options.locale) {
44
- return word.toLocaleUpperCase(options.locale);
45
- }
46
- return word.toUpperCase();
47
- }
48
- const split = options?.locale?.startsWith("de") ? normalizeGermanEszett.normalizeGermanEszett(word) : word;
49
- if (options?.locale) {
50
- return split.toLocaleLowerCase(options.locale);
51
- }
52
- return split.toLowerCase();
53
- });
54
- const result = joinSegments(processed, options?.joiner ?? "-");
55
- if (shouldCache && cacheKey) {
56
- cacheStore.set(cacheKey, result);
57
- }
58
- return result;
59
- }, "kebabCase");
60
-
61
- exports.kebabCase = kebabCase;
1
+ "use strict";var u=Object.defineProperty;var l=(r,e)=>u(r,"name",{value:e,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("../packem_shared/constants-D3K8u3G8.cjs"),m=require("../packem_shared/LRUCache-TYqfUYE5.cjs"),C=require("./split-by-case.cjs"),d=require("../packem_shared/generate-cache-key-BZf0GiMs.cjs"),h=require("../packem_shared/joinSegments-CDHNMXsF.cjs"),b=require("../packem_shared/normalize-german-eszett-Bop4wOp9.cjs");var f=Object.defineProperty,j=l((r,e)=>f(r,"name",{value:e,configurable:!0}),"o");const y=new m(1e3),g=j((r,e)=>{if(typeof r!="string")return"";const o=e?.cache??!1,s=e?.cacheStore??y;let t;if(o&&(t=d.a(r,e)),o&&t&&s.has(t))return s.get(t);const c=C.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(a=>{if(e?.handleAnsi&&p.R.test(a))return a;if(e?.toUpperCase)return e.locale?a.toLocaleUpperCase(e.locale):a.toUpperCase();const i=e?.locale?.startsWith("de")?b.l(a):a;return e?.locale?i.toLocaleLowerCase(e.locale):i.toLowerCase()}),n=h(c,e?.joiner??"-");return o&&t&&s.set(t,n),n},"kebabCase");exports.kebabCase=g;
@@ -1,5 +1,5 @@
1
- import { C as CaseOptions, K as KebabCase } from '../packem_shared/types-C5Pk8B8Q.cjs';
2
- import '../packem_shared/types-DmfKbIaI.cjs';
1
+ import { C as CaseOptions, K as KebabCase } from '../packem_shared/types-DrtiqNkK.cjs';
2
+ import '../packem_shared/types-BSdIWVzn.cjs';
3
3
  import '../packem_shared/lru-cache-B_t27XwI.cjs';
4
4
 
5
5
  interface KebabCaseOptions extends CaseOptions {
@@ -8,4 +8,5 @@ interface KebabCaseOptions extends CaseOptions {
8
8
  }
9
9
  declare const kebabCase: <T extends string = string>(value?: T, options?: KebabCaseOptions) => KebabCase<T>;
10
10
 
11
- export { type KebabCaseOptions, kebabCase };
11
+ export { kebabCase };
12
+ export type { KebabCaseOptions };
@@ -1,5 +1,5 @@
1
- import { C as CaseOptions, K as KebabCase } from '../packem_shared/types-_jqW_ZOt.mjs';
2
- import '../packem_shared/types-DmfKbIaI.mjs';
1
+ import { C as CaseOptions, K as KebabCase } from '../packem_shared/types-mlwFVBiS.mjs';
2
+ import '../packem_shared/types-BSdIWVzn.mjs';
3
3
  import '../packem_shared/lru-cache-B_t27XwI.mjs';
4
4
 
5
5
  interface KebabCaseOptions extends CaseOptions {
@@ -8,4 +8,5 @@ interface KebabCaseOptions extends CaseOptions {
8
8
  }
9
9
  declare const kebabCase: <T extends string = string>(value?: T, options?: KebabCaseOptions) => KebabCase<T>;
10
10
 
11
- export { type KebabCaseOptions, kebabCase };
11
+ export { kebabCase };
12
+ export type { KebabCaseOptions };
@@ -1,5 +1,5 @@
1
- import { C as CaseOptions, K as KebabCase } from '../packem_shared/types-DcGtApe2.js';
2
- import '../packem_shared/types-DmfKbIaI.js';
1
+ import { C as CaseOptions, K as KebabCase } from '../packem_shared/types-BfGNLD2K.js';
2
+ import '../packem_shared/types-BSdIWVzn.js';
3
3
  import '../packem_shared/lru-cache-B_t27XwI.js';
4
4
 
5
5
  interface KebabCaseOptions extends CaseOptions {
@@ -8,4 +8,5 @@ interface KebabCaseOptions extends CaseOptions {
8
8
  }
9
9
  declare const kebabCase: <T extends string = string>(value?: T, options?: KebabCaseOptions) => KebabCase<T>;
10
10
 
11
- export { type KebabCaseOptions, kebabCase };
11
+ export { kebabCase };
12
+ export type { KebabCaseOptions };
@@ -1,57 +1 @@
1
- import { R as RE_FAST_ANSI } from '../packem_shared/constants-CsGLUb4U.mjs';
2
- import LRUCache from '../packem_shared/LRUCache-udNErhWw.mjs';
3
- import { splitByCase } from './split-by-case.mjs';
4
- import { g as generateCacheKey } from '../packem_shared/generate-cache-key-YSju5pj2.mjs';
5
- import joinSegments from '../packem_shared/joinSegments-BovQ2h_P.mjs';
6
- import { n as normalizeGermanEszett } from '../packem_shared/normalize-german-eszett-fpJ4lZL6.mjs';
7
-
8
- var __defProp = Object.defineProperty;
9
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
- const defaultCacheStore = new LRUCache(1e3);
11
- const kebabCase = /* @__PURE__ */ __name((value, options) => {
12
- if (typeof value !== "string") {
13
- return "";
14
- }
15
- const shouldCache = options?.cache ?? false;
16
- const cacheStore = options?.cacheStore ?? defaultCacheStore;
17
- let cacheKey;
18
- if (shouldCache) {
19
- cacheKey = generateCacheKey(value, options);
20
- }
21
- if (shouldCache && cacheKey && cacheStore.has(cacheKey)) {
22
- return cacheStore.get(cacheKey);
23
- }
24
- const words = splitByCase(value, {
25
- handleAnsi: options?.handleAnsi,
26
- handleEmoji: options?.handleEmoji,
27
- knownAcronyms: options?.knownAcronyms,
28
- locale: options?.locale,
29
- normalize: options?.normalize,
30
- separators: void 0,
31
- stripAnsi: options?.stripAnsi,
32
- stripEmoji: options?.stripEmoji
33
- });
34
- const processed = words.map((word) => {
35
- if (options?.handleAnsi && RE_FAST_ANSI.test(word)) {
36
- return word;
37
- }
38
- if (options?.toUpperCase) {
39
- if (options.locale) {
40
- return word.toLocaleUpperCase(options.locale);
41
- }
42
- return word.toUpperCase();
43
- }
44
- const split = options?.locale?.startsWith("de") ? normalizeGermanEszett(word) : word;
45
- if (options?.locale) {
46
- return split.toLocaleLowerCase(options.locale);
47
- }
48
- return split.toLowerCase();
49
- });
50
- const result = joinSegments(processed, options?.joiner ?? "-");
51
- if (shouldCache && cacheKey) {
52
- cacheStore.set(cacheKey, result);
53
- }
54
- return result;
55
- }, "kebabCase");
56
-
57
- export { kebabCase };
1
+ var m=Object.defineProperty;var l=(r,o)=>m(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 as h}from"../packem_shared/generate-cache-key-DPByFaMH.mjs";import A from"../packem_shared/joinSegments-H7QJ7rwJ.mjs";import{l as d}from"../packem_shared/normalize-german-eszett-4k1qRtEP.mjs";var C=Object.defineProperty,b=l((r,o)=>C(r,"name",{value:o,configurable:!0}),"o");const j=new f(1e3),S=b((r,o)=>{if(typeof r!="string")return"";const a=o?.cache??!1,s=o?.cacheStore??j;let e;if(a&&(e=h(r,o)),a&&e&&s.has(e))return s.get(e);const c=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(o?.handleAnsi&&p.test(t))return t;if(o?.toUpperCase)return o.locale?t.toLocaleUpperCase(o.locale):t.toUpperCase();const i=o?.locale?.startsWith("de")?d(t):t;return o?.locale?i.toLocaleLowerCase(o.locale):i.toLowerCase()}),n=A(c,o?.joiner??"-");return a&&e&&s.set(e,n),n},"kebabCase");export{S as kebabCase};
@@ -1,13 +1 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- const lowerFirst = /* @__PURE__ */ __name((value, options) => {
6
- if (typeof value !== "string" || value === "") {
7
- return "";
8
- }
9
- const firstChar = options?.locale ? value[0].toLocaleLowerCase(options.locale) : value[0].toLowerCase();
10
- return firstChar + value.slice(1);
11
- }, "lowerFirst");
12
-
13
- module.exports = lowerFirst;
1
+ "use strict";var a=Object.defineProperty;var t=(e,o)=>a(e,"name",{value:o,configurable:!0});var s=Object.defineProperty,l=t((e,o)=>s(e,"name",{value:o,configurable:!0}),"s");const r=l((e,o)=>typeof e!="string"||e===""?"":(o?.locale?e[0].toLocaleLowerCase(o.locale):e[0].toLowerCase())+e.slice(1),"lowerFirst");module.exports=r;
@@ -1,5 +1,5 @@
1
- import { L as LocaleOptions, e as LowerFirst } from '../packem_shared/types-C5Pk8B8Q.cjs';
2
- import '../packem_shared/types-DmfKbIaI.cjs';
1
+ import { L as LocaleOptions, e as LowerFirst } from '../packem_shared/types-DrtiqNkK.cjs';
2
+ import '../packem_shared/types-BSdIWVzn.cjs';
3
3
  import '../packem_shared/lru-cache-B_t27XwI.cjs';
4
4
 
5
5
  declare const lowerFirst: <T extends string = string>(value?: T, options?: LocaleOptions) => LowerFirst<T>;
@@ -1,5 +1,5 @@
1
- import { L as LocaleOptions, e as LowerFirst } from '../packem_shared/types-_jqW_ZOt.mjs';
2
- import '../packem_shared/types-DmfKbIaI.mjs';
1
+ import { L as LocaleOptions, e as LowerFirst } from '../packem_shared/types-mlwFVBiS.mjs';
2
+ import '../packem_shared/types-BSdIWVzn.mjs';
3
3
  import '../packem_shared/lru-cache-B_t27XwI.mjs';
4
4
 
5
5
  declare const lowerFirst: <T extends string = string>(value?: T, options?: LocaleOptions) => LowerFirst<T>;
@@ -1,5 +1,5 @@
1
- import { L as LocaleOptions, e as LowerFirst } from '../packem_shared/types-DcGtApe2.js';
2
- import '../packem_shared/types-DmfKbIaI.js';
1
+ import { L as LocaleOptions, e as LowerFirst } from '../packem_shared/types-BfGNLD2K.js';
2
+ import '../packem_shared/types-BSdIWVzn.js';
3
3
  import '../packem_shared/lru-cache-B_t27XwI.js';
4
4
 
5
5
  declare const lowerFirst: <T extends string = string>(value?: T, options?: LocaleOptions) => LowerFirst<T>;
@@ -1,11 +1 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- const lowerFirst = /* @__PURE__ */ __name((value, options) => {
4
- if (typeof value !== "string" || value === "") {
5
- return "";
6
- }
7
- const firstChar = options?.locale ? value[0].toLocaleLowerCase(options.locale) : value[0].toLowerCase();
8
- return firstChar + value.slice(1);
9
- }, "lowerFirst");
10
-
11
- export { lowerFirst as default };
1
+ var l=Object.defineProperty;var a=(e,o)=>l(e,"name",{value:o,configurable:!0});var t=Object.defineProperty,r=a((e,o)=>t(e,"name",{value:o,configurable:!0}),"s");const c=r((e,o)=>typeof e!="string"||e===""?"":(o?.locale?e[0].toLocaleLowerCase(o.locale):e[0].toLowerCase())+e.slice(1),"lowerFirst");export{c 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 noCase = /* @__PURE__ */ __name((value, options) => case_kebabCase.kebabCase(value, { cacheStore: defaultCacheStore, ...options, joiner: " " }), "noCase");
10
-
11
- module.exports = noCase;
1
+ "use strict";var s=Object.defineProperty;var a=(e,r)=>s(e,"name",{value:r,configurable:!0});const c=require("../packem_shared/LRUCache-TYqfUYE5.cjs"),n=require("./kebab-case.cjs");var o=Object.defineProperty,t=a((e,r)=>o(e,"name",{value:r,configurable:!0}),"o");const i=new c(1e3),b=t((e,r)=>n.kebabCase(e,{cacheStore:i,...r,joiner:" "}),"noCase");module.exports=b;