es-toolkit 1.24.0-dev.779 → 1.24.0-dev.781
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/_chunk/{isWeakSet-C2MqJE.js → isWeakSet-B8RBLD.js} +8 -0
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/array/intersection.d.mts +3 -0
- package/dist/compat/array/intersection.d.ts +3 -0
- package/dist/compat/array/intersection.mjs +23 -0
- package/dist/compat/index.d.mts +2 -1
- package/dist/compat/index.d.ts +2 -1
- package/dist/compat/index.js +21 -2
- package/dist/compat/index.mjs +2 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/index.mjs +1 -0
- package/dist/predicate/index.d.mts +1 -0
- package/dist/predicate/index.d.ts +1 -0
- package/dist/predicate/index.js +2 -1
- package/dist/predicate/index.mjs +1 -0
- package/dist/predicate/isFile.d.mts +21 -0
- package/dist/predicate/isFile.d.ts +21 -0
- package/dist/predicate/isFile.mjs +10 -0
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { uniq } from '../../array/uniq.mjs';
|
|
2
|
+
import { intersection as intersection$1 } from '../../array/intersection.mjs';
|
|
3
|
+
import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs';
|
|
4
|
+
|
|
5
|
+
function intersection(...arrays) {
|
|
6
|
+
if (arrays.length === 0) {
|
|
7
|
+
return [];
|
|
8
|
+
}
|
|
9
|
+
if (!isArrayLikeObject(arrays[0])) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
let result = uniq(Array.from(arrays[0]));
|
|
13
|
+
for (let i = 1; i < arrays.length; i++) {
|
|
14
|
+
const array = arrays[i];
|
|
15
|
+
if (!isArrayLikeObject(array)) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
result = intersection$1(result, Array.from(array));
|
|
19
|
+
}
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { intersection };
|
package/dist/compat/index.d.mts
CHANGED
|
@@ -7,7 +7,6 @@ export { flatMapDeep } from '../array/flatMapDeep.mjs';
|
|
|
7
7
|
export { forEachRight } from '../array/forEachRight.mjs';
|
|
8
8
|
export { groupBy } from '../array/groupBy.mjs';
|
|
9
9
|
export { initial } from '../array/initial.mjs';
|
|
10
|
-
export { intersection } from '../array/intersection.mjs';
|
|
11
10
|
export { intersectionBy } from '../array/intersectionBy.mjs';
|
|
12
11
|
export { intersectionWith } from '../array/intersectionWith.mjs';
|
|
13
12
|
export { isSubset } from '../array/isSubset.mjs';
|
|
@@ -59,6 +58,7 @@ export { pickBy } from '../object/pickBy.mjs';
|
|
|
59
58
|
export { toMerged } from '../object/toMerged.mjs';
|
|
60
59
|
export { isBlob } from '../predicate/isBlob.mjs';
|
|
61
60
|
export { isEqual } from '../predicate/isEqual.mjs';
|
|
61
|
+
export { isFile } from '../predicate/isFile.mjs';
|
|
62
62
|
export { isFunction } from '../predicate/isFunction.mjs';
|
|
63
63
|
export { isJSONArray } from '../predicate/isJSONArray.mjs';
|
|
64
64
|
export { isJSONObject } from '../predicate/isJSONObject.mjs';
|
|
@@ -101,6 +101,7 @@ export { flattenDepth } from './array/flattenDepth.mjs';
|
|
|
101
101
|
export { head as first, head } from './array/head.mjs';
|
|
102
102
|
export { includes } from './array/includes.mjs';
|
|
103
103
|
export { indexOf } from './array/indexOf.mjs';
|
|
104
|
+
export { intersection } from './array/intersection.mjs';
|
|
104
105
|
export { join } from './array/join.mjs';
|
|
105
106
|
export { last } from './array/last.mjs';
|
|
106
107
|
export { orderBy } from './array/orderBy.mjs';
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ export { flatMapDeep } from '../array/flatMapDeep.js';
|
|
|
7
7
|
export { forEachRight } from '../array/forEachRight.js';
|
|
8
8
|
export { groupBy } from '../array/groupBy.js';
|
|
9
9
|
export { initial } from '../array/initial.js';
|
|
10
|
-
export { intersection } from '../array/intersection.js';
|
|
11
10
|
export { intersectionBy } from '../array/intersectionBy.js';
|
|
12
11
|
export { intersectionWith } from '../array/intersectionWith.js';
|
|
13
12
|
export { isSubset } from '../array/isSubset.js';
|
|
@@ -59,6 +58,7 @@ export { pickBy } from '../object/pickBy.js';
|
|
|
59
58
|
export { toMerged } from '../object/toMerged.js';
|
|
60
59
|
export { isBlob } from '../predicate/isBlob.js';
|
|
61
60
|
export { isEqual } from '../predicate/isEqual.js';
|
|
61
|
+
export { isFile } from '../predicate/isFile.js';
|
|
62
62
|
export { isFunction } from '../predicate/isFunction.js';
|
|
63
63
|
export { isJSONArray } from '../predicate/isJSONArray.js';
|
|
64
64
|
export { isJSONObject } from '../predicate/isJSONObject.js';
|
|
@@ -101,6 +101,7 @@ export { flattenDepth } from './array/flattenDepth.js';
|
|
|
101
101
|
export { head as first, head } from './array/head.js';
|
|
102
102
|
export { includes } from './array/includes.js';
|
|
103
103
|
export { indexOf } from './array/indexOf.js';
|
|
104
|
+
export { intersection } from './array/intersection.js';
|
|
104
105
|
export { join } from './array/join.js';
|
|
105
106
|
export { last } from './array/last.js';
|
|
106
107
|
export { orderBy } from './array/orderBy.js';
|
package/dist/compat/index.js
CHANGED
|
@@ -10,7 +10,7 @@ const sumBy = require('../_chunk/sumBy-BkErWJ.js');
|
|
|
10
10
|
const randomInt = require('../_chunk/randomInt-CF7bZK.js');
|
|
11
11
|
const toMerged = require('../_chunk/toMerged-Bq5j0V.js');
|
|
12
12
|
const isPlainObject$1 = require('../_chunk/isPlainObject-DOleKH.js');
|
|
13
|
-
const isWeakSet$1 = require('../_chunk/isWeakSet-
|
|
13
|
+
const isWeakSet$1 = require('../_chunk/isWeakSet-B8RBLD.js');
|
|
14
14
|
const upperFirst = require('../_chunk/upperFirst-BUECmK.js');
|
|
15
15
|
|
|
16
16
|
function castArray(value) {
|
|
@@ -770,6 +770,24 @@ function indexOf(array, searchElement, fromIndex) {
|
|
|
770
770
|
return array.indexOf(searchElement, fromIndex);
|
|
771
771
|
}
|
|
772
772
|
|
|
773
|
+
function intersection(...arrays) {
|
|
774
|
+
if (arrays.length === 0) {
|
|
775
|
+
return [];
|
|
776
|
+
}
|
|
777
|
+
if (!isArrayLikeObject(arrays[0])) {
|
|
778
|
+
return [];
|
|
779
|
+
}
|
|
780
|
+
let result = zipWith.uniq(Array.from(arrays[0]));
|
|
781
|
+
for (let i = 1; i < arrays.length; i++) {
|
|
782
|
+
const array = arrays[i];
|
|
783
|
+
if (!isArrayLikeObject(array)) {
|
|
784
|
+
return [];
|
|
785
|
+
}
|
|
786
|
+
result = zipWith.intersection(result, Array.from(array));
|
|
787
|
+
}
|
|
788
|
+
return result;
|
|
789
|
+
}
|
|
790
|
+
|
|
773
791
|
function join(array, separator = ',') {
|
|
774
792
|
return array.join(separator);
|
|
775
793
|
}
|
|
@@ -2173,7 +2191,6 @@ exports.flatMapDeep = zipWith.flatMapDeep;
|
|
|
2173
2191
|
exports.forEachRight = zipWith.forEachRight;
|
|
2174
2192
|
exports.groupBy = zipWith.groupBy;
|
|
2175
2193
|
exports.initial = zipWith.initial;
|
|
2176
|
-
exports.intersection = zipWith.intersection;
|
|
2177
2194
|
exports.intersectionBy = zipWith.intersectionBy;
|
|
2178
2195
|
exports.intersectionWith = zipWith.intersectionWith;
|
|
2179
2196
|
exports.isSubset = zipWith.isSubset;
|
|
@@ -2231,6 +2248,7 @@ exports.isPrimitive = isPlainObject$1.isPrimitive;
|
|
|
2231
2248
|
exports.eq = isWeakSet$1.eq;
|
|
2232
2249
|
exports.isBlob = isWeakSet$1.isBlob;
|
|
2233
2250
|
exports.isEqual = isWeakSet$1.isEqual;
|
|
2251
|
+
exports.isFile = isWeakSet$1.isFile;
|
|
2234
2252
|
exports.isFunction = isWeakSet$1.isFunction;
|
|
2235
2253
|
exports.isJSONArray = isWeakSet$1.isJSONArray;
|
|
2236
2254
|
exports.isJSONObject = isWeakSet$1.isJSONObject;
|
|
@@ -2297,6 +2315,7 @@ exports.head = head;
|
|
|
2297
2315
|
exports.inRange = inRange;
|
|
2298
2316
|
exports.includes = includes;
|
|
2299
2317
|
exports.indexOf = indexOf;
|
|
2318
|
+
exports.intersection = intersection;
|
|
2300
2319
|
exports.invertBy = invertBy;
|
|
2301
2320
|
exports.isArguments = isArguments;
|
|
2302
2321
|
exports.isArray = isArray;
|
package/dist/compat/index.mjs
CHANGED
|
@@ -7,7 +7,6 @@ export { flatMapDeep } from '../array/flatMapDeep.mjs';
|
|
|
7
7
|
export { forEachRight } from '../array/forEachRight.mjs';
|
|
8
8
|
export { groupBy } from '../array/groupBy.mjs';
|
|
9
9
|
export { initial } from '../array/initial.mjs';
|
|
10
|
-
export { intersection } from '../array/intersection.mjs';
|
|
11
10
|
export { intersectionBy } from '../array/intersectionBy.mjs';
|
|
12
11
|
export { intersectionWith } from '../array/intersectionWith.mjs';
|
|
13
12
|
export { isSubset } from '../array/isSubset.mjs';
|
|
@@ -62,6 +61,7 @@ export { toMerged } from '../object/toMerged.mjs';
|
|
|
62
61
|
export { isBlob } from '../predicate/isBlob.mjs';
|
|
63
62
|
export { isEqual } from '../predicate/isEqual.mjs';
|
|
64
63
|
export { eq } from './util/eq.mjs';
|
|
64
|
+
export { isFile } from '../predicate/isFile.mjs';
|
|
65
65
|
export { isFunction } from '../predicate/isFunction.mjs';
|
|
66
66
|
export { isJSONArray } from '../predicate/isJSONArray.mjs';
|
|
67
67
|
export { isJSONObject } from '../predicate/isJSONObject.mjs';
|
|
@@ -103,6 +103,7 @@ export { flattenDepth } from './array/flattenDepth.mjs';
|
|
|
103
103
|
export { head as first, head } from './array/head.mjs';
|
|
104
104
|
export { includes } from './array/includes.mjs';
|
|
105
105
|
export { indexOf } from './array/indexOf.mjs';
|
|
106
|
+
export { intersection } from './array/intersection.mjs';
|
|
106
107
|
export { join } from './array/join.mjs';
|
|
107
108
|
export { last } from './array/last.mjs';
|
|
108
109
|
export { orderBy } from './array/orderBy.mjs';
|
package/dist/index.d.mts
CHANGED
|
@@ -105,6 +105,7 @@ export { isDate } from './predicate/isDate.mjs';
|
|
|
105
105
|
export { isEqual } from './predicate/isEqual.mjs';
|
|
106
106
|
export { isEqualWith } from './predicate/isEqualWith.mjs';
|
|
107
107
|
export { isError } from './predicate/isError.mjs';
|
|
108
|
+
export { isFile } from './predicate/isFile.mjs';
|
|
108
109
|
export { isFunction } from './predicate/isFunction.mjs';
|
|
109
110
|
export { isJSONArray } from './predicate/isJSONArray.mjs';
|
|
110
111
|
export { isJSONObject } from './predicate/isJSONObject.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -105,6 +105,7 @@ export { isDate } from './predicate/isDate.js';
|
|
|
105
105
|
export { isEqual } from './predicate/isEqual.js';
|
|
106
106
|
export { isEqualWith } from './predicate/isEqualWith.js';
|
|
107
107
|
export { isError } from './predicate/isError.js';
|
|
108
|
+
export { isFile } from './predicate/isFile.js';
|
|
108
109
|
export { isFunction } from './predicate/isFunction.js';
|
|
109
110
|
export { isJSONArray } from './predicate/isJSONArray.js';
|
|
110
111
|
export { isJSONObject } from './predicate/isJSONObject.js';
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ const randomInt = require('./_chunk/randomInt-CF7bZK.js');
|
|
|
13
13
|
const math_index = require('./math/index.js');
|
|
14
14
|
const toMerged = require('./_chunk/toMerged-Bq5j0V.js');
|
|
15
15
|
const object_index = require('./object/index.js');
|
|
16
|
-
const isWeakSet = require('./_chunk/isWeakSet-
|
|
16
|
+
const isWeakSet = require('./_chunk/isWeakSet-B8RBLD.js');
|
|
17
17
|
const predicate_index = require('./predicate/index.js');
|
|
18
18
|
const isPlainObject = require('./_chunk/isPlainObject-DOleKH.js');
|
|
19
19
|
const upperFirst = require('./_chunk/upperFirst-BUECmK.js');
|
|
@@ -129,6 +129,7 @@ exports.isBlob = isWeakSet.isBlob;
|
|
|
129
129
|
exports.isDate = isWeakSet.isDate;
|
|
130
130
|
exports.isEqual = isWeakSet.isEqual;
|
|
131
131
|
exports.isEqualWith = isWeakSet.isEqualWith;
|
|
132
|
+
exports.isFile = isWeakSet.isFile;
|
|
132
133
|
exports.isFunction = isWeakSet.isFunction;
|
|
133
134
|
exports.isJSONArray = isWeakSet.isJSONArray;
|
|
134
135
|
exports.isJSONObject = isWeakSet.isJSONObject;
|
package/dist/index.mjs
CHANGED
|
@@ -105,6 +105,7 @@ export { isDate } from './predicate/isDate.mjs';
|
|
|
105
105
|
export { isEqual } from './predicate/isEqual.mjs';
|
|
106
106
|
export { isEqualWith } from './predicate/isEqualWith.mjs';
|
|
107
107
|
export { isError } from './predicate/isError.mjs';
|
|
108
|
+
export { isFile } from './predicate/isFile.mjs';
|
|
108
109
|
export { isFunction } from './predicate/isFunction.mjs';
|
|
109
110
|
export { isJSONArray } from './predicate/isJSONArray.mjs';
|
|
110
111
|
export { isJSONObject } from './predicate/isJSONObject.mjs';
|
|
@@ -5,6 +5,7 @@ export { isDate } from './isDate.mjs';
|
|
|
5
5
|
export { isEqual } from './isEqual.mjs';
|
|
6
6
|
export { isEqualWith } from './isEqualWith.mjs';
|
|
7
7
|
export { isError } from './isError.mjs';
|
|
8
|
+
export { isFile } from './isFile.mjs';
|
|
8
9
|
export { isFunction } from './isFunction.mjs';
|
|
9
10
|
export { isJSONArray } from './isJSONArray.mjs';
|
|
10
11
|
export { isJSONObject } from './isJSONObject.mjs';
|
|
@@ -5,6 +5,7 @@ export { isDate } from './isDate.js';
|
|
|
5
5
|
export { isEqual } from './isEqual.js';
|
|
6
6
|
export { isEqualWith } from './isEqualWith.js';
|
|
7
7
|
export { isError } from './isError.js';
|
|
8
|
+
export { isFile } from './isFile.js';
|
|
8
9
|
export { isFunction } from './isFunction.js';
|
|
9
10
|
export { isJSONArray } from './isJSONArray.js';
|
|
10
11
|
export { isJSONObject } from './isJSONObject.js';
|
package/dist/predicate/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const isWeakSet = require('../_chunk/isWeakSet-
|
|
5
|
+
const isWeakSet = require('../_chunk/isWeakSet-B8RBLD.js');
|
|
6
6
|
const isPlainObject = require('../_chunk/isPlainObject-DOleKH.js');
|
|
7
7
|
|
|
8
8
|
function isBoolean(x) {
|
|
@@ -26,6 +26,7 @@ exports.isBlob = isWeakSet.isBlob;
|
|
|
26
26
|
exports.isDate = isWeakSet.isDate;
|
|
27
27
|
exports.isEqual = isWeakSet.isEqual;
|
|
28
28
|
exports.isEqualWith = isWeakSet.isEqualWith;
|
|
29
|
+
exports.isFile = isWeakSet.isFile;
|
|
29
30
|
exports.isFunction = isWeakSet.isFunction;
|
|
30
31
|
exports.isJSONArray = isWeakSet.isJSONArray;
|
|
31
32
|
exports.isJSONObject = isWeakSet.isJSONObject;
|
package/dist/predicate/index.mjs
CHANGED
|
@@ -5,6 +5,7 @@ export { isDate } from './isDate.mjs';
|
|
|
5
5
|
export { isEqual } from './isEqual.mjs';
|
|
6
6
|
export { isEqualWith } from './isEqualWith.mjs';
|
|
7
7
|
export { isError } from './isError.mjs';
|
|
8
|
+
export { isFile } from './isFile.mjs';
|
|
8
9
|
export { isFunction } from './isFunction.mjs';
|
|
9
10
|
export { isJSONArray } from './isJSONArray.mjs';
|
|
10
11
|
export { isJSONObject } from './isJSONObject.mjs';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the given value is a File.
|
|
3
|
+
*
|
|
4
|
+
* This function tests whether the provided value is an instance of `File`.
|
|
5
|
+
* It returns `true` if the value is an instance of `File`, and `false` otherwise.
|
|
6
|
+
*
|
|
7
|
+
* @param {unknown} x - The value to test if it is a File.
|
|
8
|
+
* @returns {x is File} True if the value is a File, false otherwise.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const value1 = new File(["content"], "example.txt");
|
|
12
|
+
* const value2 = {};
|
|
13
|
+
* const value3 = new Blob(["content"], { type: "text/plain" });
|
|
14
|
+
*
|
|
15
|
+
* console.log(isFile(value1)); // true
|
|
16
|
+
* console.log(isFile(value2)); // false
|
|
17
|
+
* console.log(isFile(value3)); // false
|
|
18
|
+
*/
|
|
19
|
+
declare function isFile(x: unknown): x is File;
|
|
20
|
+
|
|
21
|
+
export { isFile };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the given value is a File.
|
|
3
|
+
*
|
|
4
|
+
* This function tests whether the provided value is an instance of `File`.
|
|
5
|
+
* It returns `true` if the value is an instance of `File`, and `false` otherwise.
|
|
6
|
+
*
|
|
7
|
+
* @param {unknown} x - The value to test if it is a File.
|
|
8
|
+
* @returns {x is File} True if the value is a File, false otherwise.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const value1 = new File(["content"], "example.txt");
|
|
12
|
+
* const value2 = {};
|
|
13
|
+
* const value3 = new Blob(["content"], { type: "text/plain" });
|
|
14
|
+
*
|
|
15
|
+
* console.log(isFile(value1)); // true
|
|
16
|
+
* console.log(isFile(value2)); // false
|
|
17
|
+
* console.log(isFile(value3)); // false
|
|
18
|
+
*/
|
|
19
|
+
declare function isFile(x: unknown): x is File;
|
|
20
|
+
|
|
21
|
+
export { isFile };
|
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.24.0-dev.
|
|
4
|
+
"version": "1.24.0-dev.781+6b4c9ad1",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|