es-toolkit 1.9.0-dev.180 → 1.9.0-dev.181

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 (37) hide show
  1. package/dist/array/index.mjs +28 -28
  2. package/dist/{chunk-VRFIBW4H.mjs → chunk-47QP3LTV.mjs} +2 -2
  3. package/dist/chunk-I3SYACZ3.mjs +1 -0
  4. package/dist/{chunk-T5URDZEQ.mjs → chunk-IJJCMZIV.mjs} +2 -2
  5. package/dist/{chunk-T5URDZEQ.mjs.map → chunk-IJJCMZIV.mjs.map} +1 -1
  6. package/dist/chunk-XWJ7NQF4.mjs +14 -0
  7. package/dist/chunk-XWJ7NQF4.mjs.map +1 -0
  8. package/dist/constants/caseSplitPattern.js +1 -1
  9. package/dist/constants/caseSplitPattern.js.map +1 -1
  10. package/dist/constants/caseSplitPattern.mjs +1 -1
  11. package/dist/constants/index.js +1 -1
  12. package/dist/constants/index.js.map +1 -1
  13. package/dist/constants/index.mjs +1 -1
  14. package/dist/function/index.mjs +6 -6
  15. package/dist/index.d.mts +1 -0
  16. package/dist/index.d.ts +1 -0
  17. package/dist/index.js +9 -1
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.mjs +44 -40
  20. package/dist/string/index.d.mts +1 -0
  21. package/dist/string/index.d.ts +1 -0
  22. package/dist/string/index.js +9 -1
  23. package/dist/string/index.js.map +1 -1
  24. package/dist/string/index.mjs +7 -3
  25. package/dist/string/kebabCase.d.mts +17 -0
  26. package/dist/string/kebabCase.d.ts +17 -0
  27. package/dist/string/kebabCase.js +39 -0
  28. package/dist/string/kebabCase.js.map +1 -0
  29. package/dist/string/kebabCase.mjs +10 -0
  30. package/dist/string/kebabCase.mjs.map +1 -0
  31. package/dist/string/snakeCase.js +1 -1
  32. package/dist/string/snakeCase.js.map +1 -1
  33. package/dist/string/snakeCase.mjs +2 -2
  34. package/package.json +1 -1
  35. package/dist/chunk-MPBVTIU3.mjs +0 -1
  36. /package/dist/{chunk-VRFIBW4H.mjs.map → chunk-47QP3LTV.mjs.map} +0 -0
  37. /package/dist/{chunk-MPBVTIU3.mjs.map → chunk-I3SYACZ3.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -2,13 +2,16 @@ import "./chunk-ARZ5BDR6.mjs";
2
2
  import {
3
3
  delay
4
4
  } from "./chunk-O64NE2P4.mjs";
5
- import "./chunk-MPBVTIU3.mjs";
5
+ import "./chunk-I3SYACZ3.mjs";
6
6
  import {
7
7
  capitalize
8
8
  } from "./chunk-U56ZOM7L.mjs";
9
+ import {
10
+ kebabCase
11
+ } from "./chunk-XWJ7NQF4.mjs";
9
12
  import {
10
13
  snakeCase
11
- } from "./chunk-VRFIBW4H.mjs";
14
+ } from "./chunk-47QP3LTV.mjs";
12
15
  import "./chunk-MAJSPFA6.mjs";
13
16
  import {
14
17
  isUndefined
@@ -38,10 +41,6 @@ import {
38
41
  import {
39
42
  invert
40
43
  } from "./chunk-74WWMNZS.mjs";
41
- import "./chunk-FZEZH22H.mjs";
42
- import {
43
- AbortError
44
- } from "./chunk-DXB7EZUQ.mjs";
45
44
  import "./chunk-TLVQSNOE.mjs";
46
45
  import {
47
46
  meanBy
@@ -65,12 +64,21 @@ import {
65
64
  sum
66
65
  } from "./chunk-2SLTL4KL.mjs";
67
66
  import "./chunk-OJSIDS6H.mjs";
67
+ import {
68
+ xorWith
69
+ } from "./chunk-QRSJBBFY.mjs";
70
+ import {
71
+ zip
72
+ } from "./chunk-IDCUZVJL.mjs";
68
73
  import {
69
74
  zipObject
70
75
  } from "./chunk-6GWEY5EL.mjs";
71
76
  import {
72
77
  zipWith
73
78
  } from "./chunk-4KYXHZ4R.mjs";
79
+ import {
80
+ uniqBy
81
+ } from "./chunk-OXAZEEGP.mjs";
74
82
  import {
75
83
  unzip
76
84
  } from "./chunk-UYZKMBDO.mjs";
@@ -87,11 +95,11 @@ import {
87
95
  xorBy
88
96
  } from "./chunk-Q47NGNXT.mjs";
89
97
  import {
90
- xorWith
91
- } from "./chunk-QRSJBBFY.mjs";
98
+ take
99
+ } from "./chunk-ME352XO7.mjs";
92
100
  import {
93
- zip
94
- } from "./chunk-IDCUZVJL.mjs";
101
+ takeRight
102
+ } from "./chunk-IQLKIDXF.mjs";
95
103
  import {
96
104
  takeRightWhile
97
105
  } from "./chunk-NTLX2MPV.mjs";
@@ -104,6 +112,9 @@ import {
104
112
  import {
105
113
  union
106
114
  } from "./chunk-R6QA7PLZ.mjs";
115
+ import {
116
+ uniq
117
+ } from "./chunk-DVK2N4KC.mjs";
107
118
  import {
108
119
  unionBy
109
120
  } from "./chunk-NFS7RWWE.mjs";
@@ -114,11 +125,11 @@ import {
114
125
  uniqWith
115
126
  } from "./chunk-237HGSZS.mjs";
116
127
  import {
117
- uniq
118
- } from "./chunk-DVK2N4KC.mjs";
128
+ maxBy
129
+ } from "./chunk-OOKNBU4V.mjs";
119
130
  import {
120
- uniqBy
121
- } from "./chunk-OXAZEEGP.mjs";
131
+ minBy
132
+ } from "./chunk-IJD7FE2Z.mjs";
122
133
  import {
123
134
  orderBy
124
135
  } from "./chunk-7B7W36UP.mjs";
@@ -144,11 +155,11 @@ import {
144
155
  tail
145
156
  } from "./chunk-OF6NM4G7.mjs";
146
157
  import {
147
- take
148
- } from "./chunk-ME352XO7.mjs";
158
+ groupBy
159
+ } from "./chunk-E6E4RZLN.mjs";
149
160
  import {
150
- takeRight
151
- } from "./chunk-IQLKIDXF.mjs";
161
+ head
162
+ } from "./chunk-HM2JT2RX.mjs";
152
163
  import {
153
164
  intersection
154
165
  } from "./chunk-FVVSE2F2.mjs";
@@ -165,11 +176,11 @@ import {
165
176
  last
166
177
  } from "./chunk-KPBQ7OUY.mjs";
167
178
  import {
168
- maxBy
169
- } from "./chunk-OOKNBU4V.mjs";
179
+ drop
180
+ } from "./chunk-S3CORED5.mjs";
170
181
  import {
171
- minBy
172
- } from "./chunk-IJD7FE2Z.mjs";
182
+ dropRight
183
+ } from "./chunk-JEKUA56R.mjs";
173
184
  import {
174
185
  dropRightWhile
175
186
  } from "./chunk-JE6JKZU3.mjs";
@@ -188,12 +199,6 @@ import {
188
199
  import {
189
200
  forEachRight
190
201
  } from "./chunk-IEA53J7P.mjs";
191
- import {
192
- groupBy
193
- } from "./chunk-E6E4RZLN.mjs";
194
- import {
195
- head
196
- } from "./chunk-HM2JT2RX.mjs";
197
202
  import {
198
203
  chunk
199
204
  } from "./chunk-E6C5EZQA.mjs";
@@ -212,27 +217,25 @@ import {
212
217
  import {
213
218
  differenceWith
214
219
  } from "./chunk-6NVQAHXP.mjs";
220
+ import "./chunk-FZEZH22H.mjs";
215
221
  import {
216
- drop
217
- } from "./chunk-S3CORED5.mjs";
218
- import {
219
- dropRight
220
- } from "./chunk-JEKUA56R.mjs";
222
+ AbortError
223
+ } from "./chunk-DXB7EZUQ.mjs";
221
224
  import "./chunk-2M3YVRFS.mjs";
222
- import "./chunk-T5URDZEQ.mjs";
225
+ import "./chunk-IJJCMZIV.mjs";
223
226
  import "./chunk-N6EM6ETS.mjs";
224
- import {
225
- debounce
226
- } from "./chunk-3IP4JVLL.mjs";
227
- import {
228
- noop
229
- } from "./chunk-LKXCOLNY.mjs";
230
227
  import {
231
228
  once
232
229
  } from "./chunk-CMBC4MXG.mjs";
233
230
  import {
234
231
  throttle
235
232
  } from "./chunk-QOJGMVVR.mjs";
233
+ import {
234
+ debounce
235
+ } from "./chunk-3IP4JVLL.mjs";
236
+ import {
237
+ noop
238
+ } from "./chunk-LKXCOLNY.mjs";
236
239
  import "./chunk-2MM5EJJX.mjs";
237
240
  export {
238
241
  AbortError,
@@ -265,6 +268,7 @@ export {
265
268
  isNotNil,
266
269
  isNull,
267
270
  isUndefined,
271
+ kebabCase,
268
272
  keyBy,
269
273
  last,
270
274
  maxBy,
@@ -1,2 +1,3 @@
1
1
  export { snakeCase } from './snakeCase.mjs';
2
+ export { kebabCase } from './kebabCase.mjs';
2
3
  export { capitalize } from './capitalize.mjs';
@@ -1,2 +1,3 @@
1
1
  export { snakeCase } from './snakeCase.js';
2
+ export { kebabCase } from './kebabCase.js';
2
3
  export { capitalize } from './capitalize.js';
@@ -21,12 +21,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var string_exports = {};
22
22
  __export(string_exports, {
23
23
  capitalize: () => capitalize,
24
+ kebabCase: () => kebabCase,
24
25
  snakeCase: () => snakeCase
25
26
  });
26
27
  module.exports = __toCommonJS(string_exports);
27
28
 
28
29
  // src/constants/caseSplitPattern.ts
29
- var CASE_SPLIT_PATTERN = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g;
30
+ var CASE_SPLIT_PATTERN = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]+|[0-9]+/g;
30
31
 
31
32
  // src/string/snakeCase.ts
32
33
  var snakeCase = (str) => {
@@ -34,6 +35,12 @@ var snakeCase = (str) => {
34
35
  return splitWords.map((word) => word.toLowerCase()).join("_");
35
36
  };
36
37
 
38
+ // src/string/kebabCase.ts
39
+ var kebabCase = (str) => {
40
+ const splitWords = str.match(CASE_SPLIT_PATTERN) || [];
41
+ return splitWords.map((word) => word.toLowerCase()).join("-");
42
+ };
43
+
37
44
  // src/string/capitalize.ts
38
45
  var capitalize = (str) => {
39
46
  return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
@@ -41,6 +48,7 @@ var capitalize = (str) => {
41
48
  // Annotate the CommonJS export names for ESM import in node:
42
49
  0 && (module.exports = {
43
50
  capitalize,
51
+ kebabCase,
44
52
  snakeCase
45
53
  });
46
54
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/string/index.ts","../../src/constants/caseSplitPattern.ts","../../src/string/snakeCase.ts","../../src/string/capitalize.ts"],"sourcesContent":["export { snakeCase } from './snakeCase.ts';\nexport { capitalize } from './capitalize.ts';\n","/**\n * Regular expression pattern to split strings into words for various case conversions\n *\n * This pattern matchs sequences of characters in a string, considering the following case:\n * - Sequences of two or more uppercase letters followed by an uppercase letter and lowercase letters or digits (for acronyms)\n * - Sequences of one uppercase letter optionally followed by lowercase letters and digits\n * - Single uppercase letters\n * - Sequences of digis\n *\n * The resulting match can be used to convert camelCase, snake_case, kebab-case, and other mixed formats into\n * a consistent format like snake case.\n *\n * @example\n * const matches = 'camelCaseHTTPRequest'.match(CASE_SPLIT_PATTERN);\n * // matchs: ['camel', 'Case', 'HTTP', 'Request']\n */\n\nexport const CASE_SPLIT_PATTERN = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g;\n","import { CASE_SPLIT_PATTERN } from '../constants';\n\n/**\n * Converts a string to snake case.\n *\n * Snake case is the naming convention in which each word is written in lowercase and separated by an underscore (_) character.\n *\n * @param {string} str - The string that is to be changed to snake case.\n * @returns {string} - The converted string to snake case.\n *\n * @example\n * const convertedStr1 = snakeCase('camelCase') // returns 'camel_case'\n * const convertedStr2 = snakeCase('some whitespace') // returns 'some_whitespace'\n * const convertedStr3 = snakeCase('hyphen-text') // returns 'hyphen_text'\n * const convertedStr4 = snakeCase('HTTPRequest') // returns 'http_request'\n */\n\nexport const snakeCase = (str: string): string => {\n const splitWords = str.match(CASE_SPLIT_PATTERN) || [];\n return splitWords.map(word => word.toLowerCase()).join('_');\n};\n","/**\n * Converts the first character of string to upper case and the remaining to lower case.\n *\n * @template T - Literal type of the string.\n * @param {T} str - The string to be converted to uppercase.\n * @returns {Capitalize<T>} - The capitalized string.\n *\n * @example\n * const result = capitalize('fred') // returns 'Fred'\n * const result2 = capitalize('FRED') // returns 'Fred'\n */\n\nexport const capitalize = <T extends string>(str: T): Capitalize<T> => {\n return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()) as Capitalize<T>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,IAAM,qBAAqB;;;ACA3B,IAAM,YAAY,CAAC,QAAwB;AAChD,QAAM,aAAa,IAAI,MAAM,kBAAkB,KAAK,CAAC;AACrD,SAAO,WAAW,IAAI,UAAQ,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG;AAC5D;;;ACRO,IAAM,aAAa,CAAmB,QAA0B;AACrE,SAAQ,IAAI,OAAO,CAAC,EAAE,YAAY,IAAI,IAAI,MAAM,CAAC,EAAE,YAAY;AACjE;","names":[]}
1
+ {"version":3,"sources":["../../src/string/index.ts","../../src/constants/caseSplitPattern.ts","../../src/string/snakeCase.ts","../../src/string/kebabCase.ts","../../src/string/capitalize.ts"],"sourcesContent":["export { snakeCase } from './snakeCase.ts';\nexport { kebabCase } from './kebabCase.ts';\nexport { capitalize } from './capitalize.ts';\n","/**\n * Regular expression pattern to split strings into words for various case conversions\n *\n * This pattern matchs sequences of characters in a string, considering the following case:\n * - Sequences of two or more uppercase letters followed by an uppercase letter and lowercase letters or digits (for acronyms)\n * - Sequences of one uppercase letter optionally followed by lowercase letters and digits\n * - Single uppercase letters\n * - Sequences of digis\n *\n * The resulting match can be used to convert camelCase, snake_case, kebab-case, and other mixed formats into\n * a consistent format like snake case.\n *\n * @example\n * const matches = 'camelCaseHTTPRequest'.match(CASE_SPLIT_PATTERN);\n * // matchs: ['camel', 'Case', 'HTTP', 'Request']\n */\n\nexport const CASE_SPLIT_PATTERN = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]+|[0-9]+/g;\n","import { CASE_SPLIT_PATTERN } from '../constants';\n\n/**\n * Converts a string to snake case.\n *\n * Snake case is the naming convention in which each word is written in lowercase and separated by an underscore (_) character.\n *\n * @param {string} str - The string that is to be changed to snake case.\n * @returns {string} - The converted string to snake case.\n *\n * @example\n * const convertedStr1 = snakeCase('camelCase') // returns 'camel_case'\n * const convertedStr2 = snakeCase('some whitespace') // returns 'some_whitespace'\n * const convertedStr3 = snakeCase('hyphen-text') // returns 'hyphen_text'\n * const convertedStr4 = snakeCase('HTTPRequest') // returns 'http_request'\n */\n\nexport const snakeCase = (str: string): string => {\n const splitWords = str.match(CASE_SPLIT_PATTERN) || [];\n return splitWords.map(word => word.toLowerCase()).join('_');\n};\n","import { CASE_SPLIT_PATTERN } from '../constants';\n\n/**\n * Converts a string to kebab case.\n *\n * Kebab case is the naming convention in which each word is written in lowercase and separated by a dash (-) character.\n *\n * @param {string} str - The string that is to be changed to kebab case.\n * @returns {string} - The converted string to kebab case.\n *\n * @example\n * const convertedStr1 = kebabCase('camelCase') // returns 'camel-case'\n * const convertedStr2 = kebabCase('some whitespace') // returns 'some-whitespace'\n * const convertedStr3 = kebabCase('hyphen-text') // returns 'hyphen-text'\n * const convertedStr4 = kebabCase('HTTPRequest') // returns 'http-request'\n */\n\nexport const kebabCase = (str: string): string => {\n const splitWords = str.match(CASE_SPLIT_PATTERN) || [];\n return splitWords.map(word => word.toLowerCase()).join('-');\n};\n","/**\n * Converts the first character of string to upper case and the remaining to lower case.\n *\n * @template T - Literal type of the string.\n * @param {T} str - The string to be converted to uppercase.\n * @returns {Capitalize<T>} - The capitalized string.\n *\n * @example\n * const result = capitalize('fred') // returns 'Fred'\n * const result2 = capitalize('FRED') // returns 'Fred'\n */\n\nexport const capitalize = <T extends string>(str: T): Capitalize<T> => {\n return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()) as Capitalize<T>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,IAAM,qBAAqB;;;ACA3B,IAAM,YAAY,CAAC,QAAwB;AAChD,QAAM,aAAa,IAAI,MAAM,kBAAkB,KAAK,CAAC;AACrD,SAAO,WAAW,IAAI,UAAQ,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG;AAC5D;;;ACHO,IAAM,YAAY,CAAC,QAAwB;AAChD,QAAM,aAAa,IAAI,MAAM,kBAAkB,KAAK,CAAC;AACrD,SAAO,WAAW,IAAI,UAAQ,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG;AAC5D;;;ACRO,IAAM,aAAa,CAAmB,QAA0B;AACrE,SAAQ,IAAI,OAAO,CAAC,EAAE,YAAY,IAAI,IAAI,MAAM,CAAC,EAAE,YAAY;AACjE;","names":[]}
@@ -1,15 +1,19 @@
1
- import "../chunk-MPBVTIU3.mjs";
1
+ import "../chunk-I3SYACZ3.mjs";
2
2
  import {
3
3
  capitalize
4
4
  } from "../chunk-U56ZOM7L.mjs";
5
+ import {
6
+ kebabCase
7
+ } from "../chunk-XWJ7NQF4.mjs";
5
8
  import {
6
9
  snakeCase
7
- } from "../chunk-VRFIBW4H.mjs";
10
+ } from "../chunk-47QP3LTV.mjs";
8
11
  import "../chunk-2M3YVRFS.mjs";
9
- import "../chunk-T5URDZEQ.mjs";
12
+ import "../chunk-IJJCMZIV.mjs";
10
13
  import "../chunk-2MM5EJJX.mjs";
11
14
  export {
12
15
  capitalize,
16
+ kebabCase,
13
17
  snakeCase
14
18
  };
15
19
  //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Converts a string to kebab case.
3
+ *
4
+ * Kebab case is the naming convention in which each word is written in lowercase and separated by a dash (-) character.
5
+ *
6
+ * @param {string} str - The string that is to be changed to kebab case.
7
+ * @returns {string} - The converted string to kebab case.
8
+ *
9
+ * @example
10
+ * const convertedStr1 = kebabCase('camelCase') // returns 'camel-case'
11
+ * const convertedStr2 = kebabCase('some whitespace') // returns 'some-whitespace'
12
+ * const convertedStr3 = kebabCase('hyphen-text') // returns 'hyphen-text'
13
+ * const convertedStr4 = kebabCase('HTTPRequest') // returns 'http-request'
14
+ */
15
+ declare const kebabCase: (str: string) => string;
16
+
17
+ export { kebabCase };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Converts a string to kebab case.
3
+ *
4
+ * Kebab case is the naming convention in which each word is written in lowercase and separated by a dash (-) character.
5
+ *
6
+ * @param {string} str - The string that is to be changed to kebab case.
7
+ * @returns {string} - The converted string to kebab case.
8
+ *
9
+ * @example
10
+ * const convertedStr1 = kebabCase('camelCase') // returns 'camel-case'
11
+ * const convertedStr2 = kebabCase('some whitespace') // returns 'some-whitespace'
12
+ * const convertedStr3 = kebabCase('hyphen-text') // returns 'hyphen-text'
13
+ * const convertedStr4 = kebabCase('HTTPRequest') // returns 'http-request'
14
+ */
15
+ declare const kebabCase: (str: string) => string;
16
+
17
+ export { kebabCase };
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/string/kebabCase.ts
21
+ var kebabCase_exports = {};
22
+ __export(kebabCase_exports, {
23
+ kebabCase: () => kebabCase
24
+ });
25
+ module.exports = __toCommonJS(kebabCase_exports);
26
+
27
+ // src/constants/caseSplitPattern.ts
28
+ var CASE_SPLIT_PATTERN = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]+|[0-9]+/g;
29
+
30
+ // src/string/kebabCase.ts
31
+ var kebabCase = (str) => {
32
+ const splitWords = str.match(CASE_SPLIT_PATTERN) || [];
33
+ return splitWords.map((word) => word.toLowerCase()).join("-");
34
+ };
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ kebabCase
38
+ });
39
+ //# sourceMappingURL=kebabCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/string/kebabCase.ts","../../src/constants/caseSplitPattern.ts"],"sourcesContent":["import { CASE_SPLIT_PATTERN } from '../constants';\n\n/**\n * Converts a string to kebab case.\n *\n * Kebab case is the naming convention in which each word is written in lowercase and separated by a dash (-) character.\n *\n * @param {string} str - The string that is to be changed to kebab case.\n * @returns {string} - The converted string to kebab case.\n *\n * @example\n * const convertedStr1 = kebabCase('camelCase') // returns 'camel-case'\n * const convertedStr2 = kebabCase('some whitespace') // returns 'some-whitespace'\n * const convertedStr3 = kebabCase('hyphen-text') // returns 'hyphen-text'\n * const convertedStr4 = kebabCase('HTTPRequest') // returns 'http-request'\n */\n\nexport const kebabCase = (str: string): string => {\n const splitWords = str.match(CASE_SPLIT_PATTERN) || [];\n return splitWords.map(word => word.toLowerCase()).join('-');\n};\n","/**\n * Regular expression pattern to split strings into words for various case conversions\n *\n * This pattern matchs sequences of characters in a string, considering the following case:\n * - Sequences of two or more uppercase letters followed by an uppercase letter and lowercase letters or digits (for acronyms)\n * - Sequences of one uppercase letter optionally followed by lowercase letters and digits\n * - Single uppercase letters\n * - Sequences of digis\n *\n * The resulting match can be used to convert camelCase, snake_case, kebab-case, and other mixed formats into\n * a consistent format like snake case.\n *\n * @example\n * const matches = 'camelCaseHTTPRequest'.match(CASE_SPLIT_PATTERN);\n * // matchs: ['camel', 'Case', 'HTTP', 'Request']\n */\n\nexport const CASE_SPLIT_PATTERN = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]+|[0-9]+/g;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,IAAM,qBAAqB;;;ADA3B,IAAM,YAAY,CAAC,QAAwB;AAChD,QAAM,aAAa,IAAI,MAAM,kBAAkB,KAAK,CAAC;AACrD,SAAO,WAAW,IAAI,UAAQ,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG;AAC5D;","names":[]}
@@ -0,0 +1,10 @@
1
+ import {
2
+ kebabCase
3
+ } from "../chunk-XWJ7NQF4.mjs";
4
+ import "../chunk-2M3YVRFS.mjs";
5
+ import "../chunk-IJJCMZIV.mjs";
6
+ import "../chunk-2MM5EJJX.mjs";
7
+ export {
8
+ kebabCase
9
+ };
10
+ //# sourceMappingURL=kebabCase.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -25,7 +25,7 @@ __export(snakeCase_exports, {
25
25
  module.exports = __toCommonJS(snakeCase_exports);
26
26
 
27
27
  // src/constants/caseSplitPattern.ts
28
- var CASE_SPLIT_PATTERN = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g;
28
+ var CASE_SPLIT_PATTERN = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]+|[0-9]+/g;
29
29
 
30
30
  // src/string/snakeCase.ts
31
31
  var snakeCase = (str) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/string/snakeCase.ts","../../src/constants/caseSplitPattern.ts"],"sourcesContent":["import { CASE_SPLIT_PATTERN } from '../constants';\n\n/**\n * Converts a string to snake case.\n *\n * Snake case is the naming convention in which each word is written in lowercase and separated by an underscore (_) character.\n *\n * @param {string} str - The string that is to be changed to snake case.\n * @returns {string} - The converted string to snake case.\n *\n * @example\n * const convertedStr1 = snakeCase('camelCase') // returns 'camel_case'\n * const convertedStr2 = snakeCase('some whitespace') // returns 'some_whitespace'\n * const convertedStr3 = snakeCase('hyphen-text') // returns 'hyphen_text'\n * const convertedStr4 = snakeCase('HTTPRequest') // returns 'http_request'\n */\n\nexport const snakeCase = (str: string): string => {\n const splitWords = str.match(CASE_SPLIT_PATTERN) || [];\n return splitWords.map(word => word.toLowerCase()).join('_');\n};\n","/**\n * Regular expression pattern to split strings into words for various case conversions\n *\n * This pattern matchs sequences of characters in a string, considering the following case:\n * - Sequences of two or more uppercase letters followed by an uppercase letter and lowercase letters or digits (for acronyms)\n * - Sequences of one uppercase letter optionally followed by lowercase letters and digits\n * - Single uppercase letters\n * - Sequences of digis\n *\n * The resulting match can be used to convert camelCase, snake_case, kebab-case, and other mixed formats into\n * a consistent format like snake case.\n *\n * @example\n * const matches = 'camelCaseHTTPRequest'.match(CASE_SPLIT_PATTERN);\n * // matchs: ['camel', 'Case', 'HTTP', 'Request']\n */\n\nexport const CASE_SPLIT_PATTERN = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,IAAM,qBAAqB;;;ADA3B,IAAM,YAAY,CAAC,QAAwB;AAChD,QAAM,aAAa,IAAI,MAAM,kBAAkB,KAAK,CAAC;AACrD,SAAO,WAAW,IAAI,UAAQ,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG;AAC5D;","names":[]}
1
+ {"version":3,"sources":["../../src/string/snakeCase.ts","../../src/constants/caseSplitPattern.ts"],"sourcesContent":["import { CASE_SPLIT_PATTERN } from '../constants';\n\n/**\n * Converts a string to snake case.\n *\n * Snake case is the naming convention in which each word is written in lowercase and separated by an underscore (_) character.\n *\n * @param {string} str - The string that is to be changed to snake case.\n * @returns {string} - The converted string to snake case.\n *\n * @example\n * const convertedStr1 = snakeCase('camelCase') // returns 'camel_case'\n * const convertedStr2 = snakeCase('some whitespace') // returns 'some_whitespace'\n * const convertedStr3 = snakeCase('hyphen-text') // returns 'hyphen_text'\n * const convertedStr4 = snakeCase('HTTPRequest') // returns 'http_request'\n */\n\nexport const snakeCase = (str: string): string => {\n const splitWords = str.match(CASE_SPLIT_PATTERN) || [];\n return splitWords.map(word => word.toLowerCase()).join('_');\n};\n","/**\n * Regular expression pattern to split strings into words for various case conversions\n *\n * This pattern matchs sequences of characters in a string, considering the following case:\n * - Sequences of two or more uppercase letters followed by an uppercase letter and lowercase letters or digits (for acronyms)\n * - Sequences of one uppercase letter optionally followed by lowercase letters and digits\n * - Single uppercase letters\n * - Sequences of digis\n *\n * The resulting match can be used to convert camelCase, snake_case, kebab-case, and other mixed formats into\n * a consistent format like snake case.\n *\n * @example\n * const matches = 'camelCaseHTTPRequest'.match(CASE_SPLIT_PATTERN);\n * // matchs: ['camel', 'Case', 'HTTP', 'Request']\n */\n\nexport const CASE_SPLIT_PATTERN = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]+|[0-9]+/g;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,IAAM,qBAAqB;;;ADA3B,IAAM,YAAY,CAAC,QAAwB;AAChD,QAAM,aAAa,IAAI,MAAM,kBAAkB,KAAK,CAAC;AACrD,SAAO,WAAW,IAAI,UAAQ,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG;AAC5D;","names":[]}
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  snakeCase
3
- } from "../chunk-VRFIBW4H.mjs";
3
+ } from "../chunk-47QP3LTV.mjs";
4
4
  import "../chunk-2M3YVRFS.mjs";
5
- import "../chunk-T5URDZEQ.mjs";
5
+ import "../chunk-IJJCMZIV.mjs";
6
6
  import "../chunk-2MM5EJJX.mjs";
7
7
  export {
8
8
  snakeCase
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "es-toolkit",
3
3
  "description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
4
- "version": "1.9.0-dev.180+e9ede743",
4
+ "version": "1.9.0-dev.181+541b89dc",
5
5
  "homepage": "https://es-toolkit.slash.page",
6
6
  "bugs": "https://github.com/toss/es-toolkit/issues",
7
7
  "repository": {
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-MPBVTIU3.mjs.map