toolbox-x 1.0.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 (190) hide show
  1. package/LICENSE +201 -0
  2. package/dist/Color-B3mgF9Dh.d.cts +486 -0
  3. package/dist/Color-D38Xrw65.d.mts +486 -0
  4. package/dist/Stylog-Df7eq3-j.d.cts +519 -0
  5. package/dist/Stylog-jvlLcMQq.d.mts +519 -0
  6. package/dist/array-DvW0zIu6.d.mts +130 -0
  7. package/dist/array-rUnEVisO.d.cts +130 -0
  8. package/dist/basics-D_eSv0cu.cjs +132 -0
  9. package/dist/basics-Dp_aEK81.mjs +115 -0
  10. package/dist/basics-WEYWlnRO.d.cts +95 -0
  11. package/dist/basics-uBSfkBEI.d.mts +95 -0
  12. package/dist/case-BWIt8Ash.mjs +449 -0
  13. package/dist/case-C-S-b5YP.d.cts +327 -0
  14. package/dist/case-CS8Ii3A7.cjs +526 -0
  15. package/dist/case-CybASFPD.d.mts +327 -0
  16. package/dist/change-case.cjs +32 -0
  17. package/dist/change-case.d.cts +18 -0
  18. package/dist/change-case.d.mts +18 -0
  19. package/dist/change-case.mjs +19 -0
  20. package/dist/colors.cjs +574 -0
  21. package/dist/colors.d.cts +355 -0
  22. package/dist/colors.d.mts +355 -0
  23. package/dist/colors.mjs +547 -0
  24. package/dist/constants-2gAw23_7.mjs +144 -0
  25. package/dist/constants-B34K0QPi.d.cts +21 -0
  26. package/dist/constants-BIBDKY1u.cjs +924 -0
  27. package/dist/constants-BWT-810U.cjs +158 -0
  28. package/dist/constants-BwbHnXlM.mjs +662 -0
  29. package/dist/constants-BxN9l5el.cjs +74 -0
  30. package/dist/constants-CLS_bgKD.d.mts +847 -0
  31. package/dist/constants-D73iFu8g.mjs +171 -0
  32. package/dist/constants-DAfRxaa8.mjs +62 -0
  33. package/dist/constants-DQYeCjlx.cjs +207 -0
  34. package/dist/constants-Deeie-iH.d.mts +21 -0
  35. package/dist/constants-DpTG9RP6.d.mts +29 -0
  36. package/dist/constants-DqwnkJ_d.cjs +740 -0
  37. package/dist/constants-DvRUY_FY.cjs +150 -0
  38. package/dist/constants-VcRtQu0K.d.cts +29 -0
  39. package/dist/constants-X5hm1UtB.mjs +912 -0
  40. package/dist/constants-eNd-iYsV.mjs +134 -0
  41. package/dist/constants-qm8FafmD.d.cts +847 -0
  42. package/dist/constants.cjs +415 -0
  43. package/dist/constants.d.cts +184 -0
  44. package/dist/constants.d.mts +184 -0
  45. package/dist/constants.mjs +378 -0
  46. package/dist/convert-BOCgUv2D.cjs +252 -0
  47. package/dist/convert-Bn4jFomQ.mjs +169 -0
  48. package/dist/convert-BrzlG-m_.cjs +475 -0
  49. package/dist/convert-DhaUoPVU.mjs +368 -0
  50. package/dist/converter-1P90_RcP.d.mts +402 -0
  51. package/dist/converter-CmkcAppi.d.cts +402 -0
  52. package/dist/converter.cjs +780 -0
  53. package/dist/converter.d.cts +29 -0
  54. package/dist/converter.d.mts +29 -0
  55. package/dist/converter.mjs +771 -0
  56. package/dist/countries-CIpmtEzV.cjs +1469 -0
  57. package/dist/countries-Cy0xiqS3.mjs +1463 -0
  58. package/dist/css-colors-Bx947Ng3.d.cts +179 -0
  59. package/dist/css-colors-CXCDqQbG.cjs +186 -0
  60. package/dist/css-colors-CXTp1vvy.d.mts +179 -0
  61. package/dist/css-colors-DfUW3nTR.mjs +180 -0
  62. package/dist/date.cjs +332 -0
  63. package/dist/date.d.cts +213 -0
  64. package/dist/date.d.mts +213 -0
  65. package/dist/date.mjs +298 -0
  66. package/dist/dom.cjs +461 -0
  67. package/dist/dom.d.cts +228 -0
  68. package/dist/dom.d.mts +228 -0
  69. package/dist/dom.mjs +429 -0
  70. package/dist/form-BMFVGUrN.d.mts +118 -0
  71. package/dist/form-DRFbryvK.d.cts +118 -0
  72. package/dist/guards-3kaUX66g.mjs +157 -0
  73. package/dist/guards-C8gkvIHb.cjs +240 -0
  74. package/dist/guards-DdyU4h4o.mjs +110 -0
  75. package/dist/guards-Efhp1mNy.cjs +151 -0
  76. package/dist/guards.cjs +172 -0
  77. package/dist/guards.d.cts +399 -0
  78. package/dist/guards.d.mts +399 -0
  79. package/dist/guards.mjs +75 -0
  80. package/dist/hash-B6JPEyAz.d.mts +131 -0
  81. package/dist/hash-NTpeKYB_.d.cts +131 -0
  82. package/dist/hash.cjs +2126 -0
  83. package/dist/hash.d.cts +1239 -0
  84. package/dist/hash.d.mts +1239 -0
  85. package/dist/hash.mjs +2095 -0
  86. package/dist/http-status-BAZdtr7-.d.mts +65 -0
  87. package/dist/http-status-U_3MtoGb.d.cts +65 -0
  88. package/dist/http-status.cjs +173 -0
  89. package/dist/http-status.d.cts +142 -0
  90. package/dist/http-status.d.mts +142 -0
  91. package/dist/http-status.mjs +171 -0
  92. package/dist/index.cjs +2551 -0
  93. package/dist/index.d.cts +1493 -0
  94. package/dist/index.d.mts +1493 -0
  95. package/dist/index.mjs +2357 -0
  96. package/dist/object-B0TV3eHx.d.mts +8052 -0
  97. package/dist/object-Blq0Amdv.d.cts +8052 -0
  98. package/dist/objectify-CDs0Fbr1.mjs +417 -0
  99. package/dist/objectify-DIJ-OBmo.cjs +524 -0
  100. package/dist/paginator.cjs +245 -0
  101. package/dist/paginator.d.cts +144 -0
  102. package/dist/paginator.d.mts +144 -0
  103. package/dist/paginator.mjs +243 -0
  104. package/dist/parse-2ubxXZRp.cjs +211 -0
  105. package/dist/parse-N7g942uy.mjs +164 -0
  106. package/dist/pluralizer-BjMIc6uT.d.mts +42 -0
  107. package/dist/pluralizer-Cb6ZmrDl.d.cts +42 -0
  108. package/dist/pluralizer.cjs +678 -0
  109. package/dist/pluralizer.d.cts +152 -0
  110. package/dist/pluralizer.d.mts +152 -0
  111. package/dist/pluralizer.mjs +676 -0
  112. package/dist/primitives-B26uZolQ.cjs +228 -0
  113. package/dist/primitives-KsFUp3kQ.mjs +144 -0
  114. package/dist/specials-D48_IZbd.d.mts +108 -0
  115. package/dist/specials-DzLr1ZgU.cjs +477 -0
  116. package/dist/specials-LVONlKbQ.d.cts +108 -0
  117. package/dist/specials-uhDuRg8H.mjs +292 -0
  118. package/dist/string-CBAbxaG1.d.mts +258 -0
  119. package/dist/string-CsNsm_65.d.cts +258 -0
  120. package/dist/stylog.cjs +621 -0
  121. package/dist/stylog.d.cts +49 -0
  122. package/dist/stylog.d.mts +49 -0
  123. package/dist/stylog.mjs +614 -0
  124. package/dist/timezone-B2OYK6Fh.mjs +5589 -0
  125. package/dist/timezone-Beh9IGpw.cjs +5625 -0
  126. package/dist/types/array.cjs +16 -0
  127. package/dist/types/array.d.cts +18 -0
  128. package/dist/types/array.d.mts +18 -0
  129. package/dist/types/array.mjs +17 -0
  130. package/dist/types/colors.cjs +16 -0
  131. package/dist/types/colors.d.cts +18 -0
  132. package/dist/types/colors.d.mts +18 -0
  133. package/dist/types/colors.mjs +17 -0
  134. package/dist/types/converter.cjs +16 -0
  135. package/dist/types/converter.d.cts +18 -0
  136. package/dist/types/converter.d.mts +18 -0
  137. package/dist/types/converter.mjs +17 -0
  138. package/dist/types/form.cjs +16 -0
  139. package/dist/types/form.d.cts +18 -0
  140. package/dist/types/form.d.mts +18 -0
  141. package/dist/types/form.mjs +17 -0
  142. package/dist/types/hash.cjs +16 -0
  143. package/dist/types/hash.d.cts +18 -0
  144. package/dist/types/hash.d.mts +18 -0
  145. package/dist/types/hash.mjs +17 -0
  146. package/dist/types/http-status.cjs +16 -0
  147. package/dist/types/http-status.d.cts +18 -0
  148. package/dist/types/http-status.d.mts +18 -0
  149. package/dist/types/http-status.mjs +17 -0
  150. package/dist/types/index.cjs +16 -0
  151. package/dist/types/index.d.cts +18 -0
  152. package/dist/types/index.d.mts +18 -0
  153. package/dist/types/index.mjs +17 -0
  154. package/dist/types/number.cjs +16 -0
  155. package/dist/types/number.d.cts +18 -0
  156. package/dist/types/number.d.mts +18 -0
  157. package/dist/types/number.mjs +17 -0
  158. package/dist/types/object.cjs +16 -0
  159. package/dist/types/object.d.cts +18 -0
  160. package/dist/types/object.d.mts +18 -0
  161. package/dist/types/object.mjs +17 -0
  162. package/dist/types/pluralizer.cjs +16 -0
  163. package/dist/types/pluralizer.d.cts +18 -0
  164. package/dist/types/pluralizer.d.mts +18 -0
  165. package/dist/types/pluralizer.mjs +17 -0
  166. package/dist/types/string.cjs +16 -0
  167. package/dist/types/string.d.cts +18 -0
  168. package/dist/types/string.d.mts +18 -0
  169. package/dist/types/string.mjs +17 -0
  170. package/dist/types/stylog.cjs +16 -0
  171. package/dist/types/stylog.d.cts +18 -0
  172. package/dist/types/stylog.d.mts +18 -0
  173. package/dist/types/stylog.mjs +17 -0
  174. package/dist/types/utils.cjs +16 -0
  175. package/dist/types/utils.d.cts +18 -0
  176. package/dist/types/utils.d.mts +18 -0
  177. package/dist/types/utils.mjs +17 -0
  178. package/dist/types/verbalizer.cjs +16 -0
  179. package/dist/types/verbalizer.d.cts +30 -0
  180. package/dist/types/verbalizer.d.mts +30 -0
  181. package/dist/types/verbalizer.mjs +17 -0
  182. package/dist/utilities-CLUmdQeV.cjs +140 -0
  183. package/dist/utilities-m5yFKqLd.mjs +105 -0
  184. package/dist/utils-ClW9LA6f.mjs +449 -0
  185. package/dist/utils-DLFRgXUC.cjs +568 -0
  186. package/dist/verbalizer.cjs +998 -0
  187. package/dist/verbalizer.d.cts +148 -0
  188. package/dist/verbalizer.d.mts +148 -0
  189. package/dist/verbalizer.mjs +996 -0
  190. package/package.json +249 -0
@@ -0,0 +1,449 @@
1
+ /**
2
+ * Copyright 2026 - present Nazmul Hassan
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { a as isNonEmptyString } from "./primitives-KsFUp3kQ.mjs";
18
+ import { t as LOWERCASE } from "./constants-2gAw23_7.mjs";
19
+
20
+ //#region src/string/case.ts
21
+ /** Lowercase words set for fast lookup */
22
+ const smallSet = /* @__PURE__ */ new Set(LOWERCASE);
23
+ /**
24
+ * * Converts a string to a specified case format with advanced handling for word boundaries, punctuation, acronyms, and Unicode characters.
25
+ *
26
+ * @remarks
27
+ * - This function is Unicode-aware, treats non-alphanumeric characters (spaces, underscores, dots, slashes, etc.) as word boundaries, and optionally preserves internal acronyms.
28
+ * - `Title Case` formatting respects small words such as prepositions, articles, conjunctions, and auxiliary verbs (defined in `LOWERCASE`) — these are not capitalized unless they appear at the start or end of the string.
29
+ * - Leading and trailing punctuation (non-letter/number characters) is preserved in the result.
30
+ *
31
+ * @param value - The input string to convert. Can contain letters, numbers, punctuation,
32
+ * spaces, underscores, dashes, etc.
33
+ * @param format - The target case format:
34
+ * - `'camelCase'` → camelCase (e.g., `myVariableName`)
35
+ * - `'PascalCase'` → PascalCase (e.g., `MyVariableName`)
36
+ * - `'snake_case'` → snake_case (e.g., `my_variable_name`)
37
+ * - `'kebab-case'` → kebab-case (e.g., `my-variable-name`)
38
+ * - `'Title Case'` → Title Case (e.g., `My Variable Name`)
39
+ * - `'Sentence case'` → Sentence case (e.g., `My variable name`)
40
+ * - `'lowercase'` → all lowercase [ It is recommended to use built-in string method `string.toLowerCase()` ]
41
+ * - `'UPPERCASE'` → all uppercase [ It is recommended to use built-in string method `string.toUpperCase()` ]
42
+ * @param options - Optional configuration options for more control.
43
+ *
44
+ * @returns The converted string, with leading/trailing punctuation preserved.
45
+ *
46
+ * @example
47
+ * // Basic usage
48
+ * convertStringCase('my-example_string', 'camelCase');
49
+ * // Returns: 'myExampleString'
50
+ *
51
+ * convertStringCase('my-example_string', 'snake_case');
52
+ * // Returns: 'my_example_string'
53
+ *
54
+ * convertStringCase('my-example_string', 'kebab-case');
55
+ * // Returns: 'my-example-string'
56
+ *
57
+ * convertStringCase('my example string', 'Title Case');
58
+ * // Returns: 'My Example String'
59
+ *
60
+ * convertStringCase('my example string', 'Sentence case');
61
+ * // Returns: 'My example string'
62
+ *
63
+ * convertStringCase('My example String', 'lowercase');
64
+ * // Returns: 'my example string'
65
+ *
66
+ * convertStringCase('my example string', 'UPPERCASE');
67
+ * // Returns: 'MY EXAMPLE STRING'
68
+ *
69
+ * @example
70
+ * // Preserve acronyms
71
+ * convertStringCase('get API response', 'camelCase', { preserveAcronyms: true });
72
+ * // Returns: 'getAPIResponse'
73
+ *
74
+ * convertStringCase('get API response', 'PascalCase', { preserveAcronyms: true });
75
+ * // Returns: 'GetAPIResponse'
76
+ *
77
+ * convertStringCase('the API of things', 'Title Case', { preserveAcronyms: true });
78
+ * // Returns: 'The API of Things'
79
+ *
80
+ * @example
81
+ * // Leading/trailing punctuation is preserved
82
+ * convertStringCase('++hello_world++', 'PascalCase');
83
+ * // Returns: '++HelloWorld++'
84
+ *
85
+ * @example
86
+ * // Dashes are preserved in Title Case
87
+ * convertStringCase('xml-http_request', 'Title Case');
88
+ * // Returns: 'Xml-http Request'
89
+ *
90
+ * @example
91
+ * // Empty string returns empty
92
+ * convertStringCase('', 'camelCase');
93
+ * // Returns: ''
94
+ *
95
+ * @example
96
+ * // Single token is capitalized properly
97
+ * convertStringCase('api', 'PascalCase');
98
+ * // Returns: 'Api'
99
+ */
100
+ function convertStringCase(value, format, options) {
101
+ if (!isNonEmptyString(value)) return "";
102
+ const { preserveAcronyms = false } = options ?? {};
103
+ const LEADING_PUNCTUATION = /^[^\p{L}\p{N}\s]+/u;
104
+ const TRAILING_PUNCTUATION = /[^\p{L}\p{N}\s]+$/u;
105
+ const SEPARATOR = format === "Title Case" ? /[^\p{L}\p{N}-]+/gu : /[^\p{L}\p{N}]+/gu;
106
+ const CAMEL_BOUNDARY = /(?<=[\p{Ll}\p{N}])(?=\p{Lu})|(?<=[\p{Lu}])(?=\p{Lu}[\p{Ll}])/u;
107
+ const LETTER_NUMBER_BOUNDARY = /(?<=[\p{L}])(?=\p{N})|(?<=[\p{N}])(?=\p{L})/u;
108
+ const start = value.match(LEADING_PUNCTUATION)?.[0] ?? "";
109
+ const end = value.match(TRAILING_PUNCTUATION)?.[0] ?? "";
110
+ const core = value.replace(/^[^\p{L}\p{N}\s]+|[^\p{L}\p{N}\s]+$/gu, "").trim();
111
+ const lowerCase = (s) => s.toLowerCase();
112
+ const isAcronym = (s) => s.length >= 2 && /^[\p{Lu}]+$/u.test(s);
113
+ const capitalize = (s) => s.length === 0 ? "" : _capitalize(s);
114
+ let tokens = core.length > 0 ? core.split(SEPARATOR).filter(Boolean) : [];
115
+ if (tokens.length <= 1 && core.length > 0) if (CAMEL_BOUNDARY.test(core)) tokens = core.split(CAMEL_BOUNDARY).filter(Boolean);
116
+ else if (LETTER_NUMBER_BOUNDARY.test(core)) tokens = core.split(LETTER_NUMBER_BOUNDARY).filter(Boolean);
117
+ else tokens = [core];
118
+ if (tokens.length === 0) return start.concat(end);
119
+ switch (format) {
120
+ case "camelCase": {
121
+ const middle = tokens.slice(1).map((token) => {
122
+ if (preserveAcronyms && isAcronym(token)) return token;
123
+ return capitalize(token);
124
+ }).join("");
125
+ return start.concat(lowerCase(tokens[0]).concat(middle), end);
126
+ }
127
+ case "PascalCase": {
128
+ const body = tokens.map((token) => {
129
+ if (preserveAcronyms && isAcronym(token)) return token;
130
+ return capitalize(token);
131
+ }).join("");
132
+ return start.concat(body, end);
133
+ }
134
+ case "snake_case": {
135
+ const body = tokens.map((token) => lowerCase(token)).join("_");
136
+ return start.concat(body, end);
137
+ }
138
+ case "kebab-case": {
139
+ const body = tokens.map((token) => lowerCase(token)).join("-");
140
+ return start.concat(body, end);
141
+ }
142
+ case "Title Case": {
143
+ const title = tokens.map((token, idx, self) => {
144
+ const tokenLower = token.toLowerCase();
145
+ if (idx !== 0 && idx !== self.length - 1 && smallSet.has(tokenLower)) return tokenLower;
146
+ if (preserveAcronyms && token.includes("-")) return token.split("-").map((sub) => isAcronym(sub) ? sub : capitalize(sub)).join("-");
147
+ if (preserveAcronyms && isAcronym(token)) return token.split("-");
148
+ return capitalize(token);
149
+ }).join(" ");
150
+ return start.concat(title, end);
151
+ }
152
+ case "Sentence case": {
153
+ const word = tokens.map((token, idx) => {
154
+ if (preserveAcronyms && token.includes("-")) return token.split("-").map((sub) => isAcronym(sub) ? sub : idx === 0 ? capitalize(sub) : sub.toLowerCase()).join("-");
155
+ if (preserveAcronyms && isAcronym(token)) return token.split("-");
156
+ return idx === 0 ? capitalize(token) : token.toLowerCase();
157
+ }).join(" ");
158
+ return start.concat(word, end);
159
+ }
160
+ case "lowercase": return start.concat(core.toLowerCase(), end);
161
+ case "UPPERCASE": return start.concat(core.toUpperCase(), end);
162
+ default: return start.concat(core, end);
163
+ }
164
+ }
165
+ /**
166
+ * * Utility to convert the first letter of any string to uppercase and the rest lowercase (unless specified).
167
+ * * Handles surrounding symbols like quotes or parentheses.
168
+ *
169
+ * @param string String to be capitalized.
170
+ * @param options Options to customize the capitalization.
171
+ * @returns Capitalized string or fully uppercased string depending on `capitalizeAll` option.
172
+ */
173
+ function capitalizeString(string, options) {
174
+ if (!isNonEmptyString(string)) return "";
175
+ const trimmedString = string.trim();
176
+ if (!trimmedString) return "";
177
+ const { capitalizeAll = false, capitalizeEachFirst = false, lowerCaseRest = true } = options || {};
178
+ if (capitalizeAll) return trimmedString.toUpperCase();
179
+ if (capitalizeEachFirst) return trimmedString?.split(/\s+/)?.map((word) => capitalizeString(word, { lowerCaseRest }))?.join(" ");
180
+ const matchArray = trimmedString.match(/^(\W*)(\w)(.*)$/);
181
+ if (matchArray && matchArray?.length === 4) {
182
+ const [_, leadingSymbols, firstLetter, rest] = matchArray;
183
+ return leadingSymbols.concat(firstLetter.toUpperCase()).concat(lowerCaseRest ? rest.toLowerCase() : rest);
184
+ }
185
+ return trimmedString.charAt(0).toUpperCase().concat(lowerCaseRest ? trimmedString.slice(1).toLowerCase() : trimmedString.slice(1));
186
+ }
187
+ /** Cache to store regex for delimiters */
188
+ const REGEX_CACHE = /* @__PURE__ */ new Map();
189
+ /** Get delimiter regex from cache if already built the regex in previous call */
190
+ function _getDelimiterRegex(delims) {
191
+ const key = delims.sort().join("");
192
+ if (!REGEX_CACHE.has(key)) REGEX_CACHE.set(key, new RegExp(`[-_./${delims.join("")}]`, "g"));
193
+ return REGEX_CACHE.get(key);
194
+ }
195
+ /** Normalizes delimiters + splits the string */
196
+ function _normalizeDelimiters(str, delims) {
197
+ const delRegExp = _getDelimiterRegex(delims);
198
+ return str.replace(/(\p{Ll}?\d+|(?<=\p{Lu}))(\p{Lu})/gu, "$1 $2").replace(delRegExp, " ").replace(/\s+/g, " ").trim().split(" ").filter(Boolean);
199
+ }
200
+ /** Capitalize a string (first letter capital, rest lowercase) */
201
+ function _capitalize(str) {
202
+ return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
203
+ }
204
+ /**
205
+ * * Converts a string into `camelCase`, using the optional custom delimiters in addition to the default delimiters.
206
+ *
207
+ * @remarks
208
+ * - This utility returns appropriate type IntelliSense with string literal. For general purpose use {@link convertStringCase}.
209
+ * - At the type level, TypeScript supports `up to 45 characters` for reliable literal inference.
210
+ * - This limitation does not affect runtime behavior but shows TypeScript compiler error.
211
+ * - Use it for short literal strings (`up to 45 characters`) for best performance.
212
+ * - It does not handle ACRONYMS properly, so be cautious when the string has ACRONYMS or use {@link convertStringCase}.
213
+ * - Custom delimiters are merged with the default set: `space`, `.`, `-`, `_`, `/`.
214
+ *
215
+ * @example
216
+ * toCamelCase("hello world") // "helloWorld"
217
+ * toCamelCase("my-awesome_string") // "myAwesomeString"
218
+ * toCamelCase("value*with+custom", "*+") // "valueWithCustom"
219
+ *
220
+ * @param str The input string to convert.
221
+ * @param del Additional delimiter characters to recognize.
222
+ * @returns The `camelCase` formatted string.
223
+ */
224
+ function toCamelCase(str, ...del) {
225
+ if (!isNonEmptyString(str)) return "";
226
+ const parts = _normalizeDelimiters(str, del);
227
+ return parts[0].toLowerCase() + parts.slice(1).map(_capitalize).join("");
228
+ }
229
+ /**
230
+ * * Converts a string into `PascalCase`, using the optional custom delimiters in addition to the default delimiters.
231
+ *
232
+ * @remarks
233
+ * - This utility returns appropriate type IntelliSense with string literal. For general purpose use {@link convertStringCase}.
234
+ * - At the type level, TypeScript supports `up to 45 characters` for reliable literal inference.
235
+ * - This limitation does not affect runtime behavior but shows TypeScript compiler error.
236
+ * - Use it for short literal strings (`up to 45 characters`) for best performance.
237
+ * - It does not handle ACRONYMS properly, so be cautious when the string has ACRONYMS or use {@link convertStringCase}.
238
+ * - Custom delimiters are merged with the default set: `space`, `.`, `-`, `_`, `/`.
239
+ *
240
+ * @example
241
+ * toPascalCase("hello world") // "HelloWorld"
242
+ * toPascalCase("my-awesome_string") // "MyAwesomeString"
243
+ * toPascalCase("value*with+custom", "*+") // "ValueWithCustom"
244
+ *
245
+ * @param str The input string to convert.
246
+ * @param del Additional delimiter characters to recognize.
247
+ * @returns The `PascalCase` formatted string.
248
+ */
249
+ function toPascalCase(str, ...del) {
250
+ return isNonEmptyString(str) ? _normalizeDelimiters(str, del).map(_capitalize).join("") : "";
251
+ }
252
+ /**
253
+ * * Converts a string into `snake_case`, using the optional custom delimiters in addition to the default delimiters.
254
+ *
255
+ * @remarks
256
+ * - This utility returns appropriate type IntelliSense with string literal. For general purpose use {@link convertStringCase}.
257
+ * - At the type level, TypeScript supports `up to 45 characters` for reliable literal inference.
258
+ * - This limitation does not affect runtime behavior but shows TypeScript compiler error.
259
+ * - Use it for short literal strings (`up to 45 characters`) for best performance.
260
+ * - Custom delimiters are merged with the default set: `space`, `.`, `-`, `_`, `/`.
261
+ *
262
+ * @example
263
+ * toSnakeCase("hello world") // "hello_world"
264
+ * toSnakeCase("my-awesome_string") // "my_awesome_string"
265
+ * toSnakeCase("value*with+custom", "*+") // "value_with_custom"
266
+ *
267
+ * @param str The input string to convert.
268
+ * @param del Additional delimiter characters to recognize.
269
+ * @returns The `snake_case` formatted string.
270
+ */
271
+ function toSnakeCase(str, ...del) {
272
+ return isNonEmptyString(str) ? _normalizeDelimiters(str, del).map((w) => w.toLowerCase()).join("_") : "";
273
+ }
274
+ /**
275
+ * * Converts a string into `kebab-case`, using the optional custom delimiters in addition to the default delimiters.
276
+ *
277
+ * @remarks
278
+ * - This utility returns appropriate type IntelliSense with string literal. For general purpose use {@link convertStringCase}.
279
+ * - At the type level, TypeScript supports `up to 45 characters` for reliable literal inference.
280
+ * - This limitation does not affect runtime behavior but shows TypeScript compiler error.
281
+ * - Use it for short literal strings (`up to 45 characters`) for best performance.
282
+ * - Custom delimiters are merged with the default set: `space`, `.`, `-`, `_`, `/`.
283
+ *
284
+ * @example
285
+ * toKebabCase("hello world") // "hello-world"
286
+ * toKebabCase("my-awesome_string") // "my-awesome-string"
287
+ * toKebabCase("value*with+custom", "*+") // "value-with-custom"
288
+ *
289
+ * @param str The input string to convert.
290
+ * @param del Additional delimiter characters to recognize.
291
+ * @returns The `kebab-case` formatted string.
292
+ */
293
+ function toKebabCase(str, ...del) {
294
+ return isNonEmptyString(str) ? _normalizeDelimiters(str, del).map((w) => w.toLowerCase()).join("-") : "";
295
+ }
296
+ /**
297
+ * * Converts a string into `Train-Case`, using the optional custom delimiters in addition to the default delimiters.
298
+ *
299
+ * @remarks
300
+ * - At the type level, TypeScript supports `up to 45 characters` for reliable literal inference.
301
+ * - This limitation does not affect runtime behavior but shows TypeScript compiler error.
302
+ * - Use it for short literal strings (`up to 45 characters`) for best performance.
303
+ * - Custom delimiters are merged with the default set: `space`, `.`, `-`, `_`, `/`.
304
+ *
305
+ * @example
306
+ * toTrainCase("hello world") // "Hello-World"
307
+ * toTrainCase("my-awesome_string") // "My-Awesome-String"
308
+ * toTrainCase("value*with+custom", "*+") // "Value-With-Custom"
309
+ *
310
+ * @param str The input string to convert.
311
+ * @param del Additional delimiter characters to recognize.
312
+ * @returns The `Train-Case` formatted string.
313
+ */
314
+ function toTrainCase(str, ...del) {
315
+ return isNonEmptyString(str) ? _normalizeDelimiters(str, del).map(_capitalize).join("-") : "";
316
+ }
317
+ /**
318
+ * * Converts a string into `dot.case`, using the optional custom delimiters in addition to the default delimiters.
319
+ *
320
+ * @remarks
321
+ * - At the type level, TypeScript supports `up to 45 characters` for reliable literal inference.
322
+ * - This limitation does not affect runtime behavior but shows TypeScript compiler error.
323
+ * - Use it for short literal strings (`up to 45 characters`) for best performance.
324
+ * - Custom delimiters are merged with the default set: `space`, `.`, `-`, `_`, `/`.
325
+ *
326
+ * @example
327
+ * toDotCase("hello world") // "hello.world"
328
+ * toDotCase("my-awesome_string") // "my.awesome.string"
329
+ * toDotCase("value*with+custom", "*+") // "value.with.custom"
330
+ *
331
+ * @param str The input string to convert.
332
+ * @param del Additional delimiter characters to recognize.
333
+ * @returns The `dot.case` formatted string.
334
+ */
335
+ function toDotCase(str, ...del) {
336
+ return isNonEmptyString(str) ? _normalizeDelimiters(str, del).join(".") : "";
337
+ }
338
+ /**
339
+ * * Converts a string into `path/case`, using the optional custom delimiters in addition to the default delimiters.
340
+ *
341
+ * @remarks
342
+ * - At the type level, TypeScript supports `up to 45 characters` for reliable literal inference.
343
+ * - This limitation does not affect runtime behavior but shows TypeScript compiler error.
344
+ * - Use it for short literal strings (`up to 45 characters`) for best performance.
345
+ * - Custom delimiters are merged with the default set: `space`, `.`, `-`, `_`, `/`.
346
+ *
347
+ * @example
348
+ * toPathCase("hello world") // "hello/world"
349
+ * toPathCase("my-awesome_string") // "my/awesome/string"
350
+ * toPathCase("value*with+custom", "*+") // "value/with/custom"
351
+ *
352
+ * @param str The input string to convert.
353
+ * @param del Additional delimiter characters to recognize.
354
+ * @returns The `path/case` formatted string.
355
+ */
356
+ function toPathCase(str, ...del) {
357
+ return isNonEmptyString(str) ? _normalizeDelimiters(str, del).map((w) => w.toLowerCase()).join("/") : "";
358
+ }
359
+ /**
360
+ * * Converts a string into `CONSTANT_CASE`, using the optional custom delimiters in addition to the default delimiters.
361
+ *
362
+ * @remarks
363
+ * - At the type level, TypeScript supports `up to 45 characters` for reliable literal inference.
364
+ * - This limitation does not affect runtime behavior but shows TypeScript compiler error.
365
+ * - Use it for short literal strings (`up to 45 characters`) for best performance.
366
+ * - Custom delimiters are merged with the default set: `space`, `.`, `-`, `_`, `/`.
367
+ *
368
+ * @example
369
+ * toConstantCase("hello world") // "HELLO_WORLD"
370
+ * toConstantCase("my-awesome_string") // "MY_AWESOME_STRING"
371
+ * toConstantCase("value*with+custom", "*+") // "VALUE_WITH_CUSTOM"
372
+ *
373
+ * @param str The input string to convert.
374
+ * @param del Additional delimiter characters to recognize.
375
+ * @returns The `CONSTANT_CASE` formatted string.
376
+ */
377
+ function toConstantCase(str, ...del) {
378
+ return isNonEmptyString(str) ? _normalizeDelimiters(str, del).map((w) => w.toUpperCase()).join("_") : "";
379
+ }
380
+ /**
381
+ * * Converts a string into `Pascal_Snake_Case`, using the optional custom delimiters in addition to the default delimiters.
382
+ *
383
+ * @remarks
384
+ * - At the type level, TypeScript supports `up to 45 characters` for reliable literal inference.
385
+ * - This limitation does not affect runtime behavior but shows TypeScript compiler error.
386
+ * - Use it for short literal strings (`up to 45 characters`) for best performance.
387
+ * - Custom delimiters are merged with the default set: `space`, `.`, `-`, `_`, `/`.
388
+ *
389
+ * @example
390
+ * toPascalSnakeCase("hello world") // "Hello_World"
391
+ * toPascalSnakeCase("my-awesome_string") // "My_Awesome_String"
392
+ * toPascalSnakeCase("value*with+custom", "*+") // "Value_With_Custom"
393
+ *
394
+ * @param str The input string to convert.
395
+ * @param del Additional delimiter characters to recognize.
396
+ * @returns The `Pascal_Snake_Case` formatted string.
397
+ */
398
+ function toPascalSnakeCase(str, ...del) {
399
+ return isNonEmptyString(str) ? _normalizeDelimiters(str, del).map(_capitalize).join("_") : "";
400
+ }
401
+ /**
402
+ * * Converts a string into `Title Case`, using the optional custom delimiters in addition to the default delimiters.
403
+ *
404
+ * @remarks
405
+ * - This utility returns appropriate type IntelliSense with string literal. For general purpose use {@link convertStringCase}.
406
+ * - At the type level, TypeScript supports `up to 45 characters` for reliable literal inference.
407
+ * - This limitation does not affect runtime behavior but shows TypeScript compiler error.
408
+ * - Use it for short literal strings (`up to 45 characters`) for best performance.
409
+ * - It does not handle ACRONYMS properly, so be cautious when the string has ACRONYMS or use {@link convertStringCase}.
410
+ * - Custom delimiters are merged with the default set: `space`, `.`, `-`, `_`, `/`.
411
+ *
412
+ * @example
413
+ * toTitleCase("hello world") // "Hello World"
414
+ * toTitleCase("my-awesome_string") // "My Awesome String"
415
+ * toTitleCase("value*with+custom", "*+") // "Value with Custom"
416
+ *
417
+ * @param str The input string to convert.
418
+ * @param del Additional delimiter characters to recognize.
419
+ * @returns The `Title Case` formatted string.
420
+ */
421
+ function toTitleCase(str, ...del) {
422
+ return isNonEmptyString(str) ? _normalizeDelimiters(str, del).map((w, i) => i !== 0 && smallSet.has(w) ? w.toLowerCase() : _capitalize(w)).join(" ") : "";
423
+ }
424
+ /**
425
+ * * Converts a string into `Sentence case`, using the optional custom delimiters in addition to the default delimiters.
426
+ *
427
+ * @remarks
428
+ * - This utility returns appropriate type IntelliSense with string literal. For general purpose use {@link convertStringCase}.
429
+ * - At the type level, TypeScript supports `up to 45 characters` for reliable literal inference.
430
+ * - This limitation does not affect runtime behavior but shows TypeScript compiler error.
431
+ * - Use it for short literal strings (`up to 45 characters`) for best performance.
432
+ * - It does not handle ACRONYMS properly, so be cautious when the string has ACRONYMS or use {@link convertStringCase}.
433
+ * - Custom delimiters are merged with the default set: `space`, `.`, `-`, `_`, `/`.
434
+ *
435
+ * @example
436
+ * toSentenceCase("hello world") // "Hello world"
437
+ * toSentenceCase("my-awesome_string") // "My awesome string"
438
+ * toSentenceCase("value*with+custom", "*+") // "Value with custom"
439
+ *
440
+ * @param str The input string to convert.
441
+ * @param del Additional delimiter characters to recognize.
442
+ * @returns The `Sentence case` formatted string.
443
+ */
444
+ function toSentenceCase(str, ...del) {
445
+ return isNonEmptyString(str) ? _normalizeDelimiters(str, del).map((w, i) => i === 0 ? _capitalize(w) : w.toLowerCase()).join(" ") : "";
446
+ }
447
+
448
+ //#endregion
449
+ export { toDotCase as a, toPascalSnakeCase as c, toSnakeCase as d, toTitleCase as f, toConstantCase as i, toPathCase as l, convertStringCase as n, toKebabCase as o, toTrainCase as p, toCamelCase as r, toPascalCase as s, capitalizeString as t, toSentenceCase as u };