es-toolkit 1.9.0-dev.185 → 1.9.0-dev.187
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/flattenDeep.js.map +1 -1
- package/dist/array/flattenDeep.mjs +1 -1
- package/dist/array/index.js.map +1 -1
- package/dist/array/index.mjs +47 -47
- package/dist/chunk-2AWSOSQI.mjs +21 -0
- package/dist/{chunk-KPFMOZXV.mjs.map → chunk-2AWSOSQI.mjs.map} +1 -1
- package/dist/{chunk-HJPB4KC3.mjs → chunk-ML727RRJ.mjs} +1 -1
- package/dist/chunk-ML727RRJ.mjs.map +1 -0
- package/dist/function/index.mjs +6 -6
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +70 -70
- package/dist/string/index.js +8 -1
- package/dist/string/index.js.map +1 -1
- package/dist/string/index.mjs +1 -1
- package/dist/string/lowerCase.js +8 -1
- package/dist/string/lowerCase.js.map +1 -1
- package/dist/string/lowerCase.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-HJPB4KC3.mjs.map +0 -1
- package/dist/chunk-KPFMOZXV.mjs +0 -14
package/dist/index.mjs
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-XWJ7NQF4.mjs";
|
|
15
15
|
import {
|
|
16
16
|
lowerCase
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-2AWSOSQI.mjs";
|
|
18
18
|
import "./chunk-MAJSPFA6.mjs";
|
|
19
19
|
import {
|
|
20
20
|
isNull
|
|
@@ -44,19 +44,6 @@ import {
|
|
|
44
44
|
import {
|
|
45
45
|
pickBy
|
|
46
46
|
} from "./chunk-6CLH5YZ2.mjs";
|
|
47
|
-
import "./chunk-N6EM6ETS.mjs";
|
|
48
|
-
import {
|
|
49
|
-
debounce
|
|
50
|
-
} from "./chunk-3IP4JVLL.mjs";
|
|
51
|
-
import {
|
|
52
|
-
noop
|
|
53
|
-
} from "./chunk-LKXCOLNY.mjs";
|
|
54
|
-
import {
|
|
55
|
-
once
|
|
56
|
-
} from "./chunk-CMBC4MXG.mjs";
|
|
57
|
-
import {
|
|
58
|
-
throttle
|
|
59
|
-
} from "./chunk-QOJGMVVR.mjs";
|
|
60
47
|
import "./chunk-TLVQSNOE.mjs";
|
|
61
48
|
import {
|
|
62
49
|
meanBy
|
|
@@ -80,15 +67,6 @@ import {
|
|
|
80
67
|
inRange
|
|
81
68
|
} from "./chunk-BH6HLGBA.mjs";
|
|
82
69
|
import "./chunk-2MRZANXZ.mjs";
|
|
83
|
-
import {
|
|
84
|
-
unzipWith
|
|
85
|
-
} from "./chunk-IFNXROZR.mjs";
|
|
86
|
-
import {
|
|
87
|
-
without
|
|
88
|
-
} from "./chunk-PYEYV7BY.mjs";
|
|
89
|
-
import {
|
|
90
|
-
xor
|
|
91
|
-
} from "./chunk-L7FQX5MN.mjs";
|
|
92
70
|
import {
|
|
93
71
|
xorBy
|
|
94
72
|
} from "./chunk-Q47NGNXT.mjs";
|
|
@@ -104,21 +82,9 @@ import {
|
|
|
104
82
|
import {
|
|
105
83
|
zipWith
|
|
106
84
|
} from "./chunk-4KYXHZ4R.mjs";
|
|
107
|
-
import {
|
|
108
|
-
toFilled
|
|
109
|
-
} from "./chunk-OP4OAKQJ.mjs";
|
|
110
|
-
import {
|
|
111
|
-
union
|
|
112
|
-
} from "./chunk-R6QA7PLZ.mjs";
|
|
113
|
-
import {
|
|
114
|
-
unionBy
|
|
115
|
-
} from "./chunk-NFS7RWWE.mjs";
|
|
116
85
|
import {
|
|
117
86
|
unionWith
|
|
118
87
|
} from "./chunk-2ZCITDMK.mjs";
|
|
119
|
-
import {
|
|
120
|
-
uniq
|
|
121
|
-
} from "./chunk-DVK2N4KC.mjs";
|
|
122
88
|
import {
|
|
123
89
|
uniqBy
|
|
124
90
|
} from "./chunk-OXAZEEGP.mjs";
|
|
@@ -129,20 +95,14 @@ import {
|
|
|
129
95
|
unzip
|
|
130
96
|
} from "./chunk-UYZKMBDO.mjs";
|
|
131
97
|
import {
|
|
132
|
-
|
|
133
|
-
} from "./chunk-
|
|
134
|
-
import {
|
|
135
|
-
sampleSize
|
|
136
|
-
} from "./chunk-EHSKB6DF.mjs";
|
|
137
|
-
import {
|
|
138
|
-
randomInt
|
|
139
|
-
} from "./chunk-GIWAOOFY.mjs";
|
|
98
|
+
unzipWith
|
|
99
|
+
} from "./chunk-IFNXROZR.mjs";
|
|
140
100
|
import {
|
|
141
|
-
|
|
142
|
-
} from "./chunk-
|
|
101
|
+
without
|
|
102
|
+
} from "./chunk-PYEYV7BY.mjs";
|
|
143
103
|
import {
|
|
144
|
-
|
|
145
|
-
} from "./chunk-
|
|
104
|
+
xor
|
|
105
|
+
} from "./chunk-L7FQX5MN.mjs";
|
|
146
106
|
import {
|
|
147
107
|
tail
|
|
148
108
|
} from "./chunk-OF6NM4G7.mjs";
|
|
@@ -159,14 +119,17 @@ import {
|
|
|
159
119
|
takeWhile
|
|
160
120
|
} from "./chunk-2IXFGSUA.mjs";
|
|
161
121
|
import {
|
|
162
|
-
|
|
163
|
-
} from "./chunk-
|
|
122
|
+
toFilled
|
|
123
|
+
} from "./chunk-OP4OAKQJ.mjs";
|
|
164
124
|
import {
|
|
165
|
-
|
|
166
|
-
} from "./chunk-
|
|
125
|
+
union
|
|
126
|
+
} from "./chunk-R6QA7PLZ.mjs";
|
|
167
127
|
import {
|
|
168
|
-
|
|
169
|
-
} from "./chunk-
|
|
128
|
+
uniq
|
|
129
|
+
} from "./chunk-DVK2N4KC.mjs";
|
|
130
|
+
import {
|
|
131
|
+
unionBy
|
|
132
|
+
} from "./chunk-NFS7RWWE.mjs";
|
|
170
133
|
import {
|
|
171
134
|
last
|
|
172
135
|
} from "./chunk-KPBQ7OUY.mjs";
|
|
@@ -183,14 +146,20 @@ import {
|
|
|
183
146
|
partition
|
|
184
147
|
} from "./chunk-DN3NOZ3H.mjs";
|
|
185
148
|
import {
|
|
186
|
-
|
|
187
|
-
} from "./chunk-
|
|
149
|
+
sample
|
|
150
|
+
} from "./chunk-2KNLZB7V.mjs";
|
|
188
151
|
import {
|
|
189
|
-
|
|
190
|
-
} from "./chunk-
|
|
152
|
+
sampleSize
|
|
153
|
+
} from "./chunk-EHSKB6DF.mjs";
|
|
191
154
|
import {
|
|
192
|
-
|
|
193
|
-
} from "./chunk-
|
|
155
|
+
randomInt
|
|
156
|
+
} from "./chunk-GIWAOOFY.mjs";
|
|
157
|
+
import {
|
|
158
|
+
random
|
|
159
|
+
} from "./chunk-SYWMYQYJ.mjs";
|
|
160
|
+
import {
|
|
161
|
+
shuffle
|
|
162
|
+
} from "./chunk-G7UQ5PUR.mjs";
|
|
194
163
|
import {
|
|
195
164
|
groupBy
|
|
196
165
|
} from "./chunk-E6E4RZLN.mjs";
|
|
@@ -204,14 +173,14 @@ import {
|
|
|
204
173
|
intersection
|
|
205
174
|
} from "./chunk-FVVSE2F2.mjs";
|
|
206
175
|
import {
|
|
207
|
-
|
|
208
|
-
} from "./chunk-
|
|
176
|
+
intersectionBy
|
|
177
|
+
} from "./chunk-O6UXZR3U.mjs";
|
|
209
178
|
import {
|
|
210
|
-
|
|
211
|
-
} from "./chunk-
|
|
179
|
+
intersectionWith
|
|
180
|
+
} from "./chunk-XI7KRD2C.mjs";
|
|
212
181
|
import {
|
|
213
|
-
|
|
214
|
-
} from "./chunk-
|
|
182
|
+
keyBy
|
|
183
|
+
} from "./chunk-AJKZMN2V.mjs";
|
|
215
184
|
import {
|
|
216
185
|
drop
|
|
217
186
|
} from "./chunk-S3CORED5.mjs";
|
|
@@ -227,12 +196,15 @@ import {
|
|
|
227
196
|
import {
|
|
228
197
|
fill
|
|
229
198
|
} from "./chunk-C4WE4GLC.mjs";
|
|
230
|
-
import "./chunk-2M3YVRFS.mjs";
|
|
231
|
-
import "./chunk-IJJCMZIV.mjs";
|
|
232
|
-
import "./chunk-FZEZH22H.mjs";
|
|
233
199
|
import {
|
|
234
|
-
|
|
235
|
-
} from "./chunk-
|
|
200
|
+
flattenDeep
|
|
201
|
+
} from "./chunk-ML727RRJ.mjs";
|
|
202
|
+
import {
|
|
203
|
+
flatten
|
|
204
|
+
} from "./chunk-33MSBDC6.mjs";
|
|
205
|
+
import {
|
|
206
|
+
forEachRight
|
|
207
|
+
} from "./chunk-IEA53J7P.mjs";
|
|
236
208
|
import {
|
|
237
209
|
chunk
|
|
238
210
|
} from "./chunk-E6C5EZQA.mjs";
|
|
@@ -242,6 +214,34 @@ import {
|
|
|
242
214
|
import {
|
|
243
215
|
countBy
|
|
244
216
|
} from "./chunk-CRSKT4WW.mjs";
|
|
217
|
+
import {
|
|
218
|
+
difference
|
|
219
|
+
} from "./chunk-JPUKH67K.mjs";
|
|
220
|
+
import {
|
|
221
|
+
differenceBy
|
|
222
|
+
} from "./chunk-LVWX5B43.mjs";
|
|
223
|
+
import {
|
|
224
|
+
differenceWith
|
|
225
|
+
} from "./chunk-6NVQAHXP.mjs";
|
|
226
|
+
import "./chunk-2M3YVRFS.mjs";
|
|
227
|
+
import "./chunk-IJJCMZIV.mjs";
|
|
228
|
+
import "./chunk-FZEZH22H.mjs";
|
|
229
|
+
import {
|
|
230
|
+
AbortError
|
|
231
|
+
} from "./chunk-DXB7EZUQ.mjs";
|
|
232
|
+
import "./chunk-N6EM6ETS.mjs";
|
|
233
|
+
import {
|
|
234
|
+
once
|
|
235
|
+
} from "./chunk-CMBC4MXG.mjs";
|
|
236
|
+
import {
|
|
237
|
+
throttle
|
|
238
|
+
} from "./chunk-QOJGMVVR.mjs";
|
|
239
|
+
import {
|
|
240
|
+
debounce
|
|
241
|
+
} from "./chunk-3IP4JVLL.mjs";
|
|
242
|
+
import {
|
|
243
|
+
noop
|
|
244
|
+
} from "./chunk-LKXCOLNY.mjs";
|
|
245
245
|
import "./chunk-2MM5EJJX.mjs";
|
|
246
246
|
export {
|
|
247
247
|
AbortError,
|
package/dist/string/index.js
CHANGED
|
@@ -45,7 +45,14 @@ var kebabCase = (str) => {
|
|
|
45
45
|
// src/string/lowerCase.ts
|
|
46
46
|
var lowerCase = (str) => {
|
|
47
47
|
const splitWords = str.match(CASE_SPLIT_PATTERN) || [];
|
|
48
|
-
|
|
48
|
+
if (splitWords.length === 0) {
|
|
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;
|
|
49
56
|
};
|
|
50
57
|
|
|
51
58
|
// src/string/capitalize.ts
|
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/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 */\
|
|
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 */\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","/**\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;;;ACJO,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;;;ACjBO,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
package/dist/string/lowerCase.js
CHANGED
|
@@ -30,7 +30,14 @@ var CASE_SPLIT_PATTERN = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[
|
|
|
30
30
|
// src/string/lowerCase.ts
|
|
31
31
|
var lowerCase = (str) => {
|
|
32
32
|
const splitWords = str.match(CASE_SPLIT_PATTERN) || [];
|
|
33
|
-
|
|
33
|
+
if (splitWords.length === 0) {
|
|
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;
|
|
34
41
|
};
|
|
35
42
|
// Annotate the CommonJS export names for ESM import in node:
|
|
36
43
|
0 && (module.exports = {
|
|
@@ -1 +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 */\
|
|
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 */\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","/**\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;;;ADD3B,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/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.187+98b1ca88",
|
|
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
|
-
{"version":3,"sources":["../src/array/flattenDeep.ts"],"sourcesContent":["import { flatten } from './flatten';\n\n/**\n * Utility type for recursively unpacking nested array types to extract the type of the innermost element\n *\n * @example\n * ExtractNestedArrayType<(number | (number | number[])[])[]>\n * // number\n *\n * ExtractNestedArrayType<(boolean | (string | number[])[])[]>\n * // string | number | boolean\n */\ntype ExtractNestedArrayType<T> = T extends ReadonlyArray<infer U> ? ExtractNestedArrayType<U> : T;\n\n/**\n * Flattens all depths of a nested array.\n *\n * @template T - The type of elements within the array.\n * @param {T[]} arr - The array to flatten.\n * @returns {Array<ExtractNestedArrayType<T>>} A new array that has been flattened.\n *\n * @example\n * const arr = flattenDeep([1, [2, [3]], [4, [5, 6]]]);\n * // Returns: [1, 2, 3, 4, 5, 6]\n */\nexport function flattenDeep<T>(arr: readonly T[]): Array<ExtractNestedArrayType<T>> {\n return flatten(arr, Infinity) as Array<ExtractNestedArrayType<T>>;\n}\n"],"mappings":";;;;;AAyBO,SAAS,YAAe,KAAqD;AAClF,SAAO,QAAQ,KAAK,QAAQ;AAC9B;","names":[]}
|
package/dist/chunk-KPFMOZXV.mjs
DELETED
|
@@ -1,14 +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
|
-
return splitWords.map((word) => word.toLowerCase()).join(" ");
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
lowerCase
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=chunk-KPFMOZXV.mjs.map
|