es-toolkit 1.9.0-dev.180 → 1.9.0-dev.182
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/array/index.mjs +28 -28
- package/dist/{chunk-VRFIBW4H.mjs → chunk-47QP3LTV.mjs} +2 -2
- package/dist/chunk-HXGADE4C.mjs +1 -0
- package/dist/{chunk-T5URDZEQ.mjs → chunk-IJJCMZIV.mjs} +2 -2
- package/dist/{chunk-T5URDZEQ.mjs.map → chunk-IJJCMZIV.mjs.map} +1 -1
- package/dist/chunk-KPFMOZXV.mjs +14 -0
- package/dist/chunk-KPFMOZXV.mjs.map +1 -0
- package/dist/chunk-XWJ7NQF4.mjs +14 -0
- package/dist/chunk-XWJ7NQF4.mjs.map +1 -0
- package/dist/constants/caseSplitPattern.js +1 -1
- package/dist/constants/caseSplitPattern.js.map +1 -1
- package/dist/constants/caseSplitPattern.mjs +1 -1
- package/dist/constants/index.js +1 -1
- package/dist/constants/index.js.map +1 -1
- package/dist/constants/index.mjs +1 -1
- package/dist/function/index.mjs +6 -6
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -40
- package/dist/string/index.d.mts +2 -0
- package/dist/string/index.d.ts +2 -0
- package/dist/string/index.js +17 -1
- package/dist/string/index.js.map +1 -1
- package/dist/string/index.mjs +11 -3
- package/dist/string/kebabCase.d.mts +17 -0
- package/dist/string/kebabCase.d.ts +17 -0
- package/dist/string/kebabCase.js +39 -0
- package/dist/string/kebabCase.js.map +1 -0
- package/dist/string/kebabCase.mjs +10 -0
- package/dist/string/kebabCase.mjs.map +1 -0
- package/dist/string/lowerCase.d.mts +17 -0
- package/dist/string/lowerCase.d.ts +17 -0
- package/dist/string/lowerCase.js +39 -0
- package/dist/string/lowerCase.js.map +1 -0
- package/dist/string/lowerCase.mjs +10 -0
- package/dist/string/lowerCase.mjs.map +1 -0
- package/dist/string/snakeCase.js +1 -1
- package/dist/string/snakeCase.js.map +1 -1
- package/dist/string/snakeCase.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-MPBVTIU3.mjs +0 -1
- /package/dist/{chunk-VRFIBW4H.mjs.map → chunk-47QP3LTV.mjs.map} +0 -0
- /package/dist/{chunk-MPBVTIU3.mjs.map → chunk-HXGADE4C.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -2,13 +2,19 @@ import "./chunk-ARZ5BDR6.mjs";
|
|
|
2
2
|
import {
|
|
3
3
|
delay
|
|
4
4
|
} from "./chunk-O64NE2P4.mjs";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-HXGADE4C.mjs";
|
|
6
6
|
import {
|
|
7
7
|
capitalize
|
|
8
8
|
} from "./chunk-U56ZOM7L.mjs";
|
|
9
|
+
import {
|
|
10
|
+
kebabCase
|
|
11
|
+
} from "./chunk-XWJ7NQF4.mjs";
|
|
12
|
+
import {
|
|
13
|
+
lowerCase
|
|
14
|
+
} from "./chunk-KPFMOZXV.mjs";
|
|
9
15
|
import {
|
|
10
16
|
snakeCase
|
|
11
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-47QP3LTV.mjs";
|
|
12
18
|
import "./chunk-MAJSPFA6.mjs";
|
|
13
19
|
import {
|
|
14
20
|
isUndefined
|
|
@@ -38,10 +44,6 @@ import {
|
|
|
38
44
|
import {
|
|
39
45
|
invert
|
|
40
46
|
} from "./chunk-74WWMNZS.mjs";
|
|
41
|
-
import "./chunk-FZEZH22H.mjs";
|
|
42
|
-
import {
|
|
43
|
-
AbortError
|
|
44
|
-
} from "./chunk-DXB7EZUQ.mjs";
|
|
45
47
|
import "./chunk-TLVQSNOE.mjs";
|
|
46
48
|
import {
|
|
47
49
|
meanBy
|
|
@@ -65,12 +67,21 @@ import {
|
|
|
65
67
|
sum
|
|
66
68
|
} from "./chunk-2SLTL4KL.mjs";
|
|
67
69
|
import "./chunk-OJSIDS6H.mjs";
|
|
70
|
+
import {
|
|
71
|
+
xorWith
|
|
72
|
+
} from "./chunk-QRSJBBFY.mjs";
|
|
73
|
+
import {
|
|
74
|
+
zip
|
|
75
|
+
} from "./chunk-IDCUZVJL.mjs";
|
|
68
76
|
import {
|
|
69
77
|
zipObject
|
|
70
78
|
} from "./chunk-6GWEY5EL.mjs";
|
|
71
79
|
import {
|
|
72
80
|
zipWith
|
|
73
81
|
} from "./chunk-4KYXHZ4R.mjs";
|
|
82
|
+
import {
|
|
83
|
+
uniqBy
|
|
84
|
+
} from "./chunk-OXAZEEGP.mjs";
|
|
74
85
|
import {
|
|
75
86
|
unzip
|
|
76
87
|
} from "./chunk-UYZKMBDO.mjs";
|
|
@@ -87,11 +98,11 @@ import {
|
|
|
87
98
|
xorBy
|
|
88
99
|
} from "./chunk-Q47NGNXT.mjs";
|
|
89
100
|
import {
|
|
90
|
-
|
|
91
|
-
} from "./chunk-
|
|
101
|
+
take
|
|
102
|
+
} from "./chunk-ME352XO7.mjs";
|
|
92
103
|
import {
|
|
93
|
-
|
|
94
|
-
} from "./chunk-
|
|
104
|
+
takeRight
|
|
105
|
+
} from "./chunk-IQLKIDXF.mjs";
|
|
95
106
|
import {
|
|
96
107
|
takeRightWhile
|
|
97
108
|
} from "./chunk-NTLX2MPV.mjs";
|
|
@@ -104,6 +115,9 @@ import {
|
|
|
104
115
|
import {
|
|
105
116
|
union
|
|
106
117
|
} from "./chunk-R6QA7PLZ.mjs";
|
|
118
|
+
import {
|
|
119
|
+
uniq
|
|
120
|
+
} from "./chunk-DVK2N4KC.mjs";
|
|
107
121
|
import {
|
|
108
122
|
unionBy
|
|
109
123
|
} from "./chunk-NFS7RWWE.mjs";
|
|
@@ -114,11 +128,11 @@ import {
|
|
|
114
128
|
uniqWith
|
|
115
129
|
} from "./chunk-237HGSZS.mjs";
|
|
116
130
|
import {
|
|
117
|
-
|
|
118
|
-
} from "./chunk-
|
|
131
|
+
maxBy
|
|
132
|
+
} from "./chunk-OOKNBU4V.mjs";
|
|
119
133
|
import {
|
|
120
|
-
|
|
121
|
-
} from "./chunk-
|
|
134
|
+
minBy
|
|
135
|
+
} from "./chunk-IJD7FE2Z.mjs";
|
|
122
136
|
import {
|
|
123
137
|
orderBy
|
|
124
138
|
} from "./chunk-7B7W36UP.mjs";
|
|
@@ -144,11 +158,11 @@ import {
|
|
|
144
158
|
tail
|
|
145
159
|
} from "./chunk-OF6NM4G7.mjs";
|
|
146
160
|
import {
|
|
147
|
-
|
|
148
|
-
} from "./chunk-
|
|
161
|
+
groupBy
|
|
162
|
+
} from "./chunk-E6E4RZLN.mjs";
|
|
149
163
|
import {
|
|
150
|
-
|
|
151
|
-
} from "./chunk-
|
|
164
|
+
head
|
|
165
|
+
} from "./chunk-HM2JT2RX.mjs";
|
|
152
166
|
import {
|
|
153
167
|
intersection
|
|
154
168
|
} from "./chunk-FVVSE2F2.mjs";
|
|
@@ -165,11 +179,11 @@ import {
|
|
|
165
179
|
last
|
|
166
180
|
} from "./chunk-KPBQ7OUY.mjs";
|
|
167
181
|
import {
|
|
168
|
-
|
|
169
|
-
} from "./chunk-
|
|
182
|
+
drop
|
|
183
|
+
} from "./chunk-S3CORED5.mjs";
|
|
170
184
|
import {
|
|
171
|
-
|
|
172
|
-
} from "./chunk-
|
|
185
|
+
dropRight
|
|
186
|
+
} from "./chunk-JEKUA56R.mjs";
|
|
173
187
|
import {
|
|
174
188
|
dropRightWhile
|
|
175
189
|
} from "./chunk-JE6JKZU3.mjs";
|
|
@@ -188,12 +202,6 @@ import {
|
|
|
188
202
|
import {
|
|
189
203
|
forEachRight
|
|
190
204
|
} from "./chunk-IEA53J7P.mjs";
|
|
191
|
-
import {
|
|
192
|
-
groupBy
|
|
193
|
-
} from "./chunk-E6E4RZLN.mjs";
|
|
194
|
-
import {
|
|
195
|
-
head
|
|
196
|
-
} from "./chunk-HM2JT2RX.mjs";
|
|
197
205
|
import {
|
|
198
206
|
chunk
|
|
199
207
|
} from "./chunk-E6C5EZQA.mjs";
|
|
@@ -212,27 +220,25 @@ import {
|
|
|
212
220
|
import {
|
|
213
221
|
differenceWith
|
|
214
222
|
} from "./chunk-6NVQAHXP.mjs";
|
|
223
|
+
import "./chunk-FZEZH22H.mjs";
|
|
215
224
|
import {
|
|
216
|
-
|
|
217
|
-
} from "./chunk-
|
|
218
|
-
import {
|
|
219
|
-
dropRight
|
|
220
|
-
} from "./chunk-JEKUA56R.mjs";
|
|
225
|
+
AbortError
|
|
226
|
+
} from "./chunk-DXB7EZUQ.mjs";
|
|
221
227
|
import "./chunk-2M3YVRFS.mjs";
|
|
222
|
-
import "./chunk-
|
|
228
|
+
import "./chunk-IJJCMZIV.mjs";
|
|
223
229
|
import "./chunk-N6EM6ETS.mjs";
|
|
224
|
-
import {
|
|
225
|
-
debounce
|
|
226
|
-
} from "./chunk-3IP4JVLL.mjs";
|
|
227
|
-
import {
|
|
228
|
-
noop
|
|
229
|
-
} from "./chunk-LKXCOLNY.mjs";
|
|
230
230
|
import {
|
|
231
231
|
once
|
|
232
232
|
} from "./chunk-CMBC4MXG.mjs";
|
|
233
233
|
import {
|
|
234
234
|
throttle
|
|
235
235
|
} from "./chunk-QOJGMVVR.mjs";
|
|
236
|
+
import {
|
|
237
|
+
debounce
|
|
238
|
+
} from "./chunk-3IP4JVLL.mjs";
|
|
239
|
+
import {
|
|
240
|
+
noop
|
|
241
|
+
} from "./chunk-LKXCOLNY.mjs";
|
|
236
242
|
import "./chunk-2MM5EJJX.mjs";
|
|
237
243
|
export {
|
|
238
244
|
AbortError,
|
|
@@ -265,8 +271,10 @@ export {
|
|
|
265
271
|
isNotNil,
|
|
266
272
|
isNull,
|
|
267
273
|
isUndefined,
|
|
274
|
+
kebabCase,
|
|
268
275
|
keyBy,
|
|
269
276
|
last,
|
|
277
|
+
lowerCase,
|
|
270
278
|
maxBy,
|
|
271
279
|
mean,
|
|
272
280
|
meanBy,
|
package/dist/string/index.d.mts
CHANGED
package/dist/string/index.d.ts
CHANGED
package/dist/string/index.js
CHANGED
|
@@ -21,12 +21,14 @@ 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,
|
|
25
|
+
lowerCase: () => lowerCase,
|
|
24
26
|
snakeCase: () => snakeCase
|
|
25
27
|
});
|
|
26
28
|
module.exports = __toCommonJS(string_exports);
|
|
27
29
|
|
|
28
30
|
// 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]
|
|
31
|
+
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
32
|
|
|
31
33
|
// src/string/snakeCase.ts
|
|
32
34
|
var snakeCase = (str) => {
|
|
@@ -34,6 +36,18 @@ var snakeCase = (str) => {
|
|
|
34
36
|
return splitWords.map((word) => word.toLowerCase()).join("_");
|
|
35
37
|
};
|
|
36
38
|
|
|
39
|
+
// src/string/kebabCase.ts
|
|
40
|
+
var kebabCase = (str) => {
|
|
41
|
+
const splitWords = str.match(CASE_SPLIT_PATTERN) || [];
|
|
42
|
+
return splitWords.map((word) => word.toLowerCase()).join("-");
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// src/string/lowerCase.ts
|
|
46
|
+
var lowerCase = (str) => {
|
|
47
|
+
const splitWords = str.match(CASE_SPLIT_PATTERN) || [];
|
|
48
|
+
return splitWords.map((word) => word.toLowerCase()).join(" ");
|
|
49
|
+
};
|
|
50
|
+
|
|
37
51
|
// src/string/capitalize.ts
|
|
38
52
|
var capitalize = (str) => {
|
|
39
53
|
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
|
@@ -41,6 +55,8 @@ var capitalize = (str) => {
|
|
|
41
55
|
// Annotate the CommonJS export names for ESM import in node:
|
|
42
56
|
0 && (module.exports = {
|
|
43
57
|
capitalize,
|
|
58
|
+
kebabCase,
|
|
59
|
+
lowerCase,
|
|
44
60
|
snakeCase
|
|
45
61
|
});
|
|
46
62
|
//# sourceMappingURL=index.js.map
|
package/dist/string/index.js.map
CHANGED
|
@@ -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]
|
|
1
|
+
{"version":3,"sources":["../../src/string/index.ts","../../src/constants/caseSplitPattern.ts","../../src/string/snakeCase.ts","../../src/string/kebabCase.ts","../../src/string/lowerCase.ts","../../src/string/capitalize.ts"],"sourcesContent":["export { snakeCase } from './snakeCase.ts';\nexport { kebabCase } from './kebabCase.ts';\nexport { lowerCase } from './lowerCase.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","import { CASE_SPLIT_PATTERN } from '../constants';\n\n/**\n * Converts a string to lower case.\n *\n * Lower case is the naming convention in which each word is written in lowercase and separated by an space ( ) character.\n *\n * @param {string} str - The string that is to be changed to lower case.\n * @returns {string} - The converted string to lower case.\n *\n * @example\n * const convertedStr1 = lowerCase('camelCase') // returns 'camel case'\n * const convertedStr2 = lowerCase('some whitespace') // returns 'some whitespace'\n * const convertedStr3 = lowerCase('hyphen-text') // returns 'hyphen text'\n * const convertedStr4 = lowerCase('HTTPRequest') // returns 'http request'\n */\n\nexport const lowerCase = (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;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;;;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":[]}
|
package/dist/string/index.mjs
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-HXGADE4C.mjs";
|
|
2
2
|
import {
|
|
3
3
|
capitalize
|
|
4
4
|
} from "../chunk-U56ZOM7L.mjs";
|
|
5
|
+
import {
|
|
6
|
+
kebabCase
|
|
7
|
+
} from "../chunk-XWJ7NQF4.mjs";
|
|
8
|
+
import {
|
|
9
|
+
lowerCase
|
|
10
|
+
} from "../chunk-KPFMOZXV.mjs";
|
|
5
11
|
import {
|
|
6
12
|
snakeCase
|
|
7
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-47QP3LTV.mjs";
|
|
8
14
|
import "../chunk-2M3YVRFS.mjs";
|
|
9
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-IJJCMZIV.mjs";
|
|
10
16
|
import "../chunk-2MM5EJJX.mjs";
|
|
11
17
|
export {
|
|
12
18
|
capitalize,
|
|
19
|
+
kebabCase,
|
|
20
|
+
lowerCase,
|
|
13
21
|
snakeCase
|
|
14
22
|
};
|
|
15
23
|
//# 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 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a string to lower case.
|
|
3
|
+
*
|
|
4
|
+
* Lower case is the naming convention in which each word is written in lowercase and separated by an space ( ) character.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} str - The string that is to be changed to lower case.
|
|
7
|
+
* @returns {string} - The converted string to lower case.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const convertedStr1 = lowerCase('camelCase') // returns 'camel case'
|
|
11
|
+
* const convertedStr2 = lowerCase('some whitespace') // returns 'some whitespace'
|
|
12
|
+
* const convertedStr3 = lowerCase('hyphen-text') // returns 'hyphen text'
|
|
13
|
+
* const convertedStr4 = lowerCase('HTTPRequest') // returns 'http request'
|
|
14
|
+
*/
|
|
15
|
+
declare const lowerCase: (str: string) => string;
|
|
16
|
+
|
|
17
|
+
export { lowerCase };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a string to lower case.
|
|
3
|
+
*
|
|
4
|
+
* Lower case is the naming convention in which each word is written in lowercase and separated by an space ( ) character.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} str - The string that is to be changed to lower case.
|
|
7
|
+
* @returns {string} - The converted string to lower case.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const convertedStr1 = lowerCase('camelCase') // returns 'camel case'
|
|
11
|
+
* const convertedStr2 = lowerCase('some whitespace') // returns 'some whitespace'
|
|
12
|
+
* const convertedStr3 = lowerCase('hyphen-text') // returns 'hyphen text'
|
|
13
|
+
* const convertedStr4 = lowerCase('HTTPRequest') // returns 'http request'
|
|
14
|
+
*/
|
|
15
|
+
declare const lowerCase: (str: string) => string;
|
|
16
|
+
|
|
17
|
+
export { lowerCase };
|
|
@@ -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/lowerCase.ts
|
|
21
|
+
var lowerCase_exports = {};
|
|
22
|
+
__export(lowerCase_exports, {
|
|
23
|
+
lowerCase: () => lowerCase
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(lowerCase_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/lowerCase.ts
|
|
31
|
+
var lowerCase = (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
|
+
lowerCase
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=lowerCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/string/lowerCase.ts","../../src/constants/caseSplitPattern.ts"],"sourcesContent":["import { CASE_SPLIT_PATTERN } from '../constants';\n\n/**\n * Converts a string to lower case.\n *\n * Lower case is the naming convention in which each word is written in lowercase and separated by an space ( ) character.\n *\n * @param {string} str - The string that is to be changed to lower case.\n * @returns {string} - The converted string to lower case.\n *\n * @example\n * const convertedStr1 = lowerCase('camelCase') // returns 'camel case'\n * const convertedStr2 = lowerCase('some whitespace') // returns 'some whitespace'\n * const convertedStr3 = lowerCase('hyphen-text') // returns 'hyphen text'\n * const convertedStr4 = lowerCase('HTTPRequest') // returns 'http request'\n */\n\nexport const lowerCase = (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 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/string/snakeCase.js
CHANGED
|
@@ -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]
|
|
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]
|
|
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":[]}
|
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.
|
|
4
|
+
"version": "1.9.0-dev.182+b1cb9335",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|
package/dist/chunk-MPBVTIU3.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=chunk-MPBVTIU3.mjs.map
|
|
File without changes
|
|
File without changes
|