es-toolkit 1.9.0-dev.187 → 1.9.0-dev.189
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 +31 -31
- package/dist/chunk-5IKVJGHO.mjs +14 -0
- package/dist/chunk-5IKVJGHO.mjs.map +1 -0
- package/dist/chunk-EYYZQFOP.mjs +14 -0
- package/dist/chunk-EYYZQFOP.mjs.map +1 -0
- package/dist/chunk-F3WCQQET.mjs +14 -0
- package/dist/chunk-F3WCQQET.mjs.map +1 -0
- package/dist/chunk-WVQ7YVRK.mjs +11 -0
- package/dist/chunk-WVQ7YVRK.mjs.map +1 -0
- package/dist/function/index.mjs +6 -6
- package/dist/index.js +12 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -62
- package/dist/math/index.mjs +9 -9
- package/dist/object/index.mjs +6 -6
- package/dist/predicate/index.mjs +6 -6
- package/dist/string/index.js +12 -15
- package/dist/string/index.js.map +1 -1
- package/dist/string/index.mjs +6 -7
- package/dist/string/kebabCase.js +8 -4
- package/dist/string/kebabCase.js.map +1 -1
- package/dist/string/kebabCase.mjs +2 -3
- package/dist/string/lowerCase.js +8 -11
- package/dist/string/lowerCase.js.map +1 -1
- package/dist/string/lowerCase.mjs +2 -3
- package/dist/string/snakeCase.js +8 -4
- package/dist/string/snakeCase.js.map +1 -1
- package/dist/string/snakeCase.mjs +2 -3
- package/package.json +1 -1
- package/dist/chunk-2AWSOSQI.mjs +0 -21
- package/dist/chunk-2AWSOSQI.mjs.map +0 -1
- package/dist/chunk-2M3YVRFS.mjs +0 -1
- package/dist/chunk-2M3YVRFS.mjs.map +0 -1
- package/dist/chunk-47QP3LTV.mjs +0 -14
- package/dist/chunk-47QP3LTV.mjs.map +0 -1
- package/dist/chunk-IJJCMZIV.mjs +0 -7
- package/dist/chunk-IJJCMZIV.mjs.map +0 -1
- package/dist/chunk-XWJ7NQF4.mjs +0 -14
- package/dist/chunk-XWJ7NQF4.mjs.map +0 -1
- package/dist/constants/caseSplitPattern.d.mts +0 -19
- package/dist/constants/caseSplitPattern.d.ts +0 -19
- package/dist/constants/caseSplitPattern.js +0 -31
- package/dist/constants/caseSplitPattern.js.map +0 -1
- package/dist/constants/caseSplitPattern.mjs +0 -8
- package/dist/constants/caseSplitPattern.mjs.map +0 -1
- package/dist/constants/index.d.mts +0 -1
- package/dist/constants/index.d.ts +0 -1
- package/dist/constants/index.js +0 -33
- package/dist/constants/index.js.map +0 -1
- package/dist/constants/index.mjs +0 -9
- package/dist/constants/index.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -3,38 +3,33 @@ import {
|
|
|
3
3
|
delay
|
|
4
4
|
} from "./chunk-O64NE2P4.mjs";
|
|
5
5
|
import "./chunk-HXGADE4C.mjs";
|
|
6
|
-
import {
|
|
7
|
-
snakeCase
|
|
8
|
-
} from "./chunk-47QP3LTV.mjs";
|
|
9
6
|
import {
|
|
10
7
|
capitalize
|
|
11
8
|
} from "./chunk-U56ZOM7L.mjs";
|
|
12
9
|
import {
|
|
13
10
|
kebabCase
|
|
14
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-EYYZQFOP.mjs";
|
|
15
12
|
import {
|
|
16
13
|
lowerCase
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-MAJSPFA6.mjs";
|
|
19
|
-
import {
|
|
20
|
-
isNull
|
|
21
|
-
} from "./chunk-AIRSKN47.mjs";
|
|
14
|
+
} from "./chunk-5IKVJGHO.mjs";
|
|
22
15
|
import {
|
|
23
|
-
|
|
24
|
-
} from "./chunk-
|
|
16
|
+
snakeCase
|
|
17
|
+
} from "./chunk-F3WCQQET.mjs";
|
|
18
|
+
import "./chunk-WVQ7YVRK.mjs";
|
|
19
|
+
import "./chunk-MAJSPFA6.mjs";
|
|
25
20
|
import {
|
|
26
21
|
isNil
|
|
27
22
|
} from "./chunk-OHQAR5AU.mjs";
|
|
28
23
|
import {
|
|
29
24
|
isNotNil
|
|
30
25
|
} from "./chunk-BMRTZMRE.mjs";
|
|
31
|
-
import "./chunk-PMHULJNL.mjs";
|
|
32
26
|
import {
|
|
33
|
-
|
|
34
|
-
} from "./chunk-
|
|
27
|
+
isNull
|
|
28
|
+
} from "./chunk-AIRSKN47.mjs";
|
|
35
29
|
import {
|
|
36
|
-
|
|
37
|
-
} from "./chunk-
|
|
30
|
+
isUndefined
|
|
31
|
+
} from "./chunk-VH2PV426.mjs";
|
|
32
|
+
import "./chunk-PMHULJNL.mjs";
|
|
38
33
|
import {
|
|
39
34
|
omitBy
|
|
40
35
|
} from "./chunk-BCTYOXT7.mjs";
|
|
@@ -44,35 +39,35 @@ import {
|
|
|
44
39
|
import {
|
|
45
40
|
pickBy
|
|
46
41
|
} from "./chunk-6CLH5YZ2.mjs";
|
|
47
|
-
import "./chunk-TLVQSNOE.mjs";
|
|
48
42
|
import {
|
|
49
|
-
|
|
50
|
-
} from "./chunk-
|
|
43
|
+
invert
|
|
44
|
+
} from "./chunk-74WWMNZS.mjs";
|
|
51
45
|
import {
|
|
52
|
-
|
|
53
|
-
} from "./chunk-
|
|
46
|
+
omit
|
|
47
|
+
} from "./chunk-QZITBKWX.mjs";
|
|
48
|
+
import "./chunk-TLVQSNOE.mjs";
|
|
54
49
|
import {
|
|
55
50
|
range
|
|
56
51
|
} from "./chunk-DPH2KE6O.mjs";
|
|
57
52
|
import {
|
|
58
53
|
round
|
|
59
54
|
} from "./chunk-5PMKOZ2F.mjs";
|
|
60
|
-
import {
|
|
61
|
-
sum
|
|
62
|
-
} from "./chunk-2SLTL4KL.mjs";
|
|
63
55
|
import {
|
|
64
56
|
clamp
|
|
65
57
|
} from "./chunk-MLCL773E.mjs";
|
|
66
58
|
import {
|
|
67
59
|
inRange
|
|
68
60
|
} from "./chunk-BH6HLGBA.mjs";
|
|
69
|
-
import "./chunk-2MRZANXZ.mjs";
|
|
70
61
|
import {
|
|
71
|
-
|
|
72
|
-
} from "./chunk-
|
|
62
|
+
meanBy
|
|
63
|
+
} from "./chunk-IZAD2S7R.mjs";
|
|
73
64
|
import {
|
|
74
|
-
|
|
75
|
-
} from "./chunk-
|
|
65
|
+
mean
|
|
66
|
+
} from "./chunk-GDC64SYJ.mjs";
|
|
67
|
+
import {
|
|
68
|
+
sum
|
|
69
|
+
} from "./chunk-2SLTL4KL.mjs";
|
|
70
|
+
import "./chunk-2MRZANXZ.mjs";
|
|
76
71
|
import {
|
|
77
72
|
zip
|
|
78
73
|
} from "./chunk-IDCUZVJL.mjs";
|
|
@@ -82,15 +77,9 @@ import {
|
|
|
82
77
|
import {
|
|
83
78
|
zipWith
|
|
84
79
|
} from "./chunk-4KYXHZ4R.mjs";
|
|
85
|
-
import {
|
|
86
|
-
unionWith
|
|
87
|
-
} from "./chunk-2ZCITDMK.mjs";
|
|
88
80
|
import {
|
|
89
81
|
uniqBy
|
|
90
82
|
} from "./chunk-OXAZEEGP.mjs";
|
|
91
|
-
import {
|
|
92
|
-
uniqWith
|
|
93
|
-
} from "./chunk-237HGSZS.mjs";
|
|
94
83
|
import {
|
|
95
84
|
unzip
|
|
96
85
|
} from "./chunk-UYZKMBDO.mjs";
|
|
@@ -104,11 +93,11 @@ import {
|
|
|
104
93
|
xor
|
|
105
94
|
} from "./chunk-L7FQX5MN.mjs";
|
|
106
95
|
import {
|
|
107
|
-
|
|
108
|
-
} from "./chunk-
|
|
96
|
+
xorBy
|
|
97
|
+
} from "./chunk-Q47NGNXT.mjs";
|
|
109
98
|
import {
|
|
110
|
-
|
|
111
|
-
} from "./chunk-
|
|
99
|
+
xorWith
|
|
100
|
+
} from "./chunk-QRSJBBFY.mjs";
|
|
112
101
|
import {
|
|
113
102
|
takeRight
|
|
114
103
|
} from "./chunk-IQLKIDXF.mjs";
|
|
@@ -124,18 +113,18 @@ import {
|
|
|
124
113
|
import {
|
|
125
114
|
union
|
|
126
115
|
} from "./chunk-R6QA7PLZ.mjs";
|
|
127
|
-
import {
|
|
128
|
-
uniq
|
|
129
|
-
} from "./chunk-DVK2N4KC.mjs";
|
|
130
116
|
import {
|
|
131
117
|
unionBy
|
|
132
118
|
} from "./chunk-NFS7RWWE.mjs";
|
|
133
119
|
import {
|
|
134
|
-
|
|
135
|
-
} from "./chunk-
|
|
120
|
+
unionWith
|
|
121
|
+
} from "./chunk-2ZCITDMK.mjs";
|
|
136
122
|
import {
|
|
137
|
-
|
|
138
|
-
} from "./chunk-
|
|
123
|
+
uniqWith
|
|
124
|
+
} from "./chunk-237HGSZS.mjs";
|
|
125
|
+
import {
|
|
126
|
+
uniq
|
|
127
|
+
} from "./chunk-DVK2N4KC.mjs";
|
|
139
128
|
import {
|
|
140
129
|
minBy
|
|
141
130
|
} from "./chunk-IJD7FE2Z.mjs";
|
|
@@ -161,11 +150,11 @@ import {
|
|
|
161
150
|
shuffle
|
|
162
151
|
} from "./chunk-G7UQ5PUR.mjs";
|
|
163
152
|
import {
|
|
164
|
-
|
|
165
|
-
} from "./chunk-
|
|
153
|
+
tail
|
|
154
|
+
} from "./chunk-OF6NM4G7.mjs";
|
|
166
155
|
import {
|
|
167
|
-
|
|
168
|
-
} from "./chunk-
|
|
156
|
+
take
|
|
157
|
+
} from "./chunk-ME352XO7.mjs";
|
|
169
158
|
import {
|
|
170
159
|
initial
|
|
171
160
|
} from "./chunk-XPSOKBRZ.mjs";
|
|
@@ -182,11 +171,11 @@ import {
|
|
|
182
171
|
keyBy
|
|
183
172
|
} from "./chunk-AJKZMN2V.mjs";
|
|
184
173
|
import {
|
|
185
|
-
|
|
186
|
-
} from "./chunk-
|
|
174
|
+
last
|
|
175
|
+
} from "./chunk-KPBQ7OUY.mjs";
|
|
187
176
|
import {
|
|
188
|
-
|
|
189
|
-
} from "./chunk-
|
|
177
|
+
maxBy
|
|
178
|
+
} from "./chunk-OOKNBU4V.mjs";
|
|
190
179
|
import {
|
|
191
180
|
dropRightWhile
|
|
192
181
|
} from "./chunk-JE6JKZU3.mjs";
|
|
@@ -205,6 +194,12 @@ import {
|
|
|
205
194
|
import {
|
|
206
195
|
forEachRight
|
|
207
196
|
} from "./chunk-IEA53J7P.mjs";
|
|
197
|
+
import {
|
|
198
|
+
groupBy
|
|
199
|
+
} from "./chunk-E6E4RZLN.mjs";
|
|
200
|
+
import {
|
|
201
|
+
head
|
|
202
|
+
} from "./chunk-HM2JT2RX.mjs";
|
|
208
203
|
import {
|
|
209
204
|
chunk
|
|
210
205
|
} from "./chunk-E6C5EZQA.mjs";
|
|
@@ -223,25 +218,29 @@ import {
|
|
|
223
218
|
import {
|
|
224
219
|
differenceWith
|
|
225
220
|
} from "./chunk-6NVQAHXP.mjs";
|
|
226
|
-
import
|
|
227
|
-
|
|
221
|
+
import {
|
|
222
|
+
drop
|
|
223
|
+
} from "./chunk-S3CORED5.mjs";
|
|
224
|
+
import {
|
|
225
|
+
dropRight
|
|
226
|
+
} from "./chunk-JEKUA56R.mjs";
|
|
228
227
|
import "./chunk-FZEZH22H.mjs";
|
|
229
228
|
import {
|
|
230
229
|
AbortError
|
|
231
230
|
} from "./chunk-DXB7EZUQ.mjs";
|
|
232
231
|
import "./chunk-N6EM6ETS.mjs";
|
|
233
|
-
import {
|
|
234
|
-
once
|
|
235
|
-
} from "./chunk-CMBC4MXG.mjs";
|
|
236
|
-
import {
|
|
237
|
-
throttle
|
|
238
|
-
} from "./chunk-QOJGMVVR.mjs";
|
|
239
232
|
import {
|
|
240
233
|
debounce
|
|
241
234
|
} from "./chunk-3IP4JVLL.mjs";
|
|
242
235
|
import {
|
|
243
236
|
noop
|
|
244
237
|
} from "./chunk-LKXCOLNY.mjs";
|
|
238
|
+
import {
|
|
239
|
+
once
|
|
240
|
+
} from "./chunk-CMBC4MXG.mjs";
|
|
241
|
+
import {
|
|
242
|
+
throttle
|
|
243
|
+
} from "./chunk-QOJGMVVR.mjs";
|
|
245
244
|
import "./chunk-2MM5EJJX.mjs";
|
|
246
245
|
export {
|
|
247
246
|
AbortError,
|
package/dist/math/index.mjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import "../chunk-TLVQSNOE.mjs";
|
|
2
|
-
import {
|
|
3
|
-
meanBy
|
|
4
|
-
} from "../chunk-IZAD2S7R.mjs";
|
|
5
|
-
import {
|
|
6
|
-
mean
|
|
7
|
-
} from "../chunk-GDC64SYJ.mjs";
|
|
8
2
|
import {
|
|
9
3
|
range
|
|
10
4
|
} from "../chunk-DPH2KE6O.mjs";
|
|
11
5
|
import {
|
|
12
6
|
round
|
|
13
7
|
} from "../chunk-5PMKOZ2F.mjs";
|
|
14
|
-
import {
|
|
15
|
-
sum
|
|
16
|
-
} from "../chunk-2SLTL4KL.mjs";
|
|
17
8
|
import {
|
|
18
9
|
clamp
|
|
19
10
|
} from "../chunk-MLCL773E.mjs";
|
|
20
11
|
import {
|
|
21
12
|
inRange
|
|
22
13
|
} from "../chunk-BH6HLGBA.mjs";
|
|
14
|
+
import {
|
|
15
|
+
meanBy
|
|
16
|
+
} from "../chunk-IZAD2S7R.mjs";
|
|
17
|
+
import {
|
|
18
|
+
mean
|
|
19
|
+
} from "../chunk-GDC64SYJ.mjs";
|
|
20
|
+
import {
|
|
21
|
+
sum
|
|
22
|
+
} from "../chunk-2SLTL4KL.mjs";
|
|
23
23
|
import {
|
|
24
24
|
randomInt
|
|
25
25
|
} from "../chunk-GIWAOOFY.mjs";
|
package/dist/object/index.mjs
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import "../chunk-PMHULJNL.mjs";
|
|
2
|
-
import {
|
|
3
|
-
invert
|
|
4
|
-
} from "../chunk-74WWMNZS.mjs";
|
|
5
|
-
import {
|
|
6
|
-
omit
|
|
7
|
-
} from "../chunk-QZITBKWX.mjs";
|
|
8
2
|
import {
|
|
9
3
|
omitBy
|
|
10
4
|
} from "../chunk-BCTYOXT7.mjs";
|
|
@@ -14,6 +8,12 @@ import {
|
|
|
14
8
|
import {
|
|
15
9
|
pickBy
|
|
16
10
|
} from "../chunk-6CLH5YZ2.mjs";
|
|
11
|
+
import {
|
|
12
|
+
invert
|
|
13
|
+
} from "../chunk-74WWMNZS.mjs";
|
|
14
|
+
import {
|
|
15
|
+
omit
|
|
16
|
+
} from "../chunk-QZITBKWX.mjs";
|
|
17
17
|
import "../chunk-2MM5EJJX.mjs";
|
|
18
18
|
export {
|
|
19
19
|
invert,
|
package/dist/predicate/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import "../chunk-MAJSPFA6.mjs";
|
|
2
|
-
import {
|
|
3
|
-
isNull
|
|
4
|
-
} from "../chunk-AIRSKN47.mjs";
|
|
5
|
-
import {
|
|
6
|
-
isUndefined
|
|
7
|
-
} from "../chunk-VH2PV426.mjs";
|
|
8
2
|
import {
|
|
9
3
|
isNil
|
|
10
4
|
} from "../chunk-OHQAR5AU.mjs";
|
|
11
5
|
import {
|
|
12
6
|
isNotNil
|
|
13
7
|
} from "../chunk-BMRTZMRE.mjs";
|
|
8
|
+
import {
|
|
9
|
+
isNull
|
|
10
|
+
} from "../chunk-AIRSKN47.mjs";
|
|
11
|
+
import {
|
|
12
|
+
isUndefined
|
|
13
|
+
} from "../chunk-VH2PV426.mjs";
|
|
14
14
|
import "../chunk-2MM5EJJX.mjs";
|
|
15
15
|
export {
|
|
16
16
|
isNil,
|
package/dist/string/index.js
CHANGED
|
@@ -27,32 +27,29 @@ __export(string_exports, {
|
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(string_exports);
|
|
29
29
|
|
|
30
|
-
// src/
|
|
31
|
-
var CASE_SPLIT_PATTERN = /[A-Z]
|
|
30
|
+
// src/string/_internal/getWords.ts
|
|
31
|
+
var CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g;
|
|
32
|
+
function getWords(str) {
|
|
33
|
+
var _a;
|
|
34
|
+
return Array.from((_a = str.match(CASE_SPLIT_PATTERN)) != null ? _a : []);
|
|
35
|
+
}
|
|
32
36
|
|
|
33
37
|
// src/string/snakeCase.ts
|
|
34
38
|
var snakeCase = (str) => {
|
|
35
|
-
const
|
|
36
|
-
return
|
|
39
|
+
const words = getWords(str);
|
|
40
|
+
return words.map((word) => word.toLowerCase()).join("_");
|
|
37
41
|
};
|
|
38
42
|
|
|
39
43
|
// src/string/kebabCase.ts
|
|
40
44
|
var kebabCase = (str) => {
|
|
41
|
-
const
|
|
42
|
-
return
|
|
45
|
+
const words = getWords(str);
|
|
46
|
+
return words.map((word) => word.toLowerCase()).join("-");
|
|
43
47
|
};
|
|
44
48
|
|
|
45
49
|
// src/string/lowerCase.ts
|
|
46
50
|
var lowerCase = (str) => {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
return "";
|
|
50
|
-
}
|
|
51
|
-
let result = splitWords[0].toLowerCase();
|
|
52
|
-
for (let i = 1; i < splitWords.length; i++) {
|
|
53
|
-
result += " " + splitWords[i].toLowerCase();
|
|
54
|
-
}
|
|
55
|
-
return result;
|
|
51
|
+
const words = getWords(str);
|
|
52
|
+
return words.map((word) => word.toLowerCase()).join(" ");
|
|
56
53
|
};
|
|
57
54
|
|
|
58
55
|
// src/string/capitalize.ts
|
package/dist/string/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/string/index.ts","../../src/
|
|
1
|
+
{"version":3,"sources":["../../src/string/index.ts","../../src/string/_internal/getWords.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 */\nconst CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g;\n\nexport function getWords(str: string): string[] {\n return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);\n}\n","import { getWords } from './_internal/getWords.ts';\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 words = getWords(str);\n return words.map(word => word.toLowerCase()).join('_');\n};\n","import { getWords } from './_internal/getWords.ts';\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 words = getWords(str);\n return words.map(word => word.toLowerCase()).join('-');\n};\n","import { getWords } from './_internal/getWords.ts';\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 */\nexport const lowerCase = (str: string): string => {\n const words = getWords(str);\n return words.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;;;ACgBA,IAAM,qBAAqB;AAEpB,SAAS,SAAS,KAAuB;AAlBhD;AAmBE,SAAO,MAAM,MAAK,SAAI,MAAM,kBAAkB,MAA5B,YAAiC,CAAC,CAAC;AACvD;;;ACHO,IAAM,YAAY,CAAC,QAAwB;AAChD,QAAM,QAAQ,SAAS,GAAG;AAC1B,SAAO,MAAM,IAAI,UAAQ,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG;AACvD;;;ACHO,IAAM,YAAY,CAAC,QAAwB;AAChD,QAAM,QAAQ,SAAS,GAAG;AAC1B,SAAO,MAAM,IAAI,UAAQ,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG;AACvD;;;ACJO,IAAM,YAAY,CAAC,QAAwB;AAChD,QAAM,QAAQ,SAAS,GAAG;AAC1B,SAAO,MAAM,IAAI,UAAQ,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG;AACvD;;;ACPO,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,18 +1,17 @@
|
|
|
1
1
|
import "../chunk-HXGADE4C.mjs";
|
|
2
|
-
import {
|
|
3
|
-
snakeCase
|
|
4
|
-
} from "../chunk-47QP3LTV.mjs";
|
|
5
2
|
import {
|
|
6
3
|
capitalize
|
|
7
4
|
} from "../chunk-U56ZOM7L.mjs";
|
|
8
5
|
import {
|
|
9
6
|
kebabCase
|
|
10
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-EYYZQFOP.mjs";
|
|
11
8
|
import {
|
|
12
9
|
lowerCase
|
|
13
|
-
} from "../chunk-
|
|
14
|
-
import
|
|
15
|
-
|
|
10
|
+
} from "../chunk-5IKVJGHO.mjs";
|
|
11
|
+
import {
|
|
12
|
+
snakeCase
|
|
13
|
+
} from "../chunk-F3WCQQET.mjs";
|
|
14
|
+
import "../chunk-WVQ7YVRK.mjs";
|
|
16
15
|
import "../chunk-2MM5EJJX.mjs";
|
|
17
16
|
export {
|
|
18
17
|
capitalize,
|
package/dist/string/kebabCase.js
CHANGED
|
@@ -24,13 +24,17 @@ __export(kebabCase_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(kebabCase_exports);
|
|
26
26
|
|
|
27
|
-
// src/
|
|
28
|
-
var CASE_SPLIT_PATTERN = /[A-Z]
|
|
27
|
+
// src/string/_internal/getWords.ts
|
|
28
|
+
var CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g;
|
|
29
|
+
function getWords(str) {
|
|
30
|
+
var _a;
|
|
31
|
+
return Array.from((_a = str.match(CASE_SPLIT_PATTERN)) != null ? _a : []);
|
|
32
|
+
}
|
|
29
33
|
|
|
30
34
|
// src/string/kebabCase.ts
|
|
31
35
|
var kebabCase = (str) => {
|
|
32
|
-
const
|
|
33
|
-
return
|
|
36
|
+
const words = getWords(str);
|
|
37
|
+
return words.map((word) => word.toLowerCase()).join("-");
|
|
34
38
|
};
|
|
35
39
|
// Annotate the CommonJS export names for ESM import in node:
|
|
36
40
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/string/kebabCase.ts","../../src/
|
|
1
|
+
{"version":3,"sources":["../../src/string/kebabCase.ts","../../src/string/_internal/getWords.ts"],"sourcesContent":["import { getWords } from './_internal/getWords.ts';\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 words = getWords(str);\n return words.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 */\nconst CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g;\n\nexport function getWords(str: string): string[] {\n return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACgBA,IAAM,qBAAqB;AAEpB,SAAS,SAAS,KAAuB;AAlBhD;AAmBE,SAAO,MAAM,MAAK,SAAI,MAAM,kBAAkB,MAA5B,YAAiC,CAAC,CAAC;AACvD;;;ADHO,IAAM,YAAY,CAAC,QAAwB;AAChD,QAAM,QAAQ,SAAS,GAAG;AAC1B,SAAO,MAAM,IAAI,UAAQ,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG;AACvD;","names":[]}
|
package/dist/string/lowerCase.js
CHANGED
|
@@ -24,20 +24,17 @@ __export(lowerCase_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(lowerCase_exports);
|
|
26
26
|
|
|
27
|
-
// src/
|
|
28
|
-
var CASE_SPLIT_PATTERN = /[A-Z]
|
|
27
|
+
// src/string/_internal/getWords.ts
|
|
28
|
+
var CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g;
|
|
29
|
+
function getWords(str) {
|
|
30
|
+
var _a;
|
|
31
|
+
return Array.from((_a = str.match(CASE_SPLIT_PATTERN)) != null ? _a : []);
|
|
32
|
+
}
|
|
29
33
|
|
|
30
34
|
// src/string/lowerCase.ts
|
|
31
35
|
var lowerCase = (str) => {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
return "";
|
|
35
|
-
}
|
|
36
|
-
let result = splitWords[0].toLowerCase();
|
|
37
|
-
for (let i = 1; i < splitWords.length; i++) {
|
|
38
|
-
result += " " + splitWords[i].toLowerCase();
|
|
39
|
-
}
|
|
40
|
-
return result;
|
|
36
|
+
const words = getWords(str);
|
|
37
|
+
return words.map((word) => word.toLowerCase()).join(" ");
|
|
41
38
|
};
|
|
42
39
|
// Annotate the CommonJS export names for ESM import in node:
|
|
43
40
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/string/lowerCase.ts","../../src/
|
|
1
|
+
{"version":3,"sources":["../../src/string/lowerCase.ts","../../src/string/_internal/getWords.ts"],"sourcesContent":["import { getWords } from './_internal/getWords.ts';\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 */\nexport const lowerCase = (str: string): string => {\n const words = getWords(str);\n return words.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 */\nconst CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g;\n\nexport function getWords(str: string): string[] {\n return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACgBA,IAAM,qBAAqB;AAEpB,SAAS,SAAS,KAAuB;AAlBhD;AAmBE,SAAO,MAAM,MAAK,SAAI,MAAM,kBAAkB,MAA5B,YAAiC,CAAC,CAAC;AACvD;;;ADJO,IAAM,YAAY,CAAC,QAAwB;AAChD,QAAM,QAAQ,SAAS,GAAG;AAC1B,SAAO,MAAM,IAAI,UAAQ,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG;AACvD;","names":[]}
|
package/dist/string/snakeCase.js
CHANGED
|
@@ -24,13 +24,17 @@ __export(snakeCase_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(snakeCase_exports);
|
|
26
26
|
|
|
27
|
-
// src/
|
|
28
|
-
var CASE_SPLIT_PATTERN = /[A-Z]
|
|
27
|
+
// src/string/_internal/getWords.ts
|
|
28
|
+
var CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g;
|
|
29
|
+
function getWords(str) {
|
|
30
|
+
var _a;
|
|
31
|
+
return Array.from((_a = str.match(CASE_SPLIT_PATTERN)) != null ? _a : []);
|
|
32
|
+
}
|
|
29
33
|
|
|
30
34
|
// src/string/snakeCase.ts
|
|
31
35
|
var snakeCase = (str) => {
|
|
32
|
-
const
|
|
33
|
-
return
|
|
36
|
+
const words = getWords(str);
|
|
37
|
+
return words.map((word) => word.toLowerCase()).join("_");
|
|
34
38
|
};
|
|
35
39
|
// Annotate the CommonJS export names for ESM import in node:
|
|
36
40
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/string/snakeCase.ts","../../src/
|
|
1
|
+
{"version":3,"sources":["../../src/string/snakeCase.ts","../../src/string/_internal/getWords.ts"],"sourcesContent":["import { getWords } from './_internal/getWords.ts';\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 words = getWords(str);\n return words.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 */\nconst CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g;\n\nexport function getWords(str: string): string[] {\n return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACgBA,IAAM,qBAAqB;AAEpB,SAAS,SAAS,KAAuB;AAlBhD;AAmBE,SAAO,MAAM,MAAK,SAAI,MAAM,kBAAkB,MAA5B,YAAiC,CAAC,CAAC;AACvD;;;ADHO,IAAM,YAAY,CAAC,QAAwB;AAChD,QAAM,QAAQ,SAAS,GAAG;AAC1B,SAAO,MAAM,IAAI,UAAQ,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG;AACvD;","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.189+14ec3152",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|
package/dist/chunk-2AWSOSQI.mjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CASE_SPLIT_PATTERN
|
|
3
|
-
} from "./chunk-IJJCMZIV.mjs";
|
|
4
|
-
|
|
5
|
-
// src/string/lowerCase.ts
|
|
6
|
-
var lowerCase = (str) => {
|
|
7
|
-
const splitWords = str.match(CASE_SPLIT_PATTERN) || [];
|
|
8
|
-
if (splitWords.length === 0) {
|
|
9
|
-
return "";
|
|
10
|
-
}
|
|
11
|
-
let result = splitWords[0].toLowerCase();
|
|
12
|
-
for (let i = 1; i < splitWords.length; i++) {
|
|
13
|
-
result += " " + splitWords[i].toLowerCase();
|
|
14
|
-
}
|
|
15
|
-
return result;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export {
|
|
19
|
-
lowerCase
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=chunk-2AWSOSQI.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/string/lowerCase.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 */\nexport const lowerCase = (str: string): string => {\n const splitWords = str.match(CASE_SPLIT_PATTERN) || [];\n\n if (splitWords.length === 0) {\n return '';\n }\n\n let result = splitWords[0]!.toLowerCase();\n for (let i = 1; i < splitWords.length; i++) {\n result += ' ' + splitWords[i]!.toLowerCase();\n }\n\n return result;\n};\n"],"mappings":";;;;;AAgBO,IAAM,YAAY,CAAC,QAAwB;AAChD,QAAM,aAAa,IAAI,MAAM,kBAAkB,KAAK,CAAC;AAErD,MAAI,WAAW,WAAW,GAAG;AAC3B,WAAO;AAAA,EACT;AAEA,MAAI,SAAS,WAAW,CAAC,EAAG,YAAY;AACxC,WAAS,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;AAC1C,cAAU,MAAM,WAAW,CAAC,EAAG,YAAY;AAAA,EAC7C;AAEA,SAAO;AACT;","names":[]}
|
package/dist/chunk-2M3YVRFS.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=chunk-2M3YVRFS.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/chunk-47QP3LTV.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CASE_SPLIT_PATTERN
|
|
3
|
-
} from "./chunk-IJJCMZIV.mjs";
|
|
4
|
-
|
|
5
|
-
// src/string/snakeCase.ts
|
|
6
|
-
var snakeCase = (str) => {
|
|
7
|
-
const splitWords = str.match(CASE_SPLIT_PATTERN) || [];
|
|
8
|
-
return splitWords.map((word) => word.toLowerCase()).join("_");
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
snakeCase
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=chunk-47QP3LTV.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/string/snakeCase.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"],"mappings":";;;;;AAiBO,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":[]}
|