es-toolkit 1.13.1-dev.318 → 1.13.1-dev.320
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 +60 -60
- package/dist/browser.js +11 -0
- package/dist/browser.js.map +1 -1
- package/dist/browser.mjs +33 -32
- package/dist/browser.mjs.map +1 -1
- package/dist/chunk-STL6TD3L.mjs +1 -0
- package/dist/chunk-SXFMQQ6F.mjs +9 -0
- package/dist/chunk-SXFMQQ6F.mjs.map +1 -0
- package/dist/{chunk-36ZJSTNA.mjs → chunk-YNJH6GEG.mjs} +83 -73
- package/dist/chunk-YNJH6GEG.mjs.map +1 -0
- package/dist/compat/index.d.mts +19 -1
- package/dist/compat/index.d.ts +19 -1
- package/dist/compat/index.js +12 -0
- package/dist/compat/index.js.map +1 -1
- package/dist/compat/index.mjs +77 -74
- package/dist/error/index.mjs +3 -3
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +78 -74
- package/dist/predicate/index.d.mts +1 -0
- package/dist/predicate/index.d.ts +1 -0
- package/dist/predicate/index.js +7 -0
- package/dist/predicate/index.js.map +1 -1
- package/dist/predicate/index.mjs +5 -1
- package/dist/predicate/isTypedArray.d.mts +19 -0
- package/dist/predicate/isTypedArray.d.ts +19 -0
- package/dist/predicate/isTypedArray.js +33 -0
- package/dist/predicate/isTypedArray.js.map +1 -0
- package/dist/predicate/isTypedArray.mjs +8 -0
- package/dist/predicate/isTypedArray.mjs.map +1 -0
- package/dist/promise/index.mjs +1 -1
- package/dist/promise/timeout.mjs +1 -1
- package/dist/promise/withTimeout.mjs +1 -1
- package/dist/string/index.mjs +3 -3
- package/package.json +1 -1
- package/umd/browser.global.js +1 -1
- package/dist/chunk-36ZJSTNA.mjs.map +0 -1
- package/dist/chunk-U4JWMVQK.mjs +0 -1
- /package/dist/{chunk-U4JWMVQK.mjs.map → chunk-STL6TD3L.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,13 @@ import {
|
|
|
4
4
|
withTimeout
|
|
5
5
|
} from "./chunk-IIDZ3KAJ.mjs";
|
|
6
6
|
import "./chunk-CVVZHOJX.mjs";
|
|
7
|
+
import {
|
|
8
|
+
delay
|
|
9
|
+
} from "./chunk-O64NE2P4.mjs";
|
|
7
10
|
import "./chunk-XT74R35S.mjs";
|
|
11
|
+
import {
|
|
12
|
+
lowerCase
|
|
13
|
+
} from "./chunk-5IKVJGHO.mjs";
|
|
8
14
|
import {
|
|
9
15
|
snakeCase
|
|
10
16
|
} from "./chunk-F3WCQQET.mjs";
|
|
@@ -20,14 +26,8 @@ import {
|
|
|
20
26
|
import {
|
|
21
27
|
kebabCase
|
|
22
28
|
} from "./chunk-EYYZQFOP.mjs";
|
|
23
|
-
import {
|
|
24
|
-
lowerCase
|
|
25
|
-
} from "./chunk-5IKVJGHO.mjs";
|
|
26
29
|
import "./chunk-WVQ7YVRK.mjs";
|
|
27
|
-
import
|
|
28
|
-
delay
|
|
29
|
-
} from "./chunk-O64NE2P4.mjs";
|
|
30
|
-
import "./chunk-U4JWMVQK.mjs";
|
|
30
|
+
import "./chunk-STL6TD3L.mjs";
|
|
31
31
|
import {
|
|
32
32
|
isFunction
|
|
33
33
|
} from "./chunk-74CREQXW.mjs";
|
|
@@ -40,6 +40,9 @@ import {
|
|
|
40
40
|
import {
|
|
41
41
|
isNull
|
|
42
42
|
} from "./chunk-AIRSKN47.mjs";
|
|
43
|
+
import {
|
|
44
|
+
isTypedArray
|
|
45
|
+
} from "./chunk-SXFMQQ6F.mjs";
|
|
43
46
|
import {
|
|
44
47
|
isUndefined
|
|
45
48
|
} from "./chunk-VH2PV426.mjs";
|
|
@@ -105,6 +108,10 @@ import {
|
|
|
105
108
|
import {
|
|
106
109
|
sum
|
|
107
110
|
} from "./chunk-2SLTL4KL.mjs";
|
|
111
|
+
import "./chunk-F47GLYUU.mjs";
|
|
112
|
+
import {
|
|
113
|
+
TimeoutError
|
|
114
|
+
} from "./chunk-KIOYQRMQ.mjs";
|
|
108
115
|
import "./chunk-ZA2XI3OV.mjs";
|
|
109
116
|
import {
|
|
110
117
|
throttle
|
|
@@ -124,13 +131,40 @@ import {
|
|
|
124
131
|
import {
|
|
125
132
|
once
|
|
126
133
|
} from "./chunk-CMBC4MXG.mjs";
|
|
134
|
+
import {
|
|
135
|
+
AbortError
|
|
136
|
+
} from "./chunk-DXB7EZUQ.mjs";
|
|
127
137
|
import "./chunk-DDH7K4QM.mjs";
|
|
138
|
+
import {
|
|
139
|
+
xor
|
|
140
|
+
} from "./chunk-L7FQX5MN.mjs";
|
|
141
|
+
import {
|
|
142
|
+
xorBy
|
|
143
|
+
} from "./chunk-Q47NGNXT.mjs";
|
|
144
|
+
import {
|
|
145
|
+
xorWith
|
|
146
|
+
} from "./chunk-QRSJBBFY.mjs";
|
|
147
|
+
import {
|
|
148
|
+
zip
|
|
149
|
+
} from "./chunk-OLORW442.mjs";
|
|
128
150
|
import {
|
|
129
151
|
zipObject
|
|
130
152
|
} from "./chunk-6GWEY5EL.mjs";
|
|
131
153
|
import {
|
|
132
154
|
zipWith
|
|
133
155
|
} from "./chunk-4KYXHZ4R.mjs";
|
|
156
|
+
import {
|
|
157
|
+
unionBy
|
|
158
|
+
} from "./chunk-NFS7RWWE.mjs";
|
|
159
|
+
import {
|
|
160
|
+
unionWith
|
|
161
|
+
} from "./chunk-2ZCITDMK.mjs";
|
|
162
|
+
import {
|
|
163
|
+
uniqBy
|
|
164
|
+
} from "./chunk-B4COTK4K.mjs";
|
|
165
|
+
import {
|
|
166
|
+
uniqWith
|
|
167
|
+
} from "./chunk-237HGSZS.mjs";
|
|
134
168
|
import {
|
|
135
169
|
unzip
|
|
136
170
|
} from "./chunk-UYZKMBDO.mjs";
|
|
@@ -141,17 +175,17 @@ import {
|
|
|
141
175
|
without
|
|
142
176
|
} from "./chunk-PYEYV7BY.mjs";
|
|
143
177
|
import {
|
|
144
|
-
|
|
145
|
-
} from "./chunk-
|
|
178
|
+
shuffle
|
|
179
|
+
} from "./chunk-G7UQ5PUR.mjs";
|
|
146
180
|
import {
|
|
147
|
-
|
|
148
|
-
} from "./chunk-
|
|
181
|
+
tail
|
|
182
|
+
} from "./chunk-TJ4Z5I7M.mjs";
|
|
149
183
|
import {
|
|
150
|
-
|
|
151
|
-
} from "./chunk-
|
|
184
|
+
take
|
|
185
|
+
} from "./chunk-ME352XO7.mjs";
|
|
152
186
|
import {
|
|
153
|
-
|
|
154
|
-
} from "./chunk-
|
|
187
|
+
takeRight
|
|
188
|
+
} from "./chunk-N3QYJX4T.mjs";
|
|
155
189
|
import {
|
|
156
190
|
takeRightWhile
|
|
157
191
|
} from "./chunk-NTLX2MPV.mjs";
|
|
@@ -165,20 +199,20 @@ import {
|
|
|
165
199
|
union
|
|
166
200
|
} from "./chunk-R6QA7PLZ.mjs";
|
|
167
201
|
import {
|
|
168
|
-
|
|
169
|
-
} from "./chunk-
|
|
202
|
+
uniq
|
|
203
|
+
} from "./chunk-DVK2N4KC.mjs";
|
|
170
204
|
import {
|
|
171
|
-
|
|
172
|
-
} from "./chunk-
|
|
205
|
+
keyBy
|
|
206
|
+
} from "./chunk-AJKZMN2V.mjs";
|
|
173
207
|
import {
|
|
174
|
-
|
|
175
|
-
} from "./chunk-
|
|
208
|
+
last
|
|
209
|
+
} from "./chunk-KPBQ7OUY.mjs";
|
|
176
210
|
import {
|
|
177
|
-
|
|
178
|
-
} from "./chunk-
|
|
211
|
+
maxBy
|
|
212
|
+
} from "./chunk-OOKNBU4V.mjs";
|
|
179
213
|
import {
|
|
180
|
-
|
|
181
|
-
} from "./chunk-
|
|
214
|
+
minBy
|
|
215
|
+
} from "./chunk-IJD7FE2Z.mjs";
|
|
182
216
|
import {
|
|
183
217
|
orderBy
|
|
184
218
|
} from "./chunk-7B7W36UP.mjs";
|
|
@@ -198,17 +232,14 @@ import {
|
|
|
198
232
|
random
|
|
199
233
|
} from "./chunk-SYWMYQYJ.mjs";
|
|
200
234
|
import {
|
|
201
|
-
|
|
202
|
-
} from "./chunk-
|
|
203
|
-
import {
|
|
204
|
-
tail
|
|
205
|
-
} from "./chunk-TJ4Z5I7M.mjs";
|
|
235
|
+
forEachRight
|
|
236
|
+
} from "./chunk-IEA53J7P.mjs";
|
|
206
237
|
import {
|
|
207
|
-
|
|
208
|
-
} from "./chunk-
|
|
238
|
+
groupBy
|
|
239
|
+
} from "./chunk-E6E4RZLN.mjs";
|
|
209
240
|
import {
|
|
210
|
-
|
|
211
|
-
} from "./chunk-
|
|
241
|
+
head
|
|
242
|
+
} from "./chunk-HM2JT2RX.mjs";
|
|
212
243
|
import {
|
|
213
244
|
initial
|
|
214
245
|
} from "./chunk-XPSOKBRZ.mjs";
|
|
@@ -222,17 +253,17 @@ import {
|
|
|
222
253
|
intersectionWith
|
|
223
254
|
} from "./chunk-XI7KRD2C.mjs";
|
|
224
255
|
import {
|
|
225
|
-
|
|
226
|
-
} from "./chunk-
|
|
256
|
+
drop
|
|
257
|
+
} from "./chunk-3EZAFZG3.mjs";
|
|
227
258
|
import {
|
|
228
|
-
|
|
229
|
-
} from "./chunk-
|
|
259
|
+
dropRight
|
|
260
|
+
} from "./chunk-OXZCMC5I.mjs";
|
|
230
261
|
import {
|
|
231
|
-
|
|
232
|
-
} from "./chunk-
|
|
262
|
+
dropRightWhile
|
|
263
|
+
} from "./chunk-M7SBBYV2.mjs";
|
|
233
264
|
import {
|
|
234
|
-
|
|
235
|
-
} from "./chunk-
|
|
265
|
+
dropWhile
|
|
266
|
+
} from "./chunk-LJ2C6MVP.mjs";
|
|
236
267
|
import {
|
|
237
268
|
fill
|
|
238
269
|
} from "./chunk-YFN6KOC4.mjs";
|
|
@@ -246,14 +277,11 @@ import {
|
|
|
246
277
|
flatten
|
|
247
278
|
} from "./chunk-33MSBDC6.mjs";
|
|
248
279
|
import {
|
|
249
|
-
|
|
250
|
-
} from "./chunk-
|
|
251
|
-
import {
|
|
252
|
-
groupBy
|
|
253
|
-
} from "./chunk-E6E4RZLN.mjs";
|
|
280
|
+
chunk
|
|
281
|
+
} from "./chunk-E6C5EZQA.mjs";
|
|
254
282
|
import {
|
|
255
|
-
|
|
256
|
-
} from "./chunk-
|
|
283
|
+
compact
|
|
284
|
+
} from "./chunk-DTJJIMKJ.mjs";
|
|
257
285
|
import {
|
|
258
286
|
countBy
|
|
259
287
|
} from "./chunk-CRSKT4WW.mjs";
|
|
@@ -266,31 +294,6 @@ import {
|
|
|
266
294
|
import {
|
|
267
295
|
differenceWith
|
|
268
296
|
} from "./chunk-6NVQAHXP.mjs";
|
|
269
|
-
import {
|
|
270
|
-
drop
|
|
271
|
-
} from "./chunk-3EZAFZG3.mjs";
|
|
272
|
-
import {
|
|
273
|
-
dropRight
|
|
274
|
-
} from "./chunk-OXZCMC5I.mjs";
|
|
275
|
-
import {
|
|
276
|
-
dropRightWhile
|
|
277
|
-
} from "./chunk-M7SBBYV2.mjs";
|
|
278
|
-
import {
|
|
279
|
-
dropWhile
|
|
280
|
-
} from "./chunk-LJ2C6MVP.mjs";
|
|
281
|
-
import "./chunk-F47GLYUU.mjs";
|
|
282
|
-
import {
|
|
283
|
-
AbortError
|
|
284
|
-
} from "./chunk-DXB7EZUQ.mjs";
|
|
285
|
-
import {
|
|
286
|
-
TimeoutError
|
|
287
|
-
} from "./chunk-KIOYQRMQ.mjs";
|
|
288
|
-
import {
|
|
289
|
-
chunk
|
|
290
|
-
} from "./chunk-E6C5EZQA.mjs";
|
|
291
|
-
import {
|
|
292
|
-
compact
|
|
293
|
-
} from "./chunk-DTJJIMKJ.mjs";
|
|
294
297
|
import "./chunk-24FKGR6U.mjs";
|
|
295
298
|
export {
|
|
296
299
|
AbortError,
|
|
@@ -335,6 +338,7 @@ export {
|
|
|
335
338
|
isNotNil,
|
|
336
339
|
isNull,
|
|
337
340
|
isPlainObject,
|
|
341
|
+
isTypedArray,
|
|
338
342
|
isUndefined,
|
|
339
343
|
kebabCase,
|
|
340
344
|
keyBy,
|
package/dist/predicate/index.js
CHANGED
|
@@ -28,6 +28,7 @@ __export(predicate_exports, {
|
|
|
28
28
|
isNotNil: () => isNotNil,
|
|
29
29
|
isNull: () => isNull,
|
|
30
30
|
isPlainObject: () => isPlainObject,
|
|
31
|
+
isTypedArray: () => isTypedArray,
|
|
31
32
|
isUndefined: () => isUndefined
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(predicate_exports);
|
|
@@ -130,6 +131,11 @@ function isFunction(value) {
|
|
|
130
131
|
function isArrayLike(value) {
|
|
131
132
|
return value != null && typeof value !== "function" && isLength(value.length);
|
|
132
133
|
}
|
|
134
|
+
|
|
135
|
+
// src/predicate/isTypedArray.ts
|
|
136
|
+
function isTypedArray(x) {
|
|
137
|
+
return x instanceof Uint8Array || x instanceof Uint8ClampedArray || x instanceof Uint16Array || x instanceof Uint32Array || x instanceof BigUint64Array || x instanceof Int8Array || x instanceof Int16Array || x instanceof Int32Array || x instanceof BigInt64Array || x instanceof Float32Array || x instanceof Float64Array;
|
|
138
|
+
}
|
|
133
139
|
// Annotate the CommonJS export names for ESM import in node:
|
|
134
140
|
0 && (module.exports = {
|
|
135
141
|
isArrayLike,
|
|
@@ -140,6 +146,7 @@ function isArrayLike(value) {
|
|
|
140
146
|
isNotNil,
|
|
141
147
|
isNull,
|
|
142
148
|
isPlainObject,
|
|
149
|
+
isTypedArray,
|
|
143
150
|
isUndefined
|
|
144
151
|
});
|
|
145
152
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/predicate/index.ts","../../src/array/uniq.ts","../../src/array/union.ts","../../src/predicate/isEqual.ts","../../src/predicate/isNil.ts","../../src/predicate/isNotNil.ts","../../src/predicate/isNull.ts","../../src/predicate/isUndefined.ts","../../src/predicate/isLength.ts","../../src/predicate/isPlainObject.ts","../../src/predicate/isFunction.ts","../../src/predicate/isArrayLike.ts"],"sourcesContent":["export { isEqual } from './isEqual.ts';\nexport { isNil } from './isNil.ts';\nexport { isNotNil } from './isNotNil.ts';\nexport { isNull } from './isNull.ts';\nexport { isUndefined } from './isUndefined.ts';\nexport { isLength } from './isLength.ts';\nexport { isPlainObject } from './isPlainObject.ts';\nexport { isFunction } from './isFunction.ts';\nexport { isArrayLike } from './isArrayLike.ts';\n","/**\n * Creates a duplicate-free version of an array.\n *\n * This function takes an array and returns a new array containing only the unique values\n * from the original array, preserving the order of first occurrence.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array to process.\n * @returns {T[]} A new array with only unique values from the original array.\n *\n * @example\n * const array = [1, 2, 2, 3, 4, 4, 5];\n * const result = uniq(array);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function uniq<T>(arr: readonly T[]): T[] {\n return Array.from(new Set(arr));\n}\n","import { uniq } from './uniq.ts';\n\n/**\n * Creates an array of unique values from all given arrays.\n *\n * This function takes two arrays, merges them into a single array, and returns a new array\n * containing only the unique values from the merged array.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr1 - The first array to merge and filter for unique values.\n * @param {T[]} arr2 - The second array to merge and filter for unique values.\n * @returns {T[]} A new array of unique values.\n *\n * @example\n * const array1 = [1, 2, 3];\n * const array2 = [3, 4, 5];\n * const result = union(array1, array2);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function union<T>(arr1: readonly T[], arr2: readonly T[]): T[] {\n return uniq(arr1.concat(arr2));\n}\n","import { union } from \"../array/union.ts\";\n\n/**\n * Checks if two values are equal, including support for `Date`, `RegExp`, and deep object comparison.\n *\n * @param {unknown} a - The first value to compare.\n * @param {unknown} b - The second value to compare.\n * @returns {boolean} `true` if the values are equal, otherwise `false`.\n *\n * @example\n * isEqual(1, 1); // true\n * isEqual({ a: 1 }, { a: 1 }); // true\n * isEqual(/abc/g, /abc/g); // true\n * isEqual(new Date('2020-01-01'), new Date('2020-01-01')); // true\n * isEqual([1, 2, 3], [1, 2, 3]); // true\n */\nexport function isEqual(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) {\n return true;\n }\n\n if (a instanceof Date && b instanceof Date) {\n return a.getTime() === b.getTime();\n }\n\n if (a instanceof RegExp && b instanceof RegExp) {\n return a.source === b.source && a.flags === b.flags;\n }\n\n if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null) {\n return false;\n }\n\n const aKeys = Object.keys(a as object);\n const bKeys = Object.keys(b as object);\n\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n\n // check if all keys in both arrays match\n if (union(aKeys, bKeys).length !== aKeys.length) {\n return false;\n }\n\n for (let i = 0; i < aKeys.length; i++) {\n const propKey = aKeys[i];\n const aProp = (a as any)[propKey];\n const bProp = (b as any)[propKey];\n \n if (!isEqual(aProp, bProp)) {\n return false;\n }\n }\n\n return true;\n}\n","/**\n * Checks if a given value is null or undefined.\n *\n * This function tests whether the provided value is either `null` or `undefined`.\n * It returns `true` if the value is `null` or `undefined`, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null` or `undefined`.\n *\n * @param {unknown} x - The value to test for null or undefined.\n * @returns {boolean} `true` if the value is null or undefined, `false` otherwise.\n *\n * @example\n * const value1 = null;\n * const value2 = undefined;\n * const value3 = 42;\n * const result1 = isNil(value1); // true\n * const result2 = isNil(value2); // true\n * const result3 = isNil(value3); // false\n */\nexport function isNil(x: unknown): x is null | undefined {\n return x == null;\n}\n","/**\n * Checks if the given value is not null nor undefined.\n *\n * The main use of this function is to be used with TypeScript as a type predicate.\n *\n * @template T - The type of value.\n * @param {T | null | undefined} x - The value to test if it is not null nor undefined.\n * @returns {x is T} True if the value is not null nor undefined, false otherwise.\n *\n * @example\n * // Here the type of `arr` is (number | undefined)[]\n * const arr = [1, undefined, 3];\n * // Here the type of `result` is number[]\n * const result = arr.filter(isNotNil);\n * // result will be [1, 3]\n */\nexport function isNotNil<T>(x: T | null | undefined): x is T {\n return x !== null && x !== undefined;\n}\n","/**\n * Checks if the given value is null.\n *\n * This function tests whether the provided value is strictly equal to `null`.\n * It returns `true` if the value is `null`, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null`.\n *\n * @param {unknown} x - The value to test if it is null.\n * @returns {x is null} True if the value is null, false otherwise.\n *\n * @example\n * const value1 = null;\n * const value2 = undefined;\n * const value3 = 42;\n *\n * console.log(isNull(value1)); // true\n * console.log(isNull(value2)); // false\n * console.log(isNull(value3)); // false\n */\nexport function isNull(x: unknown): x is null {\n return x === null;\n}\n","/**\n * Checks if the given value is undefined.\n *\n * This function tests whether the provided value is strictly equal to `undefined`.\n * It returns `true` if the value is `undefined`, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `undefined`.\n *\n * @param {unknown} x - The value to test if it is undefined.\n * @returns {x is undefined} true if the value is undefined, false otherwise.\n *\n * @example\n * const value1 = undefined;\n * const value2 = null;\n * const value3 = 42;\n *\n * console.log(isUndefined(value1)); // true\n * console.log(isUndefined(value2)); // false\n * console.log(isUndefined(value3)); // false\n */\nexport function isUndefined(x: unknown): x is undefined {\n return x === undefined;\n}\n","export function isLength(value: unknown): value is number {\n return typeof value === 'number' && value > -1 && value % 1 === 0 && value <= Number.MAX_SAFE_INTEGER;\n}\n","/**\n * Checks if a given value is a plain object.\n * \n * @param {object} object - The value to check.\n * @returns {boolean} - True if the value is a plain object, otherwise false.\n * \n * @example\n * console.log(isPlainObject({})); // true\n * console.log(isPlainObject([])); // false\n * console.log(isPlainObject(null)); // false\n * console.log(isPlainObject(Object.create(null))); // true\n * console.log(Buffer.from('hello, world')); // false\n */\nexport function isPlainObject(object: object): boolean {\n if (typeof object !== 'object') {\n return false;\n }\n\n if (object == null) {\n return false;\n }\n\n if (Object.getPrototypeOf(object) === null) {\n return true;\n }\n\n if (object.toString() !== '[object Object]') {\n return false;\n }\n\n let proto = object;\n\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n\n return Object.getPrototypeOf(object) === proto;\n}","/**\n * Checks if `value` is a function.\n *\n * @param {unknown} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n *\n * @example\n * isFunction(Array.prototype.slice); // true\n * isFunction(async function () {}); // true\n * isFunction(function* () {}); // true\n * isFunction(Proxy); // true\n * isFunction(Int8Array); // true\n */\nexport function isFunction(value: unknown): value is (...args: unknown[]) => unknown {\n return typeof value === 'function';\n}\n","import { isLength } from \"./isLength.ts\";\n\n/**\n * Checks if `value` is array-like.\n *\n * @param {unknown} value The value to check.\n * @returns {value is ArrayLike<unknown>} Returns `true` if `value` is array-like, else `false`.\n *\n * @example\n * isArrayLike([1, 2, 3]); // true\n * isArrayLike('abc'); // true\n * isArrayLike({ 0: 'a', length: 1 }); // true\n * isArrayLike({}); // false\n * isArrayLike(null); // false\n * isArrayLike(undefined); // false\n */\nexport function isArrayLike(value: unknown): value is ArrayLike<unknown> {\n return value != null && typeof value !== \"function\" &&\n isLength((value as ArrayLike<unknown>).length);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACeO,SAAS,KAAQ,KAAwB;AAC9C,SAAO,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC;AAChC;;;ACEO,SAAS,MAAS,MAAoB,MAAyB;AACpE,SAAO,KAAK,KAAK,OAAO,IAAI,CAAC;AAC/B;;;ACLO,SAAS,QAAQ,GAAY,GAAqB;AACvD,MAAI,OAAO,GAAG,GAAG,CAAC,GAAG;AACnB,WAAO;AAAA,EACT;AAEA,MAAI,aAAa,QAAQ,aAAa,MAAM;AAC1C,WAAO,EAAE,QAAQ,MAAM,EAAE,QAAQ;AAAA,EACnC;AAEA,MAAI,aAAa,UAAU,aAAa,QAAQ;AAC9C,WAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE;AAAA,EAChD;AAEA,MAAI,OAAO,MAAM,YAAY,OAAO,MAAM,YAAY,MAAM,QAAQ,MAAM,MAAM;AAC9E,WAAO;AAAA,EACT;AAEA,QAAM,QAAQ,OAAO,KAAK,CAAW;AACrC,QAAM,QAAQ,OAAO,KAAK,CAAW;AAErC,MAAI,MAAM,WAAW,MAAM,QAAQ;AACjC,WAAO;AAAA,EACT;AAGA,MAAI,MAAM,OAAO,KAAK,EAAE,WAAW,MAAM,QAAQ;AAC/C,WAAO;AAAA,EACT;AAEA,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,UAAM,UAAU,MAAM,CAAC;AACvB,UAAM,QAAS,EAAU,OAAO;AAChC,UAAM,QAAS,EAAU,OAAO;AAEhC,QAAI,CAAC,QAAQ,OAAO,KAAK,GAAG;AAC1B,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AACT;;;ACrCO,SAAS,MAAM,GAAmC;AACvD,SAAO,KAAK;AACd;;;ACLO,SAAS,SAAY,GAAiC;AAC3D,SAAO,MAAM,QAAQ,MAAM;AAC7B;;;ACEO,SAAS,OAAO,GAAuB;AAC5C,SAAO,MAAM;AACf;;;ACFO,SAAS,YAAY,GAA4B;AACtD,SAAO,MAAM;AACf;;;ACtBO,SAAS,SAAS,OAAiC;AACxD,SAAO,OAAO,UAAU,YAAY,QAAQ,MAAM,QAAQ,MAAM,KAAK,SAAS,OAAO;AACvF;;;ACWO,SAAS,cAAc,QAAyB;AACrD,MAAI,OAAO,WAAW,UAAU;AAC9B,WAAO;AAAA,EACT;AAEA,MAAI,UAAU,MAAM;AAClB,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,eAAe,MAAM,MAAM,MAAM;AAC1C,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,SAAS,MAAM,mBAAmB;AAC3C,WAAO;AAAA,EACT;AAEA,MAAI,QAAQ;AAEZ,SAAO,OAAO,eAAe,KAAK,MAAM,MAAM;AAC5C,YAAQ,OAAO,eAAe,KAAK;AAAA,EACrC;AAEA,SAAO,OAAO,eAAe,MAAM,MAAM;AAC3C;;;ACxBO,SAAS,WAAW,OAA0D;AACnF,SAAO,OAAO,UAAU;AAC1B;;;ACCO,SAAS,YAAY,OAA6C;AACvE,SAAO,SAAS,QAAQ,OAAO,UAAU,cACvC,SAAU,MAA6B,MAAM;AACjD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/predicate/index.ts","../../src/array/uniq.ts","../../src/array/union.ts","../../src/predicate/isEqual.ts","../../src/predicate/isNil.ts","../../src/predicate/isNotNil.ts","../../src/predicate/isNull.ts","../../src/predicate/isUndefined.ts","../../src/predicate/isLength.ts","../../src/predicate/isPlainObject.ts","../../src/predicate/isFunction.ts","../../src/predicate/isArrayLike.ts","../../src/predicate/isTypedArray.ts"],"sourcesContent":["export { isEqual } from './isEqual.ts';\nexport { isNil } from './isNil.ts';\nexport { isNotNil } from './isNotNil.ts';\nexport { isNull } from './isNull.ts';\nexport { isUndefined } from './isUndefined.ts';\nexport { isLength } from './isLength.ts';\nexport { isPlainObject } from './isPlainObject.ts';\nexport { isFunction } from './isFunction.ts';\nexport { isArrayLike } from './isArrayLike.ts';\nexport { isTypedArray } from './isTypedArray.ts';\n","/**\n * Creates a duplicate-free version of an array.\n *\n * This function takes an array and returns a new array containing only the unique values\n * from the original array, preserving the order of first occurrence.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr - The array to process.\n * @returns {T[]} A new array with only unique values from the original array.\n *\n * @example\n * const array = [1, 2, 2, 3, 4, 4, 5];\n * const result = uniq(array);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function uniq<T>(arr: readonly T[]): T[] {\n return Array.from(new Set(arr));\n}\n","import { uniq } from './uniq.ts';\n\n/**\n * Creates an array of unique values from all given arrays.\n *\n * This function takes two arrays, merges them into a single array, and returns a new array\n * containing only the unique values from the merged array.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} arr1 - The first array to merge and filter for unique values.\n * @param {T[]} arr2 - The second array to merge and filter for unique values.\n * @returns {T[]} A new array of unique values.\n *\n * @example\n * const array1 = [1, 2, 3];\n * const array2 = [3, 4, 5];\n * const result = union(array1, array2);\n * // result will be [1, 2, 3, 4, 5]\n */\nexport function union<T>(arr1: readonly T[], arr2: readonly T[]): T[] {\n return uniq(arr1.concat(arr2));\n}\n","import { union } from \"../array/union.ts\";\n\n/**\n * Checks if two values are equal, including support for `Date`, `RegExp`, and deep object comparison.\n *\n * @param {unknown} a - The first value to compare.\n * @param {unknown} b - The second value to compare.\n * @returns {boolean} `true` if the values are equal, otherwise `false`.\n *\n * @example\n * isEqual(1, 1); // true\n * isEqual({ a: 1 }, { a: 1 }); // true\n * isEqual(/abc/g, /abc/g); // true\n * isEqual(new Date('2020-01-01'), new Date('2020-01-01')); // true\n * isEqual([1, 2, 3], [1, 2, 3]); // true\n */\nexport function isEqual(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) {\n return true;\n }\n\n if (a instanceof Date && b instanceof Date) {\n return a.getTime() === b.getTime();\n }\n\n if (a instanceof RegExp && b instanceof RegExp) {\n return a.source === b.source && a.flags === b.flags;\n }\n\n if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null) {\n return false;\n }\n\n const aKeys = Object.keys(a as object);\n const bKeys = Object.keys(b as object);\n\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n\n // check if all keys in both arrays match\n if (union(aKeys, bKeys).length !== aKeys.length) {\n return false;\n }\n\n for (let i = 0; i < aKeys.length; i++) {\n const propKey = aKeys[i];\n const aProp = (a as any)[propKey];\n const bProp = (b as any)[propKey];\n \n if (!isEqual(aProp, bProp)) {\n return false;\n }\n }\n\n return true;\n}\n","/**\n * Checks if a given value is null or undefined.\n *\n * This function tests whether the provided value is either `null` or `undefined`.\n * It returns `true` if the value is `null` or `undefined`, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null` or `undefined`.\n *\n * @param {unknown} x - The value to test for null or undefined.\n * @returns {boolean} `true` if the value is null or undefined, `false` otherwise.\n *\n * @example\n * const value1 = null;\n * const value2 = undefined;\n * const value3 = 42;\n * const result1 = isNil(value1); // true\n * const result2 = isNil(value2); // true\n * const result3 = isNil(value3); // false\n */\nexport function isNil(x: unknown): x is null | undefined {\n return x == null;\n}\n","/**\n * Checks if the given value is not null nor undefined.\n *\n * The main use of this function is to be used with TypeScript as a type predicate.\n *\n * @template T - The type of value.\n * @param {T | null | undefined} x - The value to test if it is not null nor undefined.\n * @returns {x is T} True if the value is not null nor undefined, false otherwise.\n *\n * @example\n * // Here the type of `arr` is (number | undefined)[]\n * const arr = [1, undefined, 3];\n * // Here the type of `result` is number[]\n * const result = arr.filter(isNotNil);\n * // result will be [1, 3]\n */\nexport function isNotNil<T>(x: T | null | undefined): x is T {\n return x !== null && x !== undefined;\n}\n","/**\n * Checks if the given value is null.\n *\n * This function tests whether the provided value is strictly equal to `null`.\n * It returns `true` if the value is `null`, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null`.\n *\n * @param {unknown} x - The value to test if it is null.\n * @returns {x is null} True if the value is null, false otherwise.\n *\n * @example\n * const value1 = null;\n * const value2 = undefined;\n * const value3 = 42;\n *\n * console.log(isNull(value1)); // true\n * console.log(isNull(value2)); // false\n * console.log(isNull(value3)); // false\n */\nexport function isNull(x: unknown): x is null {\n return x === null;\n}\n","/**\n * Checks if the given value is undefined.\n *\n * This function tests whether the provided value is strictly equal to `undefined`.\n * It returns `true` if the value is `undefined`, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `undefined`.\n *\n * @param {unknown} x - The value to test if it is undefined.\n * @returns {x is undefined} true if the value is undefined, false otherwise.\n *\n * @example\n * const value1 = undefined;\n * const value2 = null;\n * const value3 = 42;\n *\n * console.log(isUndefined(value1)); // true\n * console.log(isUndefined(value2)); // false\n * console.log(isUndefined(value3)); // false\n */\nexport function isUndefined(x: unknown): x is undefined {\n return x === undefined;\n}\n","export function isLength(value: unknown): value is number {\n return typeof value === 'number' && value > -1 && value % 1 === 0 && value <= Number.MAX_SAFE_INTEGER;\n}\n","/**\n * Checks if a given value is a plain object.\n * \n * @param {object} object - The value to check.\n * @returns {boolean} - True if the value is a plain object, otherwise false.\n * \n * @example\n * console.log(isPlainObject({})); // true\n * console.log(isPlainObject([])); // false\n * console.log(isPlainObject(null)); // false\n * console.log(isPlainObject(Object.create(null))); // true\n * console.log(Buffer.from('hello, world')); // false\n */\nexport function isPlainObject(object: object): boolean {\n if (typeof object !== 'object') {\n return false;\n }\n\n if (object == null) {\n return false;\n }\n\n if (Object.getPrototypeOf(object) === null) {\n return true;\n }\n\n if (object.toString() !== '[object Object]') {\n return false;\n }\n\n let proto = object;\n\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n\n return Object.getPrototypeOf(object) === proto;\n}","/**\n * Checks if `value` is a function.\n *\n * @param {unknown} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n *\n * @example\n * isFunction(Array.prototype.slice); // true\n * isFunction(async function () {}); // true\n * isFunction(function* () {}); // true\n * isFunction(Proxy); // true\n * isFunction(Int8Array); // true\n */\nexport function isFunction(value: unknown): value is (...args: unknown[]) => unknown {\n return typeof value === 'function';\n}\n","import { isLength } from \"./isLength.ts\";\n\n/**\n * Checks if `value` is array-like.\n *\n * @param {unknown} value The value to check.\n * @returns {value is ArrayLike<unknown>} Returns `true` if `value` is array-like, else `false`.\n *\n * @example\n * isArrayLike([1, 2, 3]); // true\n * isArrayLike('abc'); // true\n * isArrayLike({ 0: 'a', length: 1 }); // true\n * isArrayLike({}); // false\n * isArrayLike(null); // false\n * isArrayLike(undefined); // false\n */\nexport function isArrayLike(value: unknown): value is ArrayLike<unknown> {\n return value != null && typeof value !== \"function\" &&\n isLength((value as ArrayLike<unknown>).length);\n}\n","/**\n * Checks if a value is a TypedArray.\n * @param {unknown} x The value to check.\n * @returns {x is\n * | Uint8Array\n * | Uint8ClampedArray\n * | Uint16Array\n * | Uint32Array\n * | BigUint64Array\n * | Int8Array\n * | Int16Array\n * | Int32Array\n * | BigInt64Array\n * | Float32Array\n * | Float64Array} Returns true if `x` is a TypedArray, false otherwise.\n */\nexport function isTypedArray(\n x: unknown\n): x is\n | Uint8Array\n | Uint8ClampedArray\n | Uint16Array\n | Uint32Array\n | BigUint64Array\n | Int8Array\n | Int16Array\n | Int32Array\n | BigInt64Array\n | Float32Array\n | Float64Array {\n return (\n x instanceof Uint8Array ||\n x instanceof Uint8ClampedArray ||\n x instanceof Uint16Array ||\n x instanceof Uint32Array ||\n x instanceof BigUint64Array ||\n x instanceof Int8Array ||\n x instanceof Int16Array ||\n x instanceof Int32Array ||\n x instanceof BigInt64Array ||\n x instanceof Float32Array ||\n x instanceof Float64Array\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACeO,SAAS,KAAQ,KAAwB;AAC9C,SAAO,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC;AAChC;;;ACEO,SAAS,MAAS,MAAoB,MAAyB;AACpE,SAAO,KAAK,KAAK,OAAO,IAAI,CAAC;AAC/B;;;ACLO,SAAS,QAAQ,GAAY,GAAqB;AACvD,MAAI,OAAO,GAAG,GAAG,CAAC,GAAG;AACnB,WAAO;AAAA,EACT;AAEA,MAAI,aAAa,QAAQ,aAAa,MAAM;AAC1C,WAAO,EAAE,QAAQ,MAAM,EAAE,QAAQ;AAAA,EACnC;AAEA,MAAI,aAAa,UAAU,aAAa,QAAQ;AAC9C,WAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE;AAAA,EAChD;AAEA,MAAI,OAAO,MAAM,YAAY,OAAO,MAAM,YAAY,MAAM,QAAQ,MAAM,MAAM;AAC9E,WAAO;AAAA,EACT;AAEA,QAAM,QAAQ,OAAO,KAAK,CAAW;AACrC,QAAM,QAAQ,OAAO,KAAK,CAAW;AAErC,MAAI,MAAM,WAAW,MAAM,QAAQ;AACjC,WAAO;AAAA,EACT;AAGA,MAAI,MAAM,OAAO,KAAK,EAAE,WAAW,MAAM,QAAQ;AAC/C,WAAO;AAAA,EACT;AAEA,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,UAAM,UAAU,MAAM,CAAC;AACvB,UAAM,QAAS,EAAU,OAAO;AAChC,UAAM,QAAS,EAAU,OAAO;AAEhC,QAAI,CAAC,QAAQ,OAAO,KAAK,GAAG;AAC1B,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AACT;;;ACrCO,SAAS,MAAM,GAAmC;AACvD,SAAO,KAAK;AACd;;;ACLO,SAAS,SAAY,GAAiC;AAC3D,SAAO,MAAM,QAAQ,MAAM;AAC7B;;;ACEO,SAAS,OAAO,GAAuB;AAC5C,SAAO,MAAM;AACf;;;ACFO,SAAS,YAAY,GAA4B;AACtD,SAAO,MAAM;AACf;;;ACtBO,SAAS,SAAS,OAAiC;AACxD,SAAO,OAAO,UAAU,YAAY,QAAQ,MAAM,QAAQ,MAAM,KAAK,SAAS,OAAO;AACvF;;;ACWO,SAAS,cAAc,QAAyB;AACrD,MAAI,OAAO,WAAW,UAAU;AAC9B,WAAO;AAAA,EACT;AAEA,MAAI,UAAU,MAAM;AAClB,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,eAAe,MAAM,MAAM,MAAM;AAC1C,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,SAAS,MAAM,mBAAmB;AAC3C,WAAO;AAAA,EACT;AAEA,MAAI,QAAQ;AAEZ,SAAO,OAAO,eAAe,KAAK,MAAM,MAAM;AAC5C,YAAQ,OAAO,eAAe,KAAK;AAAA,EACrC;AAEA,SAAO,OAAO,eAAe,MAAM,MAAM;AAC3C;;;ACxBO,SAAS,WAAW,OAA0D;AACnF,SAAO,OAAO,UAAU;AAC1B;;;ACCO,SAAS,YAAY,OAA6C;AACvE,SAAO,SAAS,QAAQ,OAAO,UAAU,cACvC,SAAU,MAA6B,MAAM;AACjD;;;ACHO,SAAS,aACd,GAYe;AACf,SACE,aAAa,cACb,aAAa,qBACb,aAAa,eACb,aAAa,eACb,aAAa,kBACb,aAAa,aACb,aAAa,cACb,aAAa,cACb,aAAa,iBACb,aAAa,gBACb,aAAa;AAEjB;","names":[]}
|
package/dist/predicate/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-STL6TD3L.mjs";
|
|
2
2
|
import {
|
|
3
3
|
isFunction
|
|
4
4
|
} from "../chunk-74CREQXW.mjs";
|
|
@@ -11,6 +11,9 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
isNull
|
|
13
13
|
} from "../chunk-AIRSKN47.mjs";
|
|
14
|
+
import {
|
|
15
|
+
isTypedArray
|
|
16
|
+
} from "../chunk-SXFMQQ6F.mjs";
|
|
14
17
|
import {
|
|
15
18
|
isUndefined
|
|
16
19
|
} from "../chunk-VH2PV426.mjs";
|
|
@@ -38,6 +41,7 @@ export {
|
|
|
38
41
|
isNotNil,
|
|
39
42
|
isNull,
|
|
40
43
|
isPlainObject,
|
|
44
|
+
isTypedArray,
|
|
41
45
|
isUndefined
|
|
42
46
|
};
|
|
43
47
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a value is a TypedArray.
|
|
3
|
+
* @param {unknown} x The value to check.
|
|
4
|
+
* @returns {x is
|
|
5
|
+
* | Uint8Array
|
|
6
|
+
* | Uint8ClampedArray
|
|
7
|
+
* | Uint16Array
|
|
8
|
+
* | Uint32Array
|
|
9
|
+
* | BigUint64Array
|
|
10
|
+
* | Int8Array
|
|
11
|
+
* | Int16Array
|
|
12
|
+
* | Int32Array
|
|
13
|
+
* | BigInt64Array
|
|
14
|
+
* | Float32Array
|
|
15
|
+
* | Float64Array} Returns true if `x` is a TypedArray, false otherwise.
|
|
16
|
+
*/
|
|
17
|
+
declare function isTypedArray(x: unknown): x is Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | BigUint64Array | Int8Array | Int16Array | Int32Array | BigInt64Array | Float32Array | Float64Array;
|
|
18
|
+
|
|
19
|
+
export { isTypedArray };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a value is a TypedArray.
|
|
3
|
+
* @param {unknown} x The value to check.
|
|
4
|
+
* @returns {x is
|
|
5
|
+
* | Uint8Array
|
|
6
|
+
* | Uint8ClampedArray
|
|
7
|
+
* | Uint16Array
|
|
8
|
+
* | Uint32Array
|
|
9
|
+
* | BigUint64Array
|
|
10
|
+
* | Int8Array
|
|
11
|
+
* | Int16Array
|
|
12
|
+
* | Int32Array
|
|
13
|
+
* | BigInt64Array
|
|
14
|
+
* | Float32Array
|
|
15
|
+
* | Float64Array} Returns true if `x` is a TypedArray, false otherwise.
|
|
16
|
+
*/
|
|
17
|
+
declare function isTypedArray(x: unknown): x is Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | BigUint64Array | Int8Array | Int16Array | Int32Array | BigInt64Array | Float32Array | Float64Array;
|
|
18
|
+
|
|
19
|
+
export { isTypedArray };
|
|
@@ -0,0 +1,33 @@
|
|
|
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/predicate/isTypedArray.ts
|
|
21
|
+
var isTypedArray_exports = {};
|
|
22
|
+
__export(isTypedArray_exports, {
|
|
23
|
+
isTypedArray: () => isTypedArray
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(isTypedArray_exports);
|
|
26
|
+
function isTypedArray(x) {
|
|
27
|
+
return x instanceof Uint8Array || x instanceof Uint8ClampedArray || x instanceof Uint16Array || x instanceof Uint32Array || x instanceof BigUint64Array || x instanceof Int8Array || x instanceof Int16Array || x instanceof Int32Array || x instanceof BigInt64Array || x instanceof Float32Array || x instanceof Float64Array;
|
|
28
|
+
}
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
isTypedArray
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=isTypedArray.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/predicate/isTypedArray.ts"],"sourcesContent":["/**\n * Checks if a value is a TypedArray.\n * @param {unknown} x The value to check.\n * @returns {x is\n * | Uint8Array\n * | Uint8ClampedArray\n * | Uint16Array\n * | Uint32Array\n * | BigUint64Array\n * | Int8Array\n * | Int16Array\n * | Int32Array\n * | BigInt64Array\n * | Float32Array\n * | Float64Array} Returns true if `x` is a TypedArray, false otherwise.\n */\nexport function isTypedArray(\n x: unknown\n): x is\n | Uint8Array\n | Uint8ClampedArray\n | Uint16Array\n | Uint32Array\n | BigUint64Array\n | Int8Array\n | Int16Array\n | Int32Array\n | BigInt64Array\n | Float32Array\n | Float64Array {\n return (\n x instanceof Uint8Array ||\n x instanceof Uint8ClampedArray ||\n x instanceof Uint16Array ||\n x instanceof Uint32Array ||\n x instanceof BigUint64Array ||\n x instanceof Int8Array ||\n x instanceof Int16Array ||\n x instanceof Int32Array ||\n x instanceof BigInt64Array ||\n x instanceof Float32Array ||\n x instanceof Float64Array\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBO,SAAS,aACd,GAYe;AACf,SACE,aAAa,cACb,aAAa,qBACb,aAAa,eACb,aAAa,eACb,aAAa,kBACb,aAAa,aACb,aAAa,cACb,aAAa,cACb,aAAa,iBACb,aAAa,gBACb,aAAa;AAEjB;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/promise/index.mjs
CHANGED
package/dist/promise/timeout.mjs
CHANGED
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
} from "../chunk-IIDZ3KAJ.mjs";
|
|
4
4
|
import "../chunk-CVVZHOJX.mjs";
|
|
5
5
|
import "../chunk-O64NE2P4.mjs";
|
|
6
|
-
import "../chunk-DXB7EZUQ.mjs";
|
|
7
6
|
import "../chunk-KIOYQRMQ.mjs";
|
|
7
|
+
import "../chunk-DXB7EZUQ.mjs";
|
|
8
8
|
import "../chunk-24FKGR6U.mjs";
|
|
9
9
|
export {
|
|
10
10
|
withTimeout
|
package/dist/string/index.mjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import "../chunk-XT74R35S.mjs";
|
|
2
|
+
import {
|
|
3
|
+
lowerCase
|
|
4
|
+
} from "../chunk-5IKVJGHO.mjs";
|
|
2
5
|
import {
|
|
3
6
|
snakeCase
|
|
4
7
|
} from "../chunk-F3WCQQET.mjs";
|
|
@@ -14,9 +17,6 @@ import {
|
|
|
14
17
|
import {
|
|
15
18
|
kebabCase
|
|
16
19
|
} from "../chunk-EYYZQFOP.mjs";
|
|
17
|
-
import {
|
|
18
|
-
lowerCase
|
|
19
|
-
} from "../chunk-5IKVJGHO.mjs";
|
|
20
20
|
import "../chunk-WVQ7YVRK.mjs";
|
|
21
21
|
import "../chunk-24FKGR6U.mjs";
|
|
22
22
|
export {
|
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.13.1-dev.
|
|
4
|
+
"version": "1.13.1-dev.320+2df30f70",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|
package/umd/browser.global.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(()=>{var q=Object.defineProperty;var L=Object.getOwnPropertySymbols;var kt=Object.prototype.hasOwnProperty,wt=Object.prototype.propertyIsEnumerable;var _=(e,t,n)=>t in e?q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$=(e,t)=>{for(var n in t||(t={}))kt.call(t,n)&&_(e,n,t[n]);if(L)for(var n of L(t))wt.call(t,n)&&_(e,n,t[n]);return e};var Rt=(e,t)=>{for(var n in t)q(e,n,{get:t[n],enumerable:!0})};var h=(e,t,n)=>new Promise((r,o)=>{var i=f=>{try{u(n.next(f))}catch(c){o(c)}},a=f=>{try{u(n.throw(f))}catch(c){o(c)}},u=f=>f.done?r(f.value):Promise.resolve(f.value).then(i,a);u((n=n.apply(e,t)).next())});var z={};Rt(z,{AbortError:()=>m,TimeoutError:()=>d,after:()=>Oe,camelCase:()=>ot,capitalize:()=>W,chunk:()=>st,clamp:()=>We,clone:()=>Ge,cloneDeep:()=>T,compact:()=>X,concat:()=>lt,countBy:()=>j,debounce:()=>Ie,delay:()=>M,difference:()=>ct,differenceBy:()=>b,differenceWith:()=>K,drop:()=>Y,dropRight:()=>H,dropRightWhile:()=>Z,dropWhile:()=>J,endsWith:()=>bt,fill:()=>Tt,first:()=>B,flatMap:()=>ee,flatten:()=>s,flattenDeep:()=>te,flattenObject:()=>je,forEachRight:()=>ne,get:()=>yt,groupBy:()=>re,head:()=>B,inRange:()=>Se,initial:()=>Pe,intersection:()=>A,intersectionBy:()=>k,intersectionWith:()=>w,invert:()=>$e,isArray:()=>ht,isArrayLike:()=>tt,isEqual:()=>N,isFunction:()=>et,isLength:()=>D,isNil:()=>He,isNotNil:()=>Ze,isNull:()=>Je,isPlainObject:()=>xt,isUndefined:()=>Qe,kebabCase:()=>at,keyBy:()=>oe,last:()=>ve,lowerCase:()=>ut,max:()=>Kt,maxBy:()=>ie,mean:()=>F,meanBy:()=>Ve,min:()=>At,minBy:()=>ae,negate:()=>Me,noop:()=>Ee,omit:()=>Ce,omitBy:()=>Le,once:()=>Fe,orderBy:()=>ue,partition:()=>fe,pick:()=>_e,pickBy:()=>qe,random:()=>R,randomInt:()=>U,range:()=>ze,round:()=>Be,sample:()=>se,sampleSize:()=>le,set:()=>V,shuffle:()=>ce,snakeCase:()=>it,startCase:()=>ft,startsWith:()=>gt,sum:()=>y,sumBy:()=>Ne,tail:()=>Re,take:()=>Te,takeRight:()=>pe,takeRightWhile:()=>me,takeWhile:()=>de,throttle:()=>De,toFilled:()=>Ue,union:()=>p,unionBy:()=>P,unionWith:()=>I,uniq:()=>v,uniqBy:()=>ye,uniqWith:()=>O,unzip:()=>xe,unzipWith:()=>he,withTimeout:()=>rt,without:()=>we,xor:()=>ge,xorBy:()=>be,xorWith:()=>Ke,zip:()=>E,zipObject:()=>Ae,zipObjectDeep:()=>mt,zipWith:()=>ke});function G(e,t){if(!Number.isInteger(t)||t<=0)throw new Error("Size must be an integer greater than zero.");let n=Math.ceil(e.length/t),r=Array(n);for(let o=0;o<n;o++){let i=o*t,a=i+t;r[o]=e.slice(i,a)}return r}function X(e){let t=[];for(let n of e)n&&t.push(n);return t}function j(e,t){var r;let n={};for(let o of e){let i=t(o);n[i]=((r=n[i])!=null?r:0)+1}return n}function g(e,t){let n=new Set(t);return e.filter(r=>!n.has(r))}function b(e,t,n){let r=new Set(t.map(o=>n(o)));return e.filter(o=>!r.has(n(o)))}function K(e,t,n){return e.filter(r=>t.every(o=>!n(r,o)))}function Y(e,t){return t=Math.max(t,0),e.slice(t)}function H(e,t){return t=Math.min(-t,0),t===0?e.slice():e.slice(0,t)}function Z(e,t){for(let n=e.length-1;n>=0;n--)if(!t(e[n]))return e.slice(0,n+1);return[]}function J(e,t){let n=e.findIndex(r=>!t(r));return n===-1?[]:e.slice(n)}function Q(e,t,n=0,r=e.length){let o=e.length,i=Math.max(n>=0?n:o+n,0),a=Math.min(r>=0?r:o+r,o);for(let u=i;u<a;u++)e[u]=t;return e}function s(e,t=1){let n=[],r=Math.floor(t),o=(i,a)=>{for(let u of i)Array.isArray(u)&&a<r?o(u,a+1):n.push(u)};return o(e,0),n}function ee(e,t,n=1){return s(e.map(r=>t(r)),n)}function te(e){return s(e,1/0)}function ne(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];t(r,n,e)}}function re(e,t){let n={};for(let r of e){let o=t(r);n[o]==null&&(n[o]=[]),n[o].push(r)}return n}function A(e,t){let n=new Set(t);return e.filter(r=>n.has(r))}function k(e,t,n){let r=new Set(t.map(n));return e.filter(o=>r.has(n(o)))}function w(e,t,n){return e.filter(r=>t.some(o=>n(r,o)))}function oe(e,t){let n={};for(let r of e){let o=t(r);n[o]=r}return n}function ie(e,t){let n=e[0],r=-1/0;for(let o of e){let i=t(o);i>r&&(r=i,n=o)}return n}function ae(e,t){let n=e[0],r=1/0;for(let o of e){let i=t(o);i<r&&(r=i,n=o)}return n}function ue(e,t,n){let r=(i,a,u)=>i<a?u==="asc"?-1:1:i>a?u==="asc"?1:-1:0,o=t.map((i,a)=>n[a]||n[n.length-1]);return e.slice().sort((i,a)=>{for(let u=0;u<t.length;u++){let f=t[u],c=o[u],C=r(i[f],a[f],c);if(C!==0)return C}return 0})}function fe(e,t){let n=[],r=[];for(let o of e)t(o)?n.push(o):r.push(o);return[n,r]}function se(e){let t=Math.floor(Math.random()*e.length);return e[t]}function R(e,t){if(t==null&&(t=e,e=0),e>=t)throw new Error("Invalid input: The maximum value must be greater than the minimum value.");return Math.random()*(t-e)+e}function U(e,t){return Math.floor(R(e,t))}function le(e,t){if(t>e.length)throw new Error("Size must be less than or equal to the length of array.");let n=new Array(t),r=new Set;for(let o=e.length-t,i=0;o<e.length;o++,i++){let a=U(0,o+1);r.has(a)&&(a=o),r.add(a),n[i]=e[a]}return n}function ce(e){let t=e.slice();for(let n=t.length-1;n>=1;n--){let r=Math.floor(Math.random()*(n+1));[t[n],t[r]]=[t[r],t[n]]}return t}function Te(e,t){return e.slice(0,t)}function pe(e,t=1){return t<=0?[]:e.slice(-t)}function me(e,t){for(let n=e.length-1;n>=0;n--)if(!t(e[n]))return e.slice(n+1);return e.slice()}function de(e,t){let n=[];for(let r of e){if(!t(r))break;n.push(r)}return n}function v(e){return Array.from(new Set(e))}function p(e,t){return v(e.concat(t))}function P(e,t,n){let r=new Map;for(let o of[...e,...t]){let i=n(o);r.has(i)||r.set(i,o)}return Array.from(r.values())}function O(e,t){let n=[];for(let r of e)n.every(i=>!t(i,r))&&n.push(r);return n}function I(e,t,n){return O(e.concat(t),n)}function ye(e,t){let n=new Map;for(let r of e){let o=t(r);n.has(o)||n.set(o,r)}return Array.from(n.values())}function xe(e){let t=0;for(let r=0;r<e.length;r++)e[r].length>t&&(t=e[r].length);let n=new Array(t);for(let r=0;r<t;r++){n[r]=new Array(e.length);for(let o=0;o<e.length;o++)n[r][o]=e[o][r]}return n}function he(e,t){let n=Math.max(...e.map(o=>o.length)),r=new Array(n);for(let o=0;o<n;o++){let i=new Array(e.length);for(let a=0;a<e.length;a++)i[a]=e[a][o];r[o]=t(...i)}return r}function ge(e,t){return g(p(e,t),A(e,t))}function be(e,t,n){let r=P(e,t,n),o=k(e,t,n);return b(r,o,n)}function Ke(e,t,n){let r=I(e,t,n),o=w(e,t,n);return K(r,o,n)}function E(...e){let t=[],n=Math.max(...e.map(r=>r.length));for(let r=0;r<n;r++){let o=[];for(let i of e)o.push(i[r]);t.push(o)}return t}function Ae(e,t){let n={};for(let r=0;r<e.length;r++)n[e[r]]=t[r];return n}function ke(e,...t){let n=[e,...t.slice(0,-1)],r=t[t.length-1],o=[],i=Math.max(...n.map(a=>a.length));for(let a=0;a<i;a++){let u=n.map(f=>f[a]);o.push(r(...u))}return o}function we(e,...t){let n=new Set(t);return e.filter(r=>!n.has(r))}function B(e){return e[0]}function Re(e){let t=e.length;if(t<=1)return[];let n=new Array(t-1);for(let r=1;r<t;r++)n[r-1]=e[r];return n}function Ue(e,t,n=0,r=e.length){let o=e.length,i=Math.max(n>=0?n:o+n,0),a=Math.min(r>=0?r:o+r,o),u=e.slice();for(let f=i;f<a;f++)u[f]=t;return u}function ve(e){return e[e.length-1]}function Pe(e){return e.length<=1?[]:e.slice(0,-1)}var m=class extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}};var d=class extends Error{constructor(t="The operation was timed out"){super(t),this.name="TimeoutError"}};var Oe=(e,t)=>{if(!Number.isInteger(e)||e<0)throw new Error("n must be a non-negative integer.");let n=0;return(...r)=>{if(++n>=e)return t(...r)}};function Ie(e,t,{signal:n}={}){let r=null,o=function(...a){r!==null&&clearTimeout(r),!(n!=null&&n.aborted)&&(r=setTimeout(()=>{e(...a),r=null},t))},i=function(){o.cancel()};return o.cancel=function(){r!==null&&(clearTimeout(r),r=null)},n==null||n.addEventListener("abort",i,{once:!0}),o}function Ee(){}function Fe(e){let t=!1,n;return function(){if(t)return n;let r=e();return t=!0,n=r,r}}function De(e,t){let n;return function(...o){let i=Date.now();(n==null||i-n>=t)&&(n=i,e(...o))}}function Me(e){return(...t)=>!e(...t)}function We(e,t,n){return n==null?Math.min(e,t):Math.min(Math.max(e,t),n)}function Se(e,t,n){if(n==null&&(n=t,t=0),t>=n)throw new Error("The maximum value must be greater than the minimum value.");return t<=e&&e<n}function y(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n];return t}function F(e){return y(e)/e.length}function Ve(e,t){let n=e.map(r=>t(r));return F(n)}function Be(e,t=0){if(!Number.isInteger(t))throw new Error("Precision must be an integer.");let n=Math.pow(10,t);return Math.round(e*n)/n}function Ne(e,t){let n=e.map(r=>t(r));return y(n)}function ze(e,t,n){if(t==null&&(t=e,e=0),n==null&&(n=1),!Number.isInteger(n)||n===0)throw new Error("The step value must be a non-zero integer.");let r=Math.max(Math.ceil((t-e)/n),0),o=new Array(r);for(let i=0;i<r;i++)o[i]=e+i*n;return o}function Ce(e,t){let n=$({},e);for(let r of t)delete n[r];return n}function Le(e,t){let n={};for(let[r,o]of Object.entries(e))t(o,r)||(n[r]=o);return n}function _e(e,t){let n={};for(let r of t)n[r]=e[r];return n}function qe(e,t){let n={};for(let[r,o]of Object.entries(e))t(o,r)&&(n[r]=o);return n}function $e(e){let t={},n=Object.keys(e);for(let r=0;r<n.length;r++){let o=n[r],i=e[o];t[i]=o}return t}function Ge(e){if(Ut(e))return e;if(Array.isArray(e))return e.slice();if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(e instanceof Map){let t=new Map;for(let[n,r]of e)t.set(n,r);return t}if(e instanceof Set){let t=new Set;for(let n of e)t.add(n);return t}if(typeof e=="object"){let t=Object.getPrototypeOf(e),n=Object.create(t);return Object.assign(n,e)}return e}function Ut(e){return e==null||typeof e!="object"&&typeof e!="function"}function T(e){if(vt(e))return e;if(Array.isArray(e))return e.map(t=>T(t));if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(e instanceof Map){let t=new Map;for(let[n,r]of e.entries())t.set(n,T(r));return t}if(e instanceof Set){let t=new Set;for(let n of e.values())t.add(T(n));return t}if(Pt(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);for(let n=0;n<e.length;n++)t[n]=T(e[n]);return t}if(e instanceof ArrayBuffer||e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let t=new DataView(e.buffer.slice(0));return x(e,t),t}if(typeof File!="undefined"&&e instanceof File){let t=new File([e],e.name,{type:e.type});return x(e,t),t}if(e instanceof Blob){let t=new Blob([e],{type:e.type});return x(e,t),t}if(e instanceof Error){let t=new e.constructor;return t.message=e.message,t.name=e.name,t.stack=e.stack,t.cause=e.cause,x(e,t),t}if(typeof e=="object"&&e!==null){let t={};return x(e,t),t}if(typeof e!="function")return e}function vt(e){return e==null||typeof e!="object"&&typeof e!="function"}function x(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)){let r=Object.getOwnPropertyDescriptor(e,n);(r!=null&&r.writable||r!=null&&r.set)&&typeof(r==null?void 0:r.value)!="function"&&(t[n]=T(e[n]))}}function Pt(e){return e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof BigUint64Array||e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof BigInt64Array||e instanceof Float32Array||e instanceof Float64Array}function Xe(e){if(typeof e!="object"||e==null)return!1;if(Object.getPrototypeOf(e)===null)return!0;if(e.toString()!=="[object Object]")return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function je(e){return Ye(e)}function Ye(e,t=""){let n={},r=Object.keys(e);for(let o=0;o<r.length;o++){let i=r[o],a=e[i],u=t?`${t}.${i}`:i;if(Xe(a)&&Object.keys(a).length>0){Object.assign(n,Ye(a,u));continue}if(Array.isArray(a)){for(let f=0;f<a.length;f++)n[`${u}.${f}`]=a[f];continue}n[u]=a}return n}function N(e,t){if(Object.is(e,t))return!0;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp&&t instanceof RegExp)return e.source===t.source&&e.flags===t.flags;if(typeof e!="object"||typeof t!="object"||e===null||t===null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||p(n,r).length!==n.length)return!1;for(let o=0;o<n.length;o++){let i=n[o],a=e[i],u=t[i];if(!N(a,u))return!1}return!0}function He(e){return e==null}function Ze(e){return e!=null}function Je(e){return e===null}function Qe(e){return e===void 0}function D(e){return typeof e=="number"&&e>-1&&e%1===0&&e<=Number.MAX_SAFE_INTEGER}function et(e){return typeof e=="function"}function tt(e){return e!=null&&typeof e!="function"&&D(e.length)}function M(e,{signal:t}={}){return new Promise((n,r)=>{let o=()=>{r(new m)},i=()=>{clearTimeout(a),o()};if(t!=null&&t.aborted)return o();let a=setTimeout(n,e);t==null||t.addEventListener("abort",i,{once:!0})})}function nt(e){return h(this,null,function*(){throw yield M(e),new d})}function rt(e,t){return h(this,null,function*(){return Promise.race([e(),nt(t)])})}var W=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase();var Ot=/[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g;function l(e){var t;return Array.from((t=e.match(Ot))!=null?t:[])}function ot(e){let t=l(e);if(t.length===0)return"";let[n,...r]=t;return`${n.toLowerCase()}${r.map(o=>W(o)).join("")}`}var it=e=>l(e).map(n=>n.toLowerCase()).join("_");var at=e=>l(e).map(n=>n.toLowerCase()).join("-");var ut=e=>l(e).map(n=>n.toLowerCase()).join(" ");function ft(e){let t=l(e.trim()),n="";for(let r of t)n&&(n+=" "),r===r.toUpperCase()?n+=r:n+=r[0].toUpperCase()+r.slice(1).toLowerCase();return n}function st(e,t=1){return t=Math.max(Math.floor(t),0),t===0?[]:G(e,t)}function lt(...e){return s(e)}function ct(e,...t){let n=e,r=s(t);return g(n,r)}function Tt(e,t,n=0,r=e.length){return n=Math.floor(n),r=Math.floor(r),n||(n=0),r||(r=0),Q(e,t,n,r)}var It=/^(?:0|[1-9]\d*)$/;function pt(e){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e<Number.MAX_SAFE_INTEGER;case"symbol":return!1;case"string":return It.test(e)}}function S(e){let t=/\\(\\)?/g,n=RegExp(`[^.[\\]]+|\\[(?:([^"'][^[]*)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))`,"g"),r=[];e[0]==="."&&r.push("");let o,i=0;for(;(o=n.exec(e))!==null;){let a=o[0],u=o[1],f=o[2],c=o[3];f?a=c.replace(t,"$1"):u&&(a=u),r.push(a),n.lastIndex===i?n.lastIndex++:i=n.lastIndex}return r}function V(e,t,n){let r=Array.isArray(t)?t:typeof t=="string"?S(t):[t],o=e;for(let a=0;a<r.length-1;a++){let u=r[a],f=r[a+1];o[u]==null&&(o[u]=pt(f)?[]:{}),o=o[u]}let i=r[r.length-1];return o[i]=n,e}function mt(e,t){let n={},r=E(e,t);for(let o=0;o<r.length;o++){let[i,a]=r[o];i!=null&&V(n,i,a)}return n}var Et=/^\w*$/,Ft=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;function dt(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return!Et.test(e)&&Ft.test(e)}}function yt(e,t,n){let r;if(Array.isArray(t)?r=t:typeof t=="string"&&dt(t)&&(e==null?void 0:e[t])==null?r=S(t):r=[t],r.length===0)return n;let o=e,i;for(i=0;i<r.length&&o!=null;i++){let a=r[i];Object.is(a.valueOf(),-0)&&(a="-0"),o=o[a]}return o===null&&i===r.length||o!=null?o:n}function xt(e){var n;if(typeof e!="object"||e==null)return!1;if(Object.getPrototypeOf(e)===null)return!0;if(e.toString()!=="[object Object]"){let r=e[Symbol.toStringTag];return r==null||!((n=Object.getOwnPropertyDescriptor(e,Symbol.toStringTag))!=null&&n.writable)?!1:e.toString()===`[object ${r}]`}let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function ht(e){return Array.isArray(e)}var gt=(e,t,n=0)=>e.startsWith(t,n);var bt=(e,t,n=e.length)=>e.endsWith(t,n);function Kt(e=[]){let t=e[0],n;for(let r of e)(n==null||r>n)&&(n=r,t=r);return t}function At(e=[]){let t=e[0],n;for(let r of e)(n==null||r<n)&&(n=r,t=r);return t}window._=z;})();
|
|
1
|
+
"use strict";(()=>{var q=Object.defineProperty;var L=Object.getOwnPropertySymbols;var Ut=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable;var _=(e,t,n)=>t in e?q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$=(e,t)=>{for(var n in t||(t={}))Ut.call(t,n)&&_(e,n,t[n]);if(L)for(var n of L(t))Rt.call(t,n)&&_(e,n,t[n]);return e};var vt=(e,t)=>{for(var n in t)q(e,n,{get:t[n],enumerable:!0})};var h=(e,t,n)=>new Promise((r,o)=>{var i=f=>{try{u(n.next(f))}catch(c){o(c)}},a=f=>{try{u(n.throw(f))}catch(c){o(c)}},u=f=>f.done?r(f.value):Promise.resolve(f.value).then(i,a);u((n=n.apply(e,t)).next())});var C={};vt(C,{AbortError:()=>m,TimeoutError:()=>y,after:()=>Ie,camelCase:()=>it,capitalize:()=>B,chunk:()=>lt,clamp:()=>Be,clone:()=>Ge,cloneDeep:()=>T,compact:()=>X,concat:()=>ct,countBy:()=>j,debounce:()=>Oe,delay:()=>M,difference:()=>Tt,differenceBy:()=>b,differenceWith:()=>K,drop:()=>Y,dropRight:()=>H,dropRightWhile:()=>Z,dropWhile:()=>J,endsWith:()=>At,fill:()=>pt,first:()=>V,flatMap:()=>ee,flatten:()=>s,flattenDeep:()=>te,flattenObject:()=>je,forEachRight:()=>ne,get:()=>xt,groupBy:()=>re,head:()=>V,inRange:()=>We,initial:()=>Pe,intersection:()=>A,intersectionBy:()=>k,intersectionWith:()=>w,invert:()=>$e,isArray:()=>gt,isArrayLike:()=>tt,isEqual:()=>N,isFunction:()=>et,isLength:()=>D,isNil:()=>He,isNotNil:()=>Ze,isNull:()=>Je,isPlainObject:()=>ht,isTypedArray:()=>bt,isUndefined:()=>Qe,kebabCase:()=>ut,keyBy:()=>oe,last:()=>ve,lowerCase:()=>ft,max:()=>kt,maxBy:()=>ie,mean:()=>F,meanBy:()=>Se,min:()=>wt,minBy:()=>ae,negate:()=>Me,noop:()=>Ee,omit:()=>ze,omitBy:()=>Le,once:()=>Fe,orderBy:()=>ue,partition:()=>fe,pick:()=>_e,pickBy:()=>qe,random:()=>U,randomInt:()=>R,range:()=>Ce,round:()=>Ve,sample:()=>se,sampleSize:()=>le,set:()=>S,shuffle:()=>ce,snakeCase:()=>at,startCase:()=>st,startsWith:()=>Kt,sum:()=>d,sumBy:()=>Ne,tail:()=>Ue,take:()=>Te,takeRight:()=>pe,takeRightWhile:()=>me,takeWhile:()=>ye,throttle:()=>De,toFilled:()=>Re,union:()=>p,unionBy:()=>P,unionWith:()=>O,uniq:()=>v,uniqBy:()=>de,uniqWith:()=>I,unzip:()=>xe,unzipWith:()=>he,withTimeout:()=>ot,without:()=>we,xor:()=>ge,xorBy:()=>be,xorWith:()=>Ke,zip:()=>E,zipObject:()=>Ae,zipObjectDeep:()=>yt,zipWith:()=>ke});function G(e,t){if(!Number.isInteger(t)||t<=0)throw new Error("Size must be an integer greater than zero.");let n=Math.ceil(e.length/t),r=Array(n);for(let o=0;o<n;o++){let i=o*t,a=i+t;r[o]=e.slice(i,a)}return r}function X(e){let t=[];for(let n of e)n&&t.push(n);return t}function j(e,t){var r;let n={};for(let o of e){let i=t(o);n[i]=((r=n[i])!=null?r:0)+1}return n}function g(e,t){let n=new Set(t);return e.filter(r=>!n.has(r))}function b(e,t,n){let r=new Set(t.map(o=>n(o)));return e.filter(o=>!r.has(n(o)))}function K(e,t,n){return e.filter(r=>t.every(o=>!n(r,o)))}function Y(e,t){return t=Math.max(t,0),e.slice(t)}function H(e,t){return t=Math.min(-t,0),t===0?e.slice():e.slice(0,t)}function Z(e,t){for(let n=e.length-1;n>=0;n--)if(!t(e[n]))return e.slice(0,n+1);return[]}function J(e,t){let n=e.findIndex(r=>!t(r));return n===-1?[]:e.slice(n)}function Q(e,t,n=0,r=e.length){let o=e.length,i=Math.max(n>=0?n:o+n,0),a=Math.min(r>=0?r:o+r,o);for(let u=i;u<a;u++)e[u]=t;return e}function s(e,t=1){let n=[],r=Math.floor(t),o=(i,a)=>{for(let u of i)Array.isArray(u)&&a<r?o(u,a+1):n.push(u)};return o(e,0),n}function ee(e,t,n=1){return s(e.map(r=>t(r)),n)}function te(e){return s(e,1/0)}function ne(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];t(r,n,e)}}function re(e,t){let n={};for(let r of e){let o=t(r);n[o]==null&&(n[o]=[]),n[o].push(r)}return n}function A(e,t){let n=new Set(t);return e.filter(r=>n.has(r))}function k(e,t,n){let r=new Set(t.map(n));return e.filter(o=>r.has(n(o)))}function w(e,t,n){return e.filter(r=>t.some(o=>n(r,o)))}function oe(e,t){let n={};for(let r of e){let o=t(r);n[o]=r}return n}function ie(e,t){let n=e[0],r=-1/0;for(let o of e){let i=t(o);i>r&&(r=i,n=o)}return n}function ae(e,t){let n=e[0],r=1/0;for(let o of e){let i=t(o);i<r&&(r=i,n=o)}return n}function ue(e,t,n){let r=(i,a,u)=>i<a?u==="asc"?-1:1:i>a?u==="asc"?1:-1:0,o=t.map((i,a)=>n[a]||n[n.length-1]);return e.slice().sort((i,a)=>{for(let u=0;u<t.length;u++){let f=t[u],c=o[u],z=r(i[f],a[f],c);if(z!==0)return z}return 0})}function fe(e,t){let n=[],r=[];for(let o of e)t(o)?n.push(o):r.push(o);return[n,r]}function se(e){let t=Math.floor(Math.random()*e.length);return e[t]}function U(e,t){if(t==null&&(t=e,e=0),e>=t)throw new Error("Invalid input: The maximum value must be greater than the minimum value.");return Math.random()*(t-e)+e}function R(e,t){return Math.floor(U(e,t))}function le(e,t){if(t>e.length)throw new Error("Size must be less than or equal to the length of array.");let n=new Array(t),r=new Set;for(let o=e.length-t,i=0;o<e.length;o++,i++){let a=R(0,o+1);r.has(a)&&(a=o),r.add(a),n[i]=e[a]}return n}function ce(e){let t=e.slice();for(let n=t.length-1;n>=1;n--){let r=Math.floor(Math.random()*(n+1));[t[n],t[r]]=[t[r],t[n]]}return t}function Te(e,t){return e.slice(0,t)}function pe(e,t=1){return t<=0?[]:e.slice(-t)}function me(e,t){for(let n=e.length-1;n>=0;n--)if(!t(e[n]))return e.slice(n+1);return e.slice()}function ye(e,t){let n=[];for(let r of e){if(!t(r))break;n.push(r)}return n}function v(e){return Array.from(new Set(e))}function p(e,t){return v(e.concat(t))}function P(e,t,n){let r=new Map;for(let o of[...e,...t]){let i=n(o);r.has(i)||r.set(i,o)}return Array.from(r.values())}function I(e,t){let n=[];for(let r of e)n.every(i=>!t(i,r))&&n.push(r);return n}function O(e,t,n){return I(e.concat(t),n)}function de(e,t){let n=new Map;for(let r of e){let o=t(r);n.has(o)||n.set(o,r)}return Array.from(n.values())}function xe(e){let t=0;for(let r=0;r<e.length;r++)e[r].length>t&&(t=e[r].length);let n=new Array(t);for(let r=0;r<t;r++){n[r]=new Array(e.length);for(let o=0;o<e.length;o++)n[r][o]=e[o][r]}return n}function he(e,t){let n=Math.max(...e.map(o=>o.length)),r=new Array(n);for(let o=0;o<n;o++){let i=new Array(e.length);for(let a=0;a<e.length;a++)i[a]=e[a][o];r[o]=t(...i)}return r}function ge(e,t){return g(p(e,t),A(e,t))}function be(e,t,n){let r=P(e,t,n),o=k(e,t,n);return b(r,o,n)}function Ke(e,t,n){let r=O(e,t,n),o=w(e,t,n);return K(r,o,n)}function E(...e){let t=[],n=Math.max(...e.map(r=>r.length));for(let r=0;r<n;r++){let o=[];for(let i of e)o.push(i[r]);t.push(o)}return t}function Ae(e,t){let n={};for(let r=0;r<e.length;r++)n[e[r]]=t[r];return n}function ke(e,...t){let n=[e,...t.slice(0,-1)],r=t[t.length-1],o=[],i=Math.max(...n.map(a=>a.length));for(let a=0;a<i;a++){let u=n.map(f=>f[a]);o.push(r(...u))}return o}function we(e,...t){let n=new Set(t);return e.filter(r=>!n.has(r))}function V(e){return e[0]}function Ue(e){let t=e.length;if(t<=1)return[];let n=new Array(t-1);for(let r=1;r<t;r++)n[r-1]=e[r];return n}function Re(e,t,n=0,r=e.length){let o=e.length,i=Math.max(n>=0?n:o+n,0),a=Math.min(r>=0?r:o+r,o),u=e.slice();for(let f=i;f<a;f++)u[f]=t;return u}function ve(e){return e[e.length-1]}function Pe(e){return e.length<=1?[]:e.slice(0,-1)}var m=class extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}};var y=class extends Error{constructor(t="The operation was timed out"){super(t),this.name="TimeoutError"}};var Ie=(e,t)=>{if(!Number.isInteger(e)||e<0)throw new Error("n must be a non-negative integer.");let n=0;return(...r)=>{if(++n>=e)return t(...r)}};function Oe(e,t,{signal:n}={}){let r=null,o=function(...a){r!==null&&clearTimeout(r),!(n!=null&&n.aborted)&&(r=setTimeout(()=>{e(...a),r=null},t))},i=function(){o.cancel()};return o.cancel=function(){r!==null&&(clearTimeout(r),r=null)},n==null||n.addEventListener("abort",i,{once:!0}),o}function Ee(){}function Fe(e){let t=!1,n;return function(){if(t)return n;let r=e();return t=!0,n=r,r}}function De(e,t){let n;return function(...o){let i=Date.now();(n==null||i-n>=t)&&(n=i,e(...o))}}function Me(e){return(...t)=>!e(...t)}function Be(e,t,n){return n==null?Math.min(e,t):Math.min(Math.max(e,t),n)}function We(e,t,n){if(n==null&&(n=t,t=0),t>=n)throw new Error("The maximum value must be greater than the minimum value.");return t<=e&&e<n}function d(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n];return t}function F(e){return d(e)/e.length}function Se(e,t){let n=e.map(r=>t(r));return F(n)}function Ve(e,t=0){if(!Number.isInteger(t))throw new Error("Precision must be an integer.");let n=Math.pow(10,t);return Math.round(e*n)/n}function Ne(e,t){let n=e.map(r=>t(r));return d(n)}function Ce(e,t,n){if(t==null&&(t=e,e=0),n==null&&(n=1),!Number.isInteger(n)||n===0)throw new Error("The step value must be a non-zero integer.");let r=Math.max(Math.ceil((t-e)/n),0),o=new Array(r);for(let i=0;i<r;i++)o[i]=e+i*n;return o}function ze(e,t){let n=$({},e);for(let r of t)delete n[r];return n}function Le(e,t){let n={};for(let[r,o]of Object.entries(e))t(o,r)||(n[r]=o);return n}function _e(e,t){let n={};for(let r of t)n[r]=e[r];return n}function qe(e,t){let n={};for(let[r,o]of Object.entries(e))t(o,r)&&(n[r]=o);return n}function $e(e){let t={},n=Object.keys(e);for(let r=0;r<n.length;r++){let o=n[r],i=e[o];t[i]=o}return t}function Ge(e){if(Pt(e))return e;if(Array.isArray(e))return e.slice();if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(e instanceof Map){let t=new Map;for(let[n,r]of e)t.set(n,r);return t}if(e instanceof Set){let t=new Set;for(let n of e)t.add(n);return t}if(typeof e=="object"){let t=Object.getPrototypeOf(e),n=Object.create(t);return Object.assign(n,e)}return e}function Pt(e){return e==null||typeof e!="object"&&typeof e!="function"}function T(e){if(It(e))return e;if(Array.isArray(e))return e.map(t=>T(t));if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(e instanceof Map){let t=new Map;for(let[n,r]of e.entries())t.set(n,T(r));return t}if(e instanceof Set){let t=new Set;for(let n of e.values())t.add(T(n));return t}if(Ot(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);for(let n=0;n<e.length;n++)t[n]=T(e[n]);return t}if(e instanceof ArrayBuffer||e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let t=new DataView(e.buffer.slice(0));return x(e,t),t}if(typeof File!="undefined"&&e instanceof File){let t=new File([e],e.name,{type:e.type});return x(e,t),t}if(e instanceof Blob){let t=new Blob([e],{type:e.type});return x(e,t),t}if(e instanceof Error){let t=new e.constructor;return t.message=e.message,t.name=e.name,t.stack=e.stack,t.cause=e.cause,x(e,t),t}if(typeof e=="object"&&e!==null){let t={};return x(e,t),t}if(typeof e!="function")return e}function It(e){return e==null||typeof e!="object"&&typeof e!="function"}function x(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)){let r=Object.getOwnPropertyDescriptor(e,n);(r!=null&&r.writable||r!=null&&r.set)&&typeof(r==null?void 0:r.value)!="function"&&(t[n]=T(e[n]))}}function Ot(e){return e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof BigUint64Array||e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof BigInt64Array||e instanceof Float32Array||e instanceof Float64Array}function Xe(e){if(typeof e!="object"||e==null)return!1;if(Object.getPrototypeOf(e)===null)return!0;if(e.toString()!=="[object Object]")return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function je(e){return Ye(e)}function Ye(e,t=""){let n={},r=Object.keys(e);for(let o=0;o<r.length;o++){let i=r[o],a=e[i],u=t?`${t}.${i}`:i;if(Xe(a)&&Object.keys(a).length>0){Object.assign(n,Ye(a,u));continue}if(Array.isArray(a)){for(let f=0;f<a.length;f++)n[`${u}.${f}`]=a[f];continue}n[u]=a}return n}function N(e,t){if(Object.is(e,t))return!0;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp&&t instanceof RegExp)return e.source===t.source&&e.flags===t.flags;if(typeof e!="object"||typeof t!="object"||e===null||t===null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||p(n,r).length!==n.length)return!1;for(let o=0;o<n.length;o++){let i=n[o],a=e[i],u=t[i];if(!N(a,u))return!1}return!0}function He(e){return e==null}function Ze(e){return e!=null}function Je(e){return e===null}function Qe(e){return e===void 0}function D(e){return typeof e=="number"&&e>-1&&e%1===0&&e<=Number.MAX_SAFE_INTEGER}function et(e){return typeof e=="function"}function tt(e){return e!=null&&typeof e!="function"&&D(e.length)}function nt(e){return e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof BigUint64Array||e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof BigInt64Array||e instanceof Float32Array||e instanceof Float64Array}function M(e,{signal:t}={}){return new Promise((n,r)=>{let o=()=>{r(new m)},i=()=>{clearTimeout(a),o()};if(t!=null&&t.aborted)return o();let a=setTimeout(n,e);t==null||t.addEventListener("abort",i,{once:!0})})}function rt(e){return h(this,null,function*(){throw yield M(e),new y})}function ot(e,t){return h(this,null,function*(){return Promise.race([e(),rt(t)])})}var B=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase();var Et=/[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g;function l(e){var t;return Array.from((t=e.match(Et))!=null?t:[])}function it(e){let t=l(e);if(t.length===0)return"";let[n,...r]=t;return`${n.toLowerCase()}${r.map(o=>B(o)).join("")}`}var at=e=>l(e).map(n=>n.toLowerCase()).join("_");var ut=e=>l(e).map(n=>n.toLowerCase()).join("-");var ft=e=>l(e).map(n=>n.toLowerCase()).join(" ");function st(e){let t=l(e.trim()),n="";for(let r of t)n&&(n+=" "),r===r.toUpperCase()?n+=r:n+=r[0].toUpperCase()+r.slice(1).toLowerCase();return n}function lt(e,t=1){return t=Math.max(Math.floor(t),0),t===0?[]:G(e,t)}function ct(...e){return s(e)}function Tt(e,...t){let n=e,r=s(t);return g(n,r)}function pt(e,t,n=0,r=e.length){return n=Math.floor(n),r=Math.floor(r),n||(n=0),r||(r=0),Q(e,t,n,r)}var Ft=/^(?:0|[1-9]\d*)$/;function mt(e){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e<Number.MAX_SAFE_INTEGER;case"symbol":return!1;case"string":return Ft.test(e)}}function W(e){let t=/\\(\\)?/g,n=RegExp(`[^.[\\]]+|\\[(?:([^"'][^[]*)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))`,"g"),r=[];e[0]==="."&&r.push("");let o,i=0;for(;(o=n.exec(e))!==null;){let a=o[0],u=o[1],f=o[2],c=o[3];f?a=c.replace(t,"$1"):u&&(a=u),r.push(a),n.lastIndex===i?n.lastIndex++:i=n.lastIndex}return r}function S(e,t,n){let r=Array.isArray(t)?t:typeof t=="string"?W(t):[t],o=e;for(let a=0;a<r.length-1;a++){let u=r[a],f=r[a+1];o[u]==null&&(o[u]=mt(f)?[]:{}),o=o[u]}let i=r[r.length-1];return o[i]=n,e}function yt(e,t){let n={},r=E(e,t);for(let o=0;o<r.length;o++){let[i,a]=r[o];i!=null&&S(n,i,a)}return n}var Dt=/^\w*$/,Mt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;function dt(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return!Dt.test(e)&&Mt.test(e)}}function xt(e,t,n){let r;if(Array.isArray(t)?r=t:typeof t=="string"&&dt(t)&&(e==null?void 0:e[t])==null?r=W(t):r=[t],r.length===0)return n;let o=e,i;for(i=0;i<r.length&&o!=null;i++){let a=r[i];Object.is(a.valueOf(),-0)&&(a="-0"),o=o[a]}return o===null&&i===r.length||o!=null?o:n}function ht(e){var n;if(typeof e!="object"||e==null)return!1;if(Object.getPrototypeOf(e)===null)return!0;if(e.toString()!=="[object Object]"){let r=e[Symbol.toStringTag];return r==null||!((n=Object.getOwnPropertyDescriptor(e,Symbol.toStringTag))!=null&&n.writable)?!1:e.toString()===`[object ${r}]`}let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function gt(e){return Array.isArray(e)}function bt(e){return nt(e)}var Kt=(e,t,n=0)=>e.startsWith(t,n);var At=(e,t,n=e.length)=>e.endsWith(t,n);function kt(e=[]){let t=e[0],n;for(let r of e)(n==null||r>n)&&(n=r,t=r);return t}function wt(e=[]){let t=e[0],n;for(let r of e)(n==null||r<n)&&(n=r,t=r);return t}window._=C;})();
|
|
2
2
|
//# sourceMappingURL=browser.global.js.map
|