es-toolkit 1.13.1-dev.304 → 1.13.1-dev.305
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 +35 -35
- package/dist/browser.js +12 -0
- package/dist/browser.js.map +1 -1
- package/dist/browser.mjs +32 -30
- package/dist/browser.mjs.map +1 -1
- package/dist/chunk-74CREQXW.mjs +9 -0
- package/dist/chunk-74CREQXW.mjs.map +1 -0
- package/dist/chunk-J4SHAMXJ.mjs +13 -0
- package/dist/chunk-J4SHAMXJ.mjs.map +1 -0
- package/dist/chunk-U4JWMVQK.mjs +1 -0
- package/dist/{chunk-UDDG43RB.mjs → chunk-VV3J7RVG.mjs} +73 -65
- package/dist/{chunk-UDDG43RB.mjs.map → chunk-VV3J7RVG.mjs.map} +1 -1
- package/dist/compat/index.d.mts +2 -0
- package/dist/compat/index.d.ts +2 -0
- package/dist/compat/index.js +14 -0
- package/dist/compat/index.js.map +1 -1
- package/dist/compat/index.mjs +74 -66
- package/dist/function/index.mjs +3 -3
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +75 -67
- package/dist/predicate/index.d.mts +2 -0
- package/dist/predicate/index.d.ts +2 -0
- package/dist/predicate/index.js +14 -0
- package/dist/predicate/index.js.map +1 -1
- package/dist/predicate/index.mjs +15 -7
- package/dist/predicate/isArrayLike.d.mts +17 -0
- package/dist/predicate/isArrayLike.d.ts +17 -0
- package/dist/predicate/isArrayLike.js +40 -0
- package/dist/predicate/isArrayLike.js.map +1 -0
- package/dist/predicate/isArrayLike.mjs +9 -0
- package/dist/predicate/isArrayLike.mjs.map +1 -0
- package/dist/predicate/isFunction.d.mts +16 -0
- package/dist/predicate/isFunction.d.ts +16 -0
- package/dist/predicate/isFunction.js +33 -0
- package/dist/predicate/isFunction.js.map +1 -0
- package/dist/predicate/isFunction.mjs +8 -0
- package/dist/predicate/isFunction.mjs.map +1 -0
- package/dist/string/index.mjs +6 -6
- package/package.json +1 -1
- package/umd/browser.global.js +1 -1
- package/dist/chunk-B645AYL4.mjs +0 -1
- /package/dist/{chunk-B645AYL4.mjs.map → chunk-U4JWMVQK.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import "./chunk-NKLIE2OI.mjs";
|
|
2
2
|
import "./chunk-XT74R35S.mjs";
|
|
3
|
+
import {
|
|
4
|
+
camelCase
|
|
5
|
+
} from "./chunk-Y5V7UAZZ.mjs";
|
|
6
|
+
import {
|
|
7
|
+
capitalize
|
|
8
|
+
} from "./chunk-U56ZOM7L.mjs";
|
|
3
9
|
import {
|
|
4
10
|
kebabCase
|
|
5
11
|
} from "./chunk-EYYZQFOP.mjs";
|
|
@@ -12,6 +18,7 @@ import {
|
|
|
12
18
|
import {
|
|
13
19
|
startCase
|
|
14
20
|
} from "./chunk-QXTNZR7B.mjs";
|
|
21
|
+
import "./chunk-WVQ7YVRK.mjs";
|
|
15
22
|
import "./chunk-4OIZM4HS.mjs";
|
|
16
23
|
import {
|
|
17
24
|
withTimeout
|
|
@@ -20,32 +27,31 @@ import "./chunk-CVVZHOJX.mjs";
|
|
|
20
27
|
import {
|
|
21
28
|
delay
|
|
22
29
|
} from "./chunk-O64NE2P4.mjs";
|
|
30
|
+
import "./chunk-U4JWMVQK.mjs";
|
|
23
31
|
import {
|
|
24
|
-
|
|
25
|
-
} from "./chunk-
|
|
32
|
+
isNil
|
|
33
|
+
} from "./chunk-WMM7TZLG.mjs";
|
|
26
34
|
import {
|
|
27
|
-
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import "./chunk-WVQ7YVRK.mjs";
|
|
30
|
-
import "./chunk-B645AYL4.mjs";
|
|
35
|
+
isNotNil
|
|
36
|
+
} from "./chunk-BMRTZMRE.mjs";
|
|
31
37
|
import {
|
|
32
38
|
isNull
|
|
33
39
|
} from "./chunk-AIRSKN47.mjs";
|
|
34
40
|
import {
|
|
35
41
|
isUndefined
|
|
36
42
|
} from "./chunk-VH2PV426.mjs";
|
|
43
|
+
import {
|
|
44
|
+
isArrayLike
|
|
45
|
+
} from "./chunk-J4SHAMXJ.mjs";
|
|
37
46
|
import {
|
|
38
47
|
isEqual
|
|
39
48
|
} from "./chunk-JYSV56US.mjs";
|
|
49
|
+
import {
|
|
50
|
+
isFunction
|
|
51
|
+
} from "./chunk-74CREQXW.mjs";
|
|
40
52
|
import {
|
|
41
53
|
isLength
|
|
42
54
|
} from "./chunk-27QMXBLJ.mjs";
|
|
43
|
-
import {
|
|
44
|
-
isNil
|
|
45
|
-
} from "./chunk-WMM7TZLG.mjs";
|
|
46
|
-
import {
|
|
47
|
-
isNotNil
|
|
48
|
-
} from "./chunk-BMRTZMRE.mjs";
|
|
49
55
|
import "./chunk-54TK5BIS.mjs";
|
|
50
56
|
import {
|
|
51
57
|
omitBy
|
|
@@ -96,32 +102,7 @@ import {
|
|
|
96
102
|
import {
|
|
97
103
|
range
|
|
98
104
|
} from "./chunk-DPH2KE6O.mjs";
|
|
99
|
-
import "./chunk-236H5JZJ.mjs";
|
|
100
|
-
import {
|
|
101
|
-
debounce
|
|
102
|
-
} from "./chunk-3IP4JVLL.mjs";
|
|
103
|
-
import {
|
|
104
|
-
negate
|
|
105
|
-
} from "./chunk-BOOQBJN2.mjs";
|
|
106
|
-
import {
|
|
107
|
-
noop
|
|
108
|
-
} from "./chunk-LKXCOLNY.mjs";
|
|
109
|
-
import {
|
|
110
|
-
once
|
|
111
|
-
} from "./chunk-CMBC4MXG.mjs";
|
|
112
|
-
import {
|
|
113
|
-
throttle
|
|
114
|
-
} from "./chunk-QOJGMVVR.mjs";
|
|
115
105
|
import "./chunk-DDH7K4QM.mjs";
|
|
116
|
-
import {
|
|
117
|
-
zipObject
|
|
118
|
-
} from "./chunk-6GWEY5EL.mjs";
|
|
119
|
-
import {
|
|
120
|
-
zipWith
|
|
121
|
-
} from "./chunk-4KYXHZ4R.mjs";
|
|
122
|
-
import {
|
|
123
|
-
unzip
|
|
124
|
-
} from "./chunk-UYZKMBDO.mjs";
|
|
125
106
|
import {
|
|
126
107
|
unzipWith
|
|
127
108
|
} from "./chunk-IFNXROZR.mjs";
|
|
@@ -141,11 +122,11 @@ import {
|
|
|
141
122
|
zip
|
|
142
123
|
} from "./chunk-IDCUZVJL.mjs";
|
|
143
124
|
import {
|
|
144
|
-
|
|
145
|
-
} from "./chunk-
|
|
125
|
+
zipObject
|
|
126
|
+
} from "./chunk-6GWEY5EL.mjs";
|
|
146
127
|
import {
|
|
147
|
-
|
|
148
|
-
} from "./chunk-
|
|
128
|
+
zipWith
|
|
129
|
+
} from "./chunk-4KYXHZ4R.mjs";
|
|
149
130
|
import {
|
|
150
131
|
toFilled
|
|
151
132
|
} from "./chunk-OP4OAKQJ.mjs";
|
|
@@ -158,9 +139,6 @@ import {
|
|
|
158
139
|
import {
|
|
159
140
|
unionWith
|
|
160
141
|
} from "./chunk-2ZCITDMK.mjs";
|
|
161
|
-
import {
|
|
162
|
-
uniqWith
|
|
163
|
-
} from "./chunk-237HGSZS.mjs";
|
|
164
142
|
import {
|
|
165
143
|
uniq
|
|
166
144
|
} from "./chunk-DVK2N4KC.mjs";
|
|
@@ -168,11 +146,11 @@ import {
|
|
|
168
146
|
uniqBy
|
|
169
147
|
} from "./chunk-B4COTK4K.mjs";
|
|
170
148
|
import {
|
|
171
|
-
|
|
172
|
-
} from "./chunk-
|
|
149
|
+
uniqWith
|
|
150
|
+
} from "./chunk-237HGSZS.mjs";
|
|
173
151
|
import {
|
|
174
|
-
|
|
175
|
-
} from "./chunk-
|
|
152
|
+
unzip
|
|
153
|
+
} from "./chunk-UYZKMBDO.mjs";
|
|
176
154
|
import {
|
|
177
155
|
sample
|
|
178
156
|
} from "./chunk-2KNLZB7V.mjs";
|
|
@@ -198,11 +176,11 @@ import {
|
|
|
198
176
|
takeRight
|
|
199
177
|
} from "./chunk-N3QYJX4T.mjs";
|
|
200
178
|
import {
|
|
201
|
-
|
|
202
|
-
} from "./chunk-
|
|
179
|
+
takeRightWhile
|
|
180
|
+
} from "./chunk-NTLX2MPV.mjs";
|
|
203
181
|
import {
|
|
204
|
-
|
|
205
|
-
} from "./chunk-
|
|
182
|
+
takeWhile
|
|
183
|
+
} from "./chunk-2IXFGSUA.mjs";
|
|
206
184
|
import {
|
|
207
185
|
intersectionBy
|
|
208
186
|
} from "./chunk-O6UXZR3U.mjs";
|
|
@@ -222,17 +200,14 @@ import {
|
|
|
222
200
|
minBy
|
|
223
201
|
} from "./chunk-IJD7FE2Z.mjs";
|
|
224
202
|
import {
|
|
225
|
-
|
|
226
|
-
} from "./chunk-
|
|
203
|
+
orderBy
|
|
204
|
+
} from "./chunk-7B7W36UP.mjs";
|
|
227
205
|
import {
|
|
228
|
-
|
|
229
|
-
} from "./chunk-
|
|
206
|
+
partition
|
|
207
|
+
} from "./chunk-DN3NOZ3H.mjs";
|
|
230
208
|
import {
|
|
231
209
|
flattenDeep
|
|
232
210
|
} from "./chunk-ML727RRJ.mjs";
|
|
233
|
-
import {
|
|
234
|
-
flatten
|
|
235
|
-
} from "./chunk-33MSBDC6.mjs";
|
|
236
211
|
import {
|
|
237
212
|
forEachRight
|
|
238
213
|
} from "./chunk-IEA53J7P.mjs";
|
|
@@ -243,11 +218,11 @@ import {
|
|
|
243
218
|
head
|
|
244
219
|
} from "./chunk-HM2JT2RX.mjs";
|
|
245
220
|
import {
|
|
246
|
-
|
|
247
|
-
} from "./chunk-
|
|
221
|
+
initial
|
|
222
|
+
} from "./chunk-XPSOKBRZ.mjs";
|
|
248
223
|
import {
|
|
249
|
-
|
|
250
|
-
} from "./chunk-
|
|
224
|
+
intersection
|
|
225
|
+
} from "./chunk-FVVSE2F2.mjs";
|
|
251
226
|
import {
|
|
252
227
|
differenceBy
|
|
253
228
|
} from "./chunk-LVWX5B43.mjs";
|
|
@@ -266,6 +241,27 @@ import {
|
|
|
266
241
|
import {
|
|
267
242
|
dropWhile
|
|
268
243
|
} from "./chunk-LJ2C6MVP.mjs";
|
|
244
|
+
import {
|
|
245
|
+
fill
|
|
246
|
+
} from "./chunk-YFN6KOC4.mjs";
|
|
247
|
+
import {
|
|
248
|
+
flatMap
|
|
249
|
+
} from "./chunk-UY76KTPE.mjs";
|
|
250
|
+
import {
|
|
251
|
+
flatten
|
|
252
|
+
} from "./chunk-33MSBDC6.mjs";
|
|
253
|
+
import {
|
|
254
|
+
chunk
|
|
255
|
+
} from "./chunk-E6C5EZQA.mjs";
|
|
256
|
+
import {
|
|
257
|
+
compact
|
|
258
|
+
} from "./chunk-DTJJIMKJ.mjs";
|
|
259
|
+
import {
|
|
260
|
+
countBy
|
|
261
|
+
} from "./chunk-CRSKT4WW.mjs";
|
|
262
|
+
import {
|
|
263
|
+
difference
|
|
264
|
+
} from "./chunk-JPUKH67K.mjs";
|
|
269
265
|
import "./chunk-F47GLYUU.mjs";
|
|
270
266
|
import {
|
|
271
267
|
AbortError
|
|
@@ -273,12 +269,22 @@ import {
|
|
|
273
269
|
import {
|
|
274
270
|
TimeoutError
|
|
275
271
|
} from "./chunk-KIOYQRMQ.mjs";
|
|
272
|
+
import "./chunk-236H5JZJ.mjs";
|
|
276
273
|
import {
|
|
277
|
-
|
|
278
|
-
} from "./chunk-
|
|
274
|
+
negate
|
|
275
|
+
} from "./chunk-BOOQBJN2.mjs";
|
|
279
276
|
import {
|
|
280
|
-
|
|
281
|
-
} from "./chunk-
|
|
277
|
+
noop
|
|
278
|
+
} from "./chunk-LKXCOLNY.mjs";
|
|
279
|
+
import {
|
|
280
|
+
once
|
|
281
|
+
} from "./chunk-CMBC4MXG.mjs";
|
|
282
|
+
import {
|
|
283
|
+
throttle
|
|
284
|
+
} from "./chunk-QOJGMVVR.mjs";
|
|
285
|
+
import {
|
|
286
|
+
debounce
|
|
287
|
+
} from "./chunk-3IP4JVLL.mjs";
|
|
282
288
|
import "./chunk-24FKGR6U.mjs";
|
|
283
289
|
export {
|
|
284
290
|
AbortError,
|
|
@@ -313,7 +319,9 @@ export {
|
|
|
313
319
|
intersectionBy,
|
|
314
320
|
intersectionWith,
|
|
315
321
|
invert,
|
|
322
|
+
isArrayLike,
|
|
316
323
|
isEqual,
|
|
324
|
+
isFunction,
|
|
317
325
|
isLength,
|
|
318
326
|
isNil,
|
|
319
327
|
isNotNil,
|
|
@@ -5,3 +5,5 @@ export { isNull } from './isNull.mjs';
|
|
|
5
5
|
export { isUndefined } from './isUndefined.mjs';
|
|
6
6
|
export { isLength } from './isLength.mjs';
|
|
7
7
|
export { isPlainObject } from './isPlainObject.mjs';
|
|
8
|
+
export { isFunction } from './isFunction.mjs';
|
|
9
|
+
export { isArrayLike } from './isArrayLike.mjs';
|
|
@@ -5,3 +5,5 @@ export { isNull } from './isNull.js';
|
|
|
5
5
|
export { isUndefined } from './isUndefined.js';
|
|
6
6
|
export { isLength } from './isLength.js';
|
|
7
7
|
export { isPlainObject } from './isPlainObject.js';
|
|
8
|
+
export { isFunction } from './isFunction.js';
|
|
9
|
+
export { isArrayLike } from './isArrayLike.js';
|
package/dist/predicate/index.js
CHANGED
|
@@ -20,7 +20,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/predicate/index.ts
|
|
21
21
|
var predicate_exports = {};
|
|
22
22
|
__export(predicate_exports, {
|
|
23
|
+
isArrayLike: () => isArrayLike,
|
|
23
24
|
isEqual: () => isEqual,
|
|
25
|
+
isFunction: () => isFunction,
|
|
24
26
|
isLength: () => isLength,
|
|
25
27
|
isNil: () => isNil,
|
|
26
28
|
isNotNil: () => isNotNil,
|
|
@@ -118,9 +120,21 @@ function isPlainObject(object) {
|
|
|
118
120
|
}
|
|
119
121
|
return Object.getPrototypeOf(object) === proto;
|
|
120
122
|
}
|
|
123
|
+
|
|
124
|
+
// src/predicate/isFunction.ts
|
|
125
|
+
function isFunction(value) {
|
|
126
|
+
return typeof value === "function";
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// src/predicate/isArrayLike.ts
|
|
130
|
+
function isArrayLike(value) {
|
|
131
|
+
return value != null && typeof value !== "function" && isLength(value.length);
|
|
132
|
+
}
|
|
121
133
|
// Annotate the CommonJS export names for ESM import in node:
|
|
122
134
|
0 && (module.exports = {
|
|
135
|
+
isArrayLike,
|
|
123
136
|
isEqual,
|
|
137
|
+
isFunction,
|
|
124
138
|
isLength,
|
|
125
139
|
isNil,
|
|
126
140
|
isNotNil,
|
|
@@ -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"],"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';\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}"],"mappings":";;;;;;;;;;;;;;;;;;;;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;","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"],"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';\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' && 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,cAAc,SAAU,MAA6B,MAAM;AACtG;","names":[]}
|
package/dist/predicate/index.mjs
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-U4JWMVQK.mjs";
|
|
2
|
+
import {
|
|
3
|
+
isNil
|
|
4
|
+
} from "../chunk-WMM7TZLG.mjs";
|
|
5
|
+
import {
|
|
6
|
+
isNotNil
|
|
7
|
+
} from "../chunk-BMRTZMRE.mjs";
|
|
2
8
|
import {
|
|
3
9
|
isNull
|
|
4
10
|
} from "../chunk-AIRSKN47.mjs";
|
|
5
11
|
import {
|
|
6
12
|
isUndefined
|
|
7
13
|
} from "../chunk-VH2PV426.mjs";
|
|
14
|
+
import {
|
|
15
|
+
isArrayLike
|
|
16
|
+
} from "../chunk-J4SHAMXJ.mjs";
|
|
8
17
|
import {
|
|
9
18
|
isEqual
|
|
10
19
|
} from "../chunk-JYSV56US.mjs";
|
|
20
|
+
import {
|
|
21
|
+
isFunction
|
|
22
|
+
} from "../chunk-74CREQXW.mjs";
|
|
11
23
|
import {
|
|
12
24
|
isLength
|
|
13
25
|
} from "../chunk-27QMXBLJ.mjs";
|
|
14
|
-
import {
|
|
15
|
-
isNil
|
|
16
|
-
} from "../chunk-WMM7TZLG.mjs";
|
|
17
|
-
import {
|
|
18
|
-
isNotNil
|
|
19
|
-
} from "../chunk-BMRTZMRE.mjs";
|
|
20
26
|
import {
|
|
21
27
|
isPlainObject
|
|
22
28
|
} from "../chunk-MIGAC7F4.mjs";
|
|
@@ -24,7 +30,9 @@ import "../chunk-R6QA7PLZ.mjs";
|
|
|
24
30
|
import "../chunk-DVK2N4KC.mjs";
|
|
25
31
|
import "../chunk-24FKGR6U.mjs";
|
|
26
32
|
export {
|
|
33
|
+
isArrayLike,
|
|
27
34
|
isEqual,
|
|
35
|
+
isFunction,
|
|
28
36
|
isLength,
|
|
29
37
|
isNil,
|
|
30
38
|
isNotNil,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if `value` is array-like.
|
|
3
|
+
*
|
|
4
|
+
* @param {unknown} value The value to check.
|
|
5
|
+
* @returns {value is ArrayLike<unknown>} Returns `true` if `value` is array-like, else `false`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* isArrayLike([1, 2, 3]); // true
|
|
9
|
+
* isArrayLike('abc'); // true
|
|
10
|
+
* isArrayLike({ 0: 'a', length: 1 }); // true
|
|
11
|
+
* isArrayLike({}); // false
|
|
12
|
+
* isArrayLike(null); // false
|
|
13
|
+
* isArrayLike(undefined); // false
|
|
14
|
+
*/
|
|
15
|
+
declare function isArrayLike(value: unknown): value is ArrayLike<unknown>;
|
|
16
|
+
|
|
17
|
+
export { isArrayLike };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if `value` is array-like.
|
|
3
|
+
*
|
|
4
|
+
* @param {unknown} value The value to check.
|
|
5
|
+
* @returns {value is ArrayLike<unknown>} Returns `true` if `value` is array-like, else `false`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* isArrayLike([1, 2, 3]); // true
|
|
9
|
+
* isArrayLike('abc'); // true
|
|
10
|
+
* isArrayLike({ 0: 'a', length: 1 }); // true
|
|
11
|
+
* isArrayLike({}); // false
|
|
12
|
+
* isArrayLike(null); // false
|
|
13
|
+
* isArrayLike(undefined); // false
|
|
14
|
+
*/
|
|
15
|
+
declare function isArrayLike(value: unknown): value is ArrayLike<unknown>;
|
|
16
|
+
|
|
17
|
+
export { isArrayLike };
|
|
@@ -0,0 +1,40 @@
|
|
|
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/isArrayLike.ts
|
|
21
|
+
var isArrayLike_exports = {};
|
|
22
|
+
__export(isArrayLike_exports, {
|
|
23
|
+
isArrayLike: () => isArrayLike
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(isArrayLike_exports);
|
|
26
|
+
|
|
27
|
+
// src/predicate/isLength.ts
|
|
28
|
+
function isLength(value) {
|
|
29
|
+
return typeof value === "number" && value > -1 && value % 1 === 0 && value <= Number.MAX_SAFE_INTEGER;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// src/predicate/isArrayLike.ts
|
|
33
|
+
function isArrayLike(value) {
|
|
34
|
+
return value != null && typeof value !== "function" && isLength(value.length);
|
|
35
|
+
}
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
isArrayLike
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=isArrayLike.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/predicate/isArrayLike.ts","../../src/predicate/isLength.ts"],"sourcesContent":["import { isLength } from './isLength';\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' && isLength((value as ArrayLike<unknown>).length);\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,SAAS,SAAS,OAAiC;AACxD,SAAO,OAAO,UAAU,YAAY,QAAQ,MAAM,QAAQ,MAAM,KAAK,SAAS,OAAO;AACvF;;;ADcO,SAAS,YAAY,OAA6C;AACvE,SAAO,SAAS,QAAQ,OAAO,UAAU,cAAc,SAAU,MAA6B,MAAM;AACtG;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if `value` is a function.
|
|
3
|
+
*
|
|
4
|
+
* @param {unknown} value The value to check.
|
|
5
|
+
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* isFunction(Array.prototype.slice); // true
|
|
9
|
+
* isFunction(async function () {}); // true
|
|
10
|
+
* isFunction(function* () {}); // true
|
|
11
|
+
* isFunction(Proxy); // true
|
|
12
|
+
* isFunction(Int8Array); // true
|
|
13
|
+
*/
|
|
14
|
+
declare function isFunction(value: unknown): value is (...args: unknown[]) => unknown;
|
|
15
|
+
|
|
16
|
+
export { isFunction };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if `value` is a function.
|
|
3
|
+
*
|
|
4
|
+
* @param {unknown} value The value to check.
|
|
5
|
+
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* isFunction(Array.prototype.slice); // true
|
|
9
|
+
* isFunction(async function () {}); // true
|
|
10
|
+
* isFunction(function* () {}); // true
|
|
11
|
+
* isFunction(Proxy); // true
|
|
12
|
+
* isFunction(Int8Array); // true
|
|
13
|
+
*/
|
|
14
|
+
declare function isFunction(value: unknown): value is (...args: unknown[]) => unknown;
|
|
15
|
+
|
|
16
|
+
export { isFunction };
|
|
@@ -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/isFunction.ts
|
|
21
|
+
var isFunction_exports = {};
|
|
22
|
+
__export(isFunction_exports, {
|
|
23
|
+
isFunction: () => isFunction
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(isFunction_exports);
|
|
26
|
+
function isFunction(value) {
|
|
27
|
+
return typeof value === "function";
|
|
28
|
+
}
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
isFunction
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=isFunction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/predicate/isFunction.ts"],"sourcesContent":["/**\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,SAAS,WAAW,OAA0D;AACnF,SAAO,OAAO,UAAU;AAC1B;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/string/index.mjs
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import "../chunk-XT74R35S.mjs";
|
|
2
|
+
import {
|
|
3
|
+
camelCase
|
|
4
|
+
} from "../chunk-Y5V7UAZZ.mjs";
|
|
5
|
+
import {
|
|
6
|
+
capitalize
|
|
7
|
+
} from "../chunk-U56ZOM7L.mjs";
|
|
2
8
|
import {
|
|
3
9
|
kebabCase
|
|
4
10
|
} from "../chunk-EYYZQFOP.mjs";
|
|
@@ -11,12 +17,6 @@ import {
|
|
|
11
17
|
import {
|
|
12
18
|
startCase
|
|
13
19
|
} from "../chunk-QXTNZR7B.mjs";
|
|
14
|
-
import {
|
|
15
|
-
camelCase
|
|
16
|
-
} from "../chunk-Y5V7UAZZ.mjs";
|
|
17
|
-
import {
|
|
18
|
-
capitalize
|
|
19
|
-
} from "../chunk-U56ZOM7L.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.305+bd7cb34c",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|