es-toolkit 1.36.0 → 1.37.0-dev.1241
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/CHANGELOG.md +15 -0
- package/dist/_chunk/isPlainObject-Xaozpc.js +93 -0
- package/dist/_chunk/{isPromise-CxqI1v.js → isWeakSet-C2NpfO.js} +91 -177
- package/dist/_chunk/snakeCase-BwvoPi.js +30 -0
- package/dist/_chunk/toSnakeCaseKeys-kqZCyq.js +379 -0
- package/dist/_chunk/{reverseString-BixeGz.js → upperFirst-DbrFSz.js} +19 -45
- package/dist/_chunk/{zip-BJSrRi.js → zip-DDfXXG.js} +0 -24
- package/dist/array/index.js +25 -4
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/_internal/compareValues.mjs +0 -3
- package/dist/compat/array/sampleSize.d.mts +38 -0
- package/dist/compat/array/sampleSize.d.ts +38 -0
- package/dist/compat/array/sampleSize.mjs +18 -0
- package/dist/compat/array/unzipWith.d.mts +78 -0
- package/dist/compat/array/unzipWith.d.ts +78 -0
- package/dist/compat/array/unzipWith.mjs +21 -0
- package/dist/compat/array/xor.d.mts +23 -0
- package/dist/compat/array/xor.d.ts +23 -0
- package/dist/compat/array/xor.mjs +30 -0
- package/dist/compat/compat.d.mts +6 -4
- package/dist/compat/compat.d.ts +6 -4
- package/dist/compat/compat.mjs +7 -5
- package/dist/compat/index.d.mts +6 -4
- package/dist/compat/index.d.ts +6 -4
- package/dist/compat/index.js +4678 -309
- package/dist/compat/index.mjs +7 -5
- package/dist/compat/object/omitBy.d.mts +22 -0
- package/dist/compat/object/omitBy.d.ts +22 -0
- package/dist/compat/object/omitBy.mjs +26 -0
- package/dist/compat/object/result.d.mts +33 -0
- package/dist/compat/object/result.d.ts +33 -0
- package/dist/compat/object/result.mjs +24 -0
- package/dist/compat/object/transform.d.mts +59 -0
- package/dist/compat/object/transform.d.ts +59 -0
- package/dist/compat/object/transform.mjs +30 -0
- package/dist/compat/util/toString.mjs +3 -0
- package/dist/index.js +71 -69
- package/dist/object/index.js +28 -15
- package/dist/object/toCamelCaseKeys.mjs +2 -12
- package/dist/object/toSnakeCaseKeys.mjs +1 -11
- package/dist/predicate/index.js +31 -30
- package/dist/string/index.js +23 -22
- package/package.json +1 -1
- package/dist/_chunk/toSnakeCaseKeys-DZO2eB.js +0 -4901
|
@@ -15,9 +15,6 @@ function getPriority(a) {
|
|
|
15
15
|
}
|
|
16
16
|
const compareValues = (a, b, order) => {
|
|
17
17
|
if (a !== b) {
|
|
18
|
-
if (typeof a === 'string' && typeof b === 'string') {
|
|
19
|
-
return order === 'desc' ? b.localeCompare(a) : a.localeCompare(b);
|
|
20
|
-
}
|
|
21
18
|
const aPriority = getPriority(a);
|
|
22
19
|
const bPriority = getPriority(b);
|
|
23
20
|
if (aPriority === bPriority && aPriority === 0) {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a sample element array of a specified `size`.
|
|
3
|
+
*
|
|
4
|
+
* This function takes an collection and a number, and returns an array containing the sampled elements using Floyd's algorithm.
|
|
5
|
+
*
|
|
6
|
+
* {@link https://www.nowherenearithaca.com/2013/05/robert-floyds-tiny-and-beautiful.html Floyd's algorithm}
|
|
7
|
+
*
|
|
8
|
+
* @template T - The type of elements in the collection.
|
|
9
|
+
* @param {Record<string, T> | Record<number, T> | null | undefined} collection - The collection to sample from.
|
|
10
|
+
* @param {number} size - The size of sample.
|
|
11
|
+
* @returns {T[]} A new array with sample size applied.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const result = sampleSize([1, 2, 3], 2)
|
|
15
|
+
* // result will be an array containing two of the elements from the collection.
|
|
16
|
+
* // [1, 2] or [1, 3] or [2, 3]
|
|
17
|
+
*/
|
|
18
|
+
declare function sampleSize<T>(collection: Record<string, T> | Record<number, T> | null | undefined, size?: number): T[];
|
|
19
|
+
/**
|
|
20
|
+
* Returns a sample element array of a specified `size`.
|
|
21
|
+
*
|
|
22
|
+
* This function takes an collection and a number, and returns an array containing the sampled elements using Floyd's algorithm.
|
|
23
|
+
*
|
|
24
|
+
* {@link https://www.nowherenearithaca.com/2013/05/robert-floyds-tiny-and-beautiful.html Floyd's algorithm}
|
|
25
|
+
*
|
|
26
|
+
* @template T - The type of the collection.
|
|
27
|
+
* @param {T | null | undefined} collection - The collection to sample from.
|
|
28
|
+
* @param {number} size - The size of sample.
|
|
29
|
+
* @returns {T[]} A new array with sample size applied.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* const result = sampleSize({ a: 1, b: 2, c: 3 }, 2)
|
|
33
|
+
* // result will be an array containing two of the values from the collection.
|
|
34
|
+
* // [1, 2] or [1, 3] or [2, 3]
|
|
35
|
+
*/
|
|
36
|
+
declare function sampleSize<T extends object>(collection: T | null | undefined, size?: number): Array<T[keyof T]>;
|
|
37
|
+
|
|
38
|
+
export { sampleSize };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a sample element array of a specified `size`.
|
|
3
|
+
*
|
|
4
|
+
* This function takes an collection and a number, and returns an array containing the sampled elements using Floyd's algorithm.
|
|
5
|
+
*
|
|
6
|
+
* {@link https://www.nowherenearithaca.com/2013/05/robert-floyds-tiny-and-beautiful.html Floyd's algorithm}
|
|
7
|
+
*
|
|
8
|
+
* @template T - The type of elements in the collection.
|
|
9
|
+
* @param {Record<string, T> | Record<number, T> | null | undefined} collection - The collection to sample from.
|
|
10
|
+
* @param {number} size - The size of sample.
|
|
11
|
+
* @returns {T[]} A new array with sample size applied.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const result = sampleSize([1, 2, 3], 2)
|
|
15
|
+
* // result will be an array containing two of the elements from the collection.
|
|
16
|
+
* // [1, 2] or [1, 3] or [2, 3]
|
|
17
|
+
*/
|
|
18
|
+
declare function sampleSize<T>(collection: Record<string, T> | Record<number, T> | null | undefined, size?: number): T[];
|
|
19
|
+
/**
|
|
20
|
+
* Returns a sample element array of a specified `size`.
|
|
21
|
+
*
|
|
22
|
+
* This function takes an collection and a number, and returns an array containing the sampled elements using Floyd's algorithm.
|
|
23
|
+
*
|
|
24
|
+
* {@link https://www.nowherenearithaca.com/2013/05/robert-floyds-tiny-and-beautiful.html Floyd's algorithm}
|
|
25
|
+
*
|
|
26
|
+
* @template T - The type of the collection.
|
|
27
|
+
* @param {T | null | undefined} collection - The collection to sample from.
|
|
28
|
+
* @param {number} size - The size of sample.
|
|
29
|
+
* @returns {T[]} A new array with sample size applied.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* const result = sampleSize({ a: 1, b: 2, c: 3 }, 2)
|
|
33
|
+
* // result will be an array containing two of the values from the collection.
|
|
34
|
+
* // [1, 2] or [1, 3] or [2, 3]
|
|
35
|
+
*/
|
|
36
|
+
declare function sampleSize<T extends object>(collection: T | null | undefined, size?: number): Array<T[keyof T]>;
|
|
37
|
+
|
|
38
|
+
export { sampleSize };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { sampleSize as sampleSize$1 } from '../../array/sampleSize.mjs';
|
|
2
|
+
import { isIterateeCall } from '../_internal/isIterateeCall.mjs';
|
|
3
|
+
import { clamp } from '../math/clamp.mjs';
|
|
4
|
+
import { toArray } from '../util/toArray.mjs';
|
|
5
|
+
import { toInteger } from '../util/toInteger.mjs';
|
|
6
|
+
|
|
7
|
+
function sampleSize(collection, size, guard) {
|
|
8
|
+
const arrayCollection = toArray(collection);
|
|
9
|
+
if (guard ? isIterateeCall(collection, size, guard) : size === undefined) {
|
|
10
|
+
size = 1;
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
size = clamp(toInteger(size), 0, arrayCollection.length);
|
|
14
|
+
}
|
|
15
|
+
return sampleSize$1(arrayCollection, size);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { sampleSize };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unzips an array of arrays.
|
|
3
|
+
*
|
|
4
|
+
* If the array is `null` or `undefined`, returns an empty array.
|
|
5
|
+
*
|
|
6
|
+
* @template T
|
|
7
|
+
* @param {T[][] | ArrayLike<ArrayLike<T>> | null | undefined} array - The nested array to unzip. This is an array of arrays,
|
|
8
|
+
* where each inner array contains elements to be unzipped.
|
|
9
|
+
* @returns {T[][]} A new array of unzipped elements.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const nestedArray = [[1, 2], [3, 4], [5, 6]];
|
|
13
|
+
* const result = unzipWith(nestedArray);
|
|
14
|
+
* console.log(result); // [[1, 3, 5], [2, 4, 6]]
|
|
15
|
+
*
|
|
16
|
+
* const result2 = unzipWith(null);
|
|
17
|
+
* console.log(result2); // []
|
|
18
|
+
*
|
|
19
|
+
* const result3 = unzipWith();
|
|
20
|
+
* console.log(result3); // []
|
|
21
|
+
*/
|
|
22
|
+
declare function unzipWith<T>(array: T[][] | ArrayLike<ArrayLike<T>> | null | undefined): T[][];
|
|
23
|
+
/**
|
|
24
|
+
* Unzips an array of arrays.
|
|
25
|
+
*
|
|
26
|
+
* If the array is `null` or `undefined`, returns an empty array.
|
|
27
|
+
*
|
|
28
|
+
* @template T
|
|
29
|
+
* @param {T[][] | ArrayLike<ArrayLike<T>> | null | undefined} array - The nested array to unzip. This is an array of arrays,
|
|
30
|
+
* where each inner array contains elements to be unzipped.
|
|
31
|
+
* @param {null | undefined} iteratee - A function to transform the unzipped elements.
|
|
32
|
+
* @returns {T[][]} A new array of unzipped elements.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* const nestedArray = [[1, 2], [3, 4], [5, 6]];
|
|
36
|
+
* const result = unzipWith(nestedArray, null);
|
|
37
|
+
* console.log(result); // [[1, 3, 5], [2, 4, 6]]
|
|
38
|
+
*
|
|
39
|
+
* const result2 = unzipWith(nestedArray);
|
|
40
|
+
* console.log(result2); // [[1, 3, 5], [2, 4, 6]]
|
|
41
|
+
*/
|
|
42
|
+
declare function unzipWith<T>(array: T[][] | ArrayLike<ArrayLike<T>> | null | undefined, iteratee?: null): T[][];
|
|
43
|
+
/**
|
|
44
|
+
* Unzips an array of arrays, applying an `iteratee` function to regrouped elements.
|
|
45
|
+
*
|
|
46
|
+
* If the array is `null` or `undefined`, returns an empty array.
|
|
47
|
+
*
|
|
48
|
+
* @template T, R
|
|
49
|
+
* @param {T[][] | ArrayLike<ArrayLike<T>> | null | undefined} array - The nested array to unzip. This is an array of arrays,
|
|
50
|
+
* where each inner array contains elements to be unzipped.
|
|
51
|
+
* @param {(...args: T[]) => R} iteratee - A function to transform the unzipped elements.
|
|
52
|
+
* @returns {R[]} A new array of unzipped and transformed elements.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* const nestedArray = [[1, 2], [3, 4], [5, 6]];
|
|
56
|
+
* const result = unzipWith(nestedArray, (a, b) => a + b);
|
|
57
|
+
* console.log(result); // [9, 12]
|
|
58
|
+
*/
|
|
59
|
+
declare function unzipWith<T, R>(array: T[][] | ArrayLike<ArrayLike<T>> | null | undefined, iteratee: (...args: T[]) => R): R[];
|
|
60
|
+
/**
|
|
61
|
+
* Unzips an array of arrays, applying an `iteratee` function to regrouped elements.
|
|
62
|
+
*
|
|
63
|
+
* If the array is `null` or `undefined`, returns an empty array.
|
|
64
|
+
*
|
|
65
|
+
* @template T
|
|
66
|
+
* @param {T[][] | ArrayLike<ArrayLike<T>> | null | undefined} array - The nested array to unzip. This is an array of arrays,
|
|
67
|
+
* where each inner array contains elements to be unzipped.
|
|
68
|
+
* @param {(...args: any[]) => unknown} iteratee - A function to transform the unzipped elements.
|
|
69
|
+
* @returns {any[]} A new array of unzipped and transformed elements.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* const nestedArray = [[1, 2], [3, 4], [5, 6]];
|
|
73
|
+
* const result = unzipWith(nestedArray, (a, b) => a + b);
|
|
74
|
+
* console.log(result); // [9, 12]
|
|
75
|
+
*/
|
|
76
|
+
declare function unzipWith<T>(array: T[][] | ArrayLike<ArrayLike<T>> | null | undefined, iteratee: (...args: any[]) => unknown): any[];
|
|
77
|
+
|
|
78
|
+
export { unzipWith };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unzips an array of arrays.
|
|
3
|
+
*
|
|
4
|
+
* If the array is `null` or `undefined`, returns an empty array.
|
|
5
|
+
*
|
|
6
|
+
* @template T
|
|
7
|
+
* @param {T[][] | ArrayLike<ArrayLike<T>> | null | undefined} array - The nested array to unzip. This is an array of arrays,
|
|
8
|
+
* where each inner array contains elements to be unzipped.
|
|
9
|
+
* @returns {T[][]} A new array of unzipped elements.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const nestedArray = [[1, 2], [3, 4], [5, 6]];
|
|
13
|
+
* const result = unzipWith(nestedArray);
|
|
14
|
+
* console.log(result); // [[1, 3, 5], [2, 4, 6]]
|
|
15
|
+
*
|
|
16
|
+
* const result2 = unzipWith(null);
|
|
17
|
+
* console.log(result2); // []
|
|
18
|
+
*
|
|
19
|
+
* const result3 = unzipWith();
|
|
20
|
+
* console.log(result3); // []
|
|
21
|
+
*/
|
|
22
|
+
declare function unzipWith<T>(array: T[][] | ArrayLike<ArrayLike<T>> | null | undefined): T[][];
|
|
23
|
+
/**
|
|
24
|
+
* Unzips an array of arrays.
|
|
25
|
+
*
|
|
26
|
+
* If the array is `null` or `undefined`, returns an empty array.
|
|
27
|
+
*
|
|
28
|
+
* @template T
|
|
29
|
+
* @param {T[][] | ArrayLike<ArrayLike<T>> | null | undefined} array - The nested array to unzip. This is an array of arrays,
|
|
30
|
+
* where each inner array contains elements to be unzipped.
|
|
31
|
+
* @param {null | undefined} iteratee - A function to transform the unzipped elements.
|
|
32
|
+
* @returns {T[][]} A new array of unzipped elements.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* const nestedArray = [[1, 2], [3, 4], [5, 6]];
|
|
36
|
+
* const result = unzipWith(nestedArray, null);
|
|
37
|
+
* console.log(result); // [[1, 3, 5], [2, 4, 6]]
|
|
38
|
+
*
|
|
39
|
+
* const result2 = unzipWith(nestedArray);
|
|
40
|
+
* console.log(result2); // [[1, 3, 5], [2, 4, 6]]
|
|
41
|
+
*/
|
|
42
|
+
declare function unzipWith<T>(array: T[][] | ArrayLike<ArrayLike<T>> | null | undefined, iteratee?: null): T[][];
|
|
43
|
+
/**
|
|
44
|
+
* Unzips an array of arrays, applying an `iteratee` function to regrouped elements.
|
|
45
|
+
*
|
|
46
|
+
* If the array is `null` or `undefined`, returns an empty array.
|
|
47
|
+
*
|
|
48
|
+
* @template T, R
|
|
49
|
+
* @param {T[][] | ArrayLike<ArrayLike<T>> | null | undefined} array - The nested array to unzip. This is an array of arrays,
|
|
50
|
+
* where each inner array contains elements to be unzipped.
|
|
51
|
+
* @param {(...args: T[]) => R} iteratee - A function to transform the unzipped elements.
|
|
52
|
+
* @returns {R[]} A new array of unzipped and transformed elements.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* const nestedArray = [[1, 2], [3, 4], [5, 6]];
|
|
56
|
+
* const result = unzipWith(nestedArray, (a, b) => a + b);
|
|
57
|
+
* console.log(result); // [9, 12]
|
|
58
|
+
*/
|
|
59
|
+
declare function unzipWith<T, R>(array: T[][] | ArrayLike<ArrayLike<T>> | null | undefined, iteratee: (...args: T[]) => R): R[];
|
|
60
|
+
/**
|
|
61
|
+
* Unzips an array of arrays, applying an `iteratee` function to regrouped elements.
|
|
62
|
+
*
|
|
63
|
+
* If the array is `null` or `undefined`, returns an empty array.
|
|
64
|
+
*
|
|
65
|
+
* @template T
|
|
66
|
+
* @param {T[][] | ArrayLike<ArrayLike<T>> | null | undefined} array - The nested array to unzip. This is an array of arrays,
|
|
67
|
+
* where each inner array contains elements to be unzipped.
|
|
68
|
+
* @param {(...args: any[]) => unknown} iteratee - A function to transform the unzipped elements.
|
|
69
|
+
* @returns {any[]} A new array of unzipped and transformed elements.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* const nestedArray = [[1, 2], [3, 4], [5, 6]];
|
|
73
|
+
* const result = unzipWith(nestedArray, (a, b) => a + b);
|
|
74
|
+
* console.log(result); // [9, 12]
|
|
75
|
+
*/
|
|
76
|
+
declare function unzipWith<T>(array: T[][] | ArrayLike<ArrayLike<T>> | null | undefined, iteratee: (...args: any[]) => unknown): any[];
|
|
77
|
+
|
|
78
|
+
export { unzipWith };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { unzip } from '../../array/unzip.mjs';
|
|
2
|
+
import { isArray } from '../predicate/isArray.mjs';
|
|
3
|
+
import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs';
|
|
4
|
+
|
|
5
|
+
function unzipWith(array, iteratee) {
|
|
6
|
+
if (!isArrayLikeObject(array) || !array.length) {
|
|
7
|
+
return [];
|
|
8
|
+
}
|
|
9
|
+
const unziped = isArray(array) ? unzip(array) : unzip(Array.from(array, value => Array.from(value)));
|
|
10
|
+
if (!iteratee) {
|
|
11
|
+
return unziped;
|
|
12
|
+
}
|
|
13
|
+
const result = new Array(unziped.length);
|
|
14
|
+
for (let i = 0; i < unziped.length; i++) {
|
|
15
|
+
const value = unziped[i];
|
|
16
|
+
result[i] = iteratee(...value);
|
|
17
|
+
}
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { unzipWith };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Computes the symmetric difference of the provided arrays, returning an array of elements
|
|
3
|
+
* that exist in only one of the arrays.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The type of elements in the arrays.
|
|
6
|
+
* @param {...(ArrayLike<T> | null | undefined)} arrays - The arrays to compare.
|
|
7
|
+
* @returns {T[]} An array containing the elements that are present in only one of the provided `arrays`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* // Returns [1, 2, 5, 6]
|
|
11
|
+
* xor([1, 2, 3, 4], [3, 4, 5, 6]);
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Returns ['a', 'c']
|
|
15
|
+
* xor(['a', 'b'], ['b', 'c']);
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // Returns [1, 3, 5]
|
|
19
|
+
* xor([1, 2], [2, 3], [4, 5]);
|
|
20
|
+
*/
|
|
21
|
+
declare function xor<T>(...arrays: Array<ArrayLike<T> | null | undefined>): T[];
|
|
22
|
+
|
|
23
|
+
export { xor };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Computes the symmetric difference of the provided arrays, returning an array of elements
|
|
3
|
+
* that exist in only one of the arrays.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The type of elements in the arrays.
|
|
6
|
+
* @param {...(ArrayLike<T> | null | undefined)} arrays - The arrays to compare.
|
|
7
|
+
* @returns {T[]} An array containing the elements that are present in only one of the provided `arrays`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* // Returns [1, 2, 5, 6]
|
|
11
|
+
* xor([1, 2, 3, 4], [3, 4, 5, 6]);
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Returns ['a', 'c']
|
|
15
|
+
* xor(['a', 'b'], ['b', 'c']);
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // Returns [1, 3, 5]
|
|
19
|
+
* xor([1, 2], [2, 3], [4, 5]);
|
|
20
|
+
*/
|
|
21
|
+
declare function xor<T>(...arrays: Array<ArrayLike<T> | null | undefined>): T[];
|
|
22
|
+
|
|
23
|
+
export { xor };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs';
|
|
2
|
+
import { toArray } from '../util/toArray.mjs';
|
|
3
|
+
|
|
4
|
+
function xor(...arrays) {
|
|
5
|
+
const itemCounts = new Map();
|
|
6
|
+
for (let i = 0; i < arrays.length; i++) {
|
|
7
|
+
const array = arrays[i];
|
|
8
|
+
if (!isArrayLikeObject(array)) {
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
const itemSet = new Set(toArray(array));
|
|
12
|
+
for (const item of itemSet) {
|
|
13
|
+
if (!itemCounts.has(item)) {
|
|
14
|
+
itemCounts.set(item, 1);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
itemCounts.set(item, itemCounts.get(item) + 1);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const result = [];
|
|
22
|
+
for (const [item, count] of itemCounts) {
|
|
23
|
+
if (count === 1) {
|
|
24
|
+
result.push(item);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { xor };
|
package/dist/compat/compat.d.mts
CHANGED
|
@@ -4,12 +4,9 @@ export { initial } from '../array/initial.mjs';
|
|
|
4
4
|
export { isSubset } from '../array/isSubset.mjs';
|
|
5
5
|
export { isSubsetWith } from '../array/isSubsetWith.mjs';
|
|
6
6
|
export { keyBy } from '../array/keyBy.mjs';
|
|
7
|
-
export { sampleSize } from '../array/sampleSize.mjs';
|
|
8
7
|
export { shuffle } from '../array/shuffle.mjs';
|
|
9
8
|
export { toFilled } from '../array/toFilled.mjs';
|
|
10
|
-
export { unzipWith } from '../array/unzipWith.mjs';
|
|
11
9
|
export { windowed } from '../array/windowed.mjs';
|
|
12
|
-
export { xor } from '../array/xor.mjs';
|
|
13
10
|
export { xorBy } from '../array/xorBy.mjs';
|
|
14
11
|
export { xorWith } from '../array/xorWith.mjs';
|
|
15
12
|
export { AbortError } from '../error/AbortError.mjs';
|
|
@@ -28,7 +25,6 @@ export { randomInt } from '../math/randomInt.mjs';
|
|
|
28
25
|
export { clone } from '../object/clone.mjs';
|
|
29
26
|
export { flattenObject } from '../object/flattenObject.mjs';
|
|
30
27
|
export { invert } from '../object/invert.mjs';
|
|
31
|
-
export { omitBy } from '../object/omitBy.mjs';
|
|
32
28
|
export { toCamelCaseKeys } from '../object/toCamelCaseKeys.mjs';
|
|
33
29
|
export { toMerged } from '../object/toMerged.mjs';
|
|
34
30
|
export { toSnakeCaseKeys } from '../object/toSnakeCaseKeys.mjs';
|
|
@@ -105,6 +101,7 @@ export { reject } from './array/reject.mjs';
|
|
|
105
101
|
export { remove } from './array/remove.mjs';
|
|
106
102
|
export { reverse } from './array/reverse.mjs';
|
|
107
103
|
export { sample } from './array/sample.mjs';
|
|
104
|
+
export { sampleSize } from './array/sampleSize.mjs';
|
|
108
105
|
export { size } from './array/size.mjs';
|
|
109
106
|
export { slice } from './array/slice.mjs';
|
|
110
107
|
export { some } from './array/some.mjs';
|
|
@@ -126,7 +123,9 @@ export { uniq } from './array/uniq.mjs';
|
|
|
126
123
|
export { uniqBy } from './array/uniqBy.mjs';
|
|
127
124
|
export { uniqWith } from './array/uniqWith.mjs';
|
|
128
125
|
export { unzip } from './array/unzip.mjs';
|
|
126
|
+
export { unzipWith } from './array/unzipWith.mjs';
|
|
129
127
|
export { without } from './array/without.mjs';
|
|
128
|
+
export { xor } from './array/xor.mjs';
|
|
130
129
|
export { zip } from './array/zip.mjs';
|
|
131
130
|
export { zipObject } from './array/zipObject.mjs';
|
|
132
131
|
export { zipObjectDeep } from './array/zipObjectDeep.mjs';
|
|
@@ -202,14 +201,17 @@ export { mapValues } from './object/mapValues.mjs';
|
|
|
202
201
|
export { merge } from './object/merge.mjs';
|
|
203
202
|
export { mergeWith } from './object/mergeWith.mjs';
|
|
204
203
|
export { omit } from './object/omit.mjs';
|
|
204
|
+
export { omitBy } from './object/omitBy.mjs';
|
|
205
205
|
export { pick } from './object/pick.mjs';
|
|
206
206
|
export { pickBy } from './object/pickBy.mjs';
|
|
207
207
|
export { property } from './object/property.mjs';
|
|
208
208
|
export { propertyOf } from './object/propertyOf.mjs';
|
|
209
|
+
export { result } from './object/result.mjs';
|
|
209
210
|
export { set } from './object/set.mjs';
|
|
210
211
|
export { toDefaulted } from './object/toDefaulted.mjs';
|
|
211
212
|
export { toPairs } from './object/toPairs.mjs';
|
|
212
213
|
export { toPairsIn } from './object/toPairsIn.mjs';
|
|
214
|
+
export { transform } from './object/transform.mjs';
|
|
213
215
|
export { unset } from './object/unset.mjs';
|
|
214
216
|
export { update } from './object/update.mjs';
|
|
215
217
|
export { updateWith } from './object/updateWith.mjs';
|
package/dist/compat/compat.d.ts
CHANGED
|
@@ -4,12 +4,9 @@ export { initial } from '../array/initial.js';
|
|
|
4
4
|
export { isSubset } from '../array/isSubset.js';
|
|
5
5
|
export { isSubsetWith } from '../array/isSubsetWith.js';
|
|
6
6
|
export { keyBy } from '../array/keyBy.js';
|
|
7
|
-
export { sampleSize } from '../array/sampleSize.js';
|
|
8
7
|
export { shuffle } from '../array/shuffle.js';
|
|
9
8
|
export { toFilled } from '../array/toFilled.js';
|
|
10
|
-
export { unzipWith } from '../array/unzipWith.js';
|
|
11
9
|
export { windowed } from '../array/windowed.js';
|
|
12
|
-
export { xor } from '../array/xor.js';
|
|
13
10
|
export { xorBy } from '../array/xorBy.js';
|
|
14
11
|
export { xorWith } from '../array/xorWith.js';
|
|
15
12
|
export { AbortError } from '../error/AbortError.js';
|
|
@@ -28,7 +25,6 @@ export { randomInt } from '../math/randomInt.js';
|
|
|
28
25
|
export { clone } from '../object/clone.js';
|
|
29
26
|
export { flattenObject } from '../object/flattenObject.js';
|
|
30
27
|
export { invert } from '../object/invert.js';
|
|
31
|
-
export { omitBy } from '../object/omitBy.js';
|
|
32
28
|
export { toCamelCaseKeys } from '../object/toCamelCaseKeys.js';
|
|
33
29
|
export { toMerged } from '../object/toMerged.js';
|
|
34
30
|
export { toSnakeCaseKeys } from '../object/toSnakeCaseKeys.js';
|
|
@@ -105,6 +101,7 @@ export { reject } from './array/reject.js';
|
|
|
105
101
|
export { remove } from './array/remove.js';
|
|
106
102
|
export { reverse } from './array/reverse.js';
|
|
107
103
|
export { sample } from './array/sample.js';
|
|
104
|
+
export { sampleSize } from './array/sampleSize.js';
|
|
108
105
|
export { size } from './array/size.js';
|
|
109
106
|
export { slice } from './array/slice.js';
|
|
110
107
|
export { some } from './array/some.js';
|
|
@@ -126,7 +123,9 @@ export { uniq } from './array/uniq.js';
|
|
|
126
123
|
export { uniqBy } from './array/uniqBy.js';
|
|
127
124
|
export { uniqWith } from './array/uniqWith.js';
|
|
128
125
|
export { unzip } from './array/unzip.js';
|
|
126
|
+
export { unzipWith } from './array/unzipWith.js';
|
|
129
127
|
export { without } from './array/without.js';
|
|
128
|
+
export { xor } from './array/xor.js';
|
|
130
129
|
export { zip } from './array/zip.js';
|
|
131
130
|
export { zipObject } from './array/zipObject.js';
|
|
132
131
|
export { zipObjectDeep } from './array/zipObjectDeep.js';
|
|
@@ -202,14 +201,17 @@ export { mapValues } from './object/mapValues.js';
|
|
|
202
201
|
export { merge } from './object/merge.js';
|
|
203
202
|
export { mergeWith } from './object/mergeWith.js';
|
|
204
203
|
export { omit } from './object/omit.js';
|
|
204
|
+
export { omitBy } from './object/omitBy.js';
|
|
205
205
|
export { pick } from './object/pick.js';
|
|
206
206
|
export { pickBy } from './object/pickBy.js';
|
|
207
207
|
export { property } from './object/property.js';
|
|
208
208
|
export { propertyOf } from './object/propertyOf.js';
|
|
209
|
+
export { result } from './object/result.js';
|
|
209
210
|
export { set } from './object/set.js';
|
|
210
211
|
export { toDefaulted } from './object/toDefaulted.js';
|
|
211
212
|
export { toPairs } from './object/toPairs.js';
|
|
212
213
|
export { toPairsIn } from './object/toPairsIn.js';
|
|
214
|
+
export { transform } from './object/transform.js';
|
|
213
215
|
export { unset } from './object/unset.js';
|
|
214
216
|
export { update } from './object/update.js';
|
|
215
217
|
export { updateWith } from './object/updateWith.js';
|
package/dist/compat/compat.mjs
CHANGED
|
@@ -4,13 +4,11 @@ export { initial } from '../array/initial.mjs';
|
|
|
4
4
|
export { isSubset } from '../array/isSubset.mjs';
|
|
5
5
|
export { isSubsetWith } from '../array/isSubsetWith.mjs';
|
|
6
6
|
export { keyBy } from '../array/keyBy.mjs';
|
|
7
|
-
export {
|
|
7
|
+
export { randomInt } from '../math/randomInt.mjs';
|
|
8
8
|
export { shuffle } from '../array/shuffle.mjs';
|
|
9
9
|
export { toInteger } from './util/toInteger.mjs';
|
|
10
10
|
export { toFilled } from '../array/toFilled.mjs';
|
|
11
|
-
export { unzipWith } from '../array/unzipWith.mjs';
|
|
12
11
|
export { windowed } from '../array/windowed.mjs';
|
|
13
|
-
export { xor } from '../array/xor.mjs';
|
|
14
12
|
export { xorBy } from '../array/xorBy.mjs';
|
|
15
13
|
export { xorWith } from '../array/xorWith.mjs';
|
|
16
14
|
export { AbortError } from '../error/AbortError.mjs';
|
|
@@ -26,13 +24,11 @@ export { retry } from '../function/retry.mjs';
|
|
|
26
24
|
export { unary } from '../function/unary.mjs';
|
|
27
25
|
export { median } from '../math/median.mjs';
|
|
28
26
|
export { medianBy } from '../math/medianBy.mjs';
|
|
29
|
-
export { randomInt } from '../math/randomInt.mjs';
|
|
30
27
|
export { clone } from '../object/clone.mjs';
|
|
31
28
|
export { isPrimitive } from '../predicate/isPrimitive.mjs';
|
|
32
29
|
export { flattenObject } from '../object/flattenObject.mjs';
|
|
33
30
|
export { invert } from '../object/invert.mjs';
|
|
34
31
|
export { isObjectLike } from './predicate/isObjectLike.mjs';
|
|
35
|
-
export { omitBy } from '../object/omitBy.mjs';
|
|
36
32
|
export { toCamelCaseKeys } from '../object/toCamelCaseKeys.mjs';
|
|
37
33
|
export { toMerged } from '../object/toMerged.mjs';
|
|
38
34
|
export { toSnakeCaseKeys } from '../object/toSnakeCaseKeys.mjs';
|
|
@@ -110,6 +106,7 @@ export { reject } from './array/reject.mjs';
|
|
|
110
106
|
export { remove } from './array/remove.mjs';
|
|
111
107
|
export { reverse } from './array/reverse.mjs';
|
|
112
108
|
export { sample } from './array/sample.mjs';
|
|
109
|
+
export { sampleSize } from './array/sampleSize.mjs';
|
|
113
110
|
export { size } from './array/size.mjs';
|
|
114
111
|
export { slice } from './array/slice.mjs';
|
|
115
112
|
export { some } from './array/some.mjs';
|
|
@@ -131,7 +128,9 @@ export { uniq } from './array/uniq.mjs';
|
|
|
131
128
|
export { uniqBy } from './array/uniqBy.mjs';
|
|
132
129
|
export { uniqWith } from './array/uniqWith.mjs';
|
|
133
130
|
export { unzip } from './array/unzip.mjs';
|
|
131
|
+
export { unzipWith } from './array/unzipWith.mjs';
|
|
134
132
|
export { without } from './array/without.mjs';
|
|
133
|
+
export { xor } from './array/xor.mjs';
|
|
135
134
|
export { zip } from './array/zip.mjs';
|
|
136
135
|
export { zipObject } from './array/zipObject.mjs';
|
|
137
136
|
export { zipObjectDeep } from './array/zipObjectDeep.mjs';
|
|
@@ -207,14 +206,17 @@ export { mapValues } from './object/mapValues.mjs';
|
|
|
207
206
|
export { merge } from './object/merge.mjs';
|
|
208
207
|
export { mergeWith } from './object/mergeWith.mjs';
|
|
209
208
|
export { omit } from './object/omit.mjs';
|
|
209
|
+
export { omitBy } from './object/omitBy.mjs';
|
|
210
210
|
export { pick } from './object/pick.mjs';
|
|
211
211
|
export { pickBy } from './object/pickBy.mjs';
|
|
212
212
|
export { property } from './object/property.mjs';
|
|
213
213
|
export { propertyOf } from './object/propertyOf.mjs';
|
|
214
|
+
export { result } from './object/result.mjs';
|
|
214
215
|
export { set } from './object/set.mjs';
|
|
215
216
|
export { toDefaulted } from './object/toDefaulted.mjs';
|
|
216
217
|
export { toPairs } from './object/toPairs.mjs';
|
|
217
218
|
export { toPairsIn } from './object/toPairsIn.mjs';
|
|
219
|
+
export { transform } from './object/transform.mjs';
|
|
218
220
|
export { unset } from './object/unset.mjs';
|
|
219
221
|
export { update } from './object/update.mjs';
|
|
220
222
|
export { updateWith } from './object/updateWith.mjs';
|
package/dist/compat/index.d.mts
CHANGED
|
@@ -4,12 +4,9 @@ export { initial } from '../array/initial.mjs';
|
|
|
4
4
|
export { isSubset } from '../array/isSubset.mjs';
|
|
5
5
|
export { isSubsetWith } from '../array/isSubsetWith.mjs';
|
|
6
6
|
export { keyBy } from '../array/keyBy.mjs';
|
|
7
|
-
export { sampleSize } from '../array/sampleSize.mjs';
|
|
8
7
|
export { shuffle } from '../array/shuffle.mjs';
|
|
9
8
|
export { toFilled } from '../array/toFilled.mjs';
|
|
10
|
-
export { unzipWith } from '../array/unzipWith.mjs';
|
|
11
9
|
export { windowed } from '../array/windowed.mjs';
|
|
12
|
-
export { xor } from '../array/xor.mjs';
|
|
13
10
|
export { xorBy } from '../array/xorBy.mjs';
|
|
14
11
|
export { xorWith } from '../array/xorWith.mjs';
|
|
15
12
|
export { AbortError } from '../error/AbortError.mjs';
|
|
@@ -28,7 +25,6 @@ export { randomInt } from '../math/randomInt.mjs';
|
|
|
28
25
|
export { clone } from '../object/clone.mjs';
|
|
29
26
|
export { flattenObject } from '../object/flattenObject.mjs';
|
|
30
27
|
export { invert } from '../object/invert.mjs';
|
|
31
|
-
export { omitBy } from '../object/omitBy.mjs';
|
|
32
28
|
export { toCamelCaseKeys } from '../object/toCamelCaseKeys.mjs';
|
|
33
29
|
export { toMerged } from '../object/toMerged.mjs';
|
|
34
30
|
export { toSnakeCaseKeys } from '../object/toSnakeCaseKeys.mjs';
|
|
@@ -105,6 +101,7 @@ export { reject } from './array/reject.mjs';
|
|
|
105
101
|
export { remove } from './array/remove.mjs';
|
|
106
102
|
export { reverse } from './array/reverse.mjs';
|
|
107
103
|
export { sample } from './array/sample.mjs';
|
|
104
|
+
export { sampleSize } from './array/sampleSize.mjs';
|
|
108
105
|
export { size } from './array/size.mjs';
|
|
109
106
|
export { slice } from './array/slice.mjs';
|
|
110
107
|
export { some } from './array/some.mjs';
|
|
@@ -126,7 +123,9 @@ export { uniq } from './array/uniq.mjs';
|
|
|
126
123
|
export { uniqBy } from './array/uniqBy.mjs';
|
|
127
124
|
export { uniqWith } from './array/uniqWith.mjs';
|
|
128
125
|
export { unzip } from './array/unzip.mjs';
|
|
126
|
+
export { unzipWith } from './array/unzipWith.mjs';
|
|
129
127
|
export { without } from './array/without.mjs';
|
|
128
|
+
export { xor } from './array/xor.mjs';
|
|
130
129
|
export { zip } from './array/zip.mjs';
|
|
131
130
|
export { zipObject } from './array/zipObject.mjs';
|
|
132
131
|
export { zipObjectDeep } from './array/zipObjectDeep.mjs';
|
|
@@ -202,14 +201,17 @@ export { mapValues } from './object/mapValues.mjs';
|
|
|
202
201
|
export { merge } from './object/merge.mjs';
|
|
203
202
|
export { mergeWith } from './object/mergeWith.mjs';
|
|
204
203
|
export { omit } from './object/omit.mjs';
|
|
204
|
+
export { omitBy } from './object/omitBy.mjs';
|
|
205
205
|
export { pick } from './object/pick.mjs';
|
|
206
206
|
export { pickBy } from './object/pickBy.mjs';
|
|
207
207
|
export { property } from './object/property.mjs';
|
|
208
208
|
export { propertyOf } from './object/propertyOf.mjs';
|
|
209
|
+
export { result } from './object/result.mjs';
|
|
209
210
|
export { set } from './object/set.mjs';
|
|
210
211
|
export { toDefaulted } from './object/toDefaulted.mjs';
|
|
211
212
|
export { toPairs } from './object/toPairs.mjs';
|
|
212
213
|
export { toPairsIn } from './object/toPairsIn.mjs';
|
|
214
|
+
export { transform } from './object/transform.mjs';
|
|
213
215
|
export { unset } from './object/unset.mjs';
|
|
214
216
|
export { update } from './object/update.mjs';
|
|
215
217
|
export { updateWith } from './object/updateWith.mjs';
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -4,12 +4,9 @@ export { initial } from '../array/initial.js';
|
|
|
4
4
|
export { isSubset } from '../array/isSubset.js';
|
|
5
5
|
export { isSubsetWith } from '../array/isSubsetWith.js';
|
|
6
6
|
export { keyBy } from '../array/keyBy.js';
|
|
7
|
-
export { sampleSize } from '../array/sampleSize.js';
|
|
8
7
|
export { shuffle } from '../array/shuffle.js';
|
|
9
8
|
export { toFilled } from '../array/toFilled.js';
|
|
10
|
-
export { unzipWith } from '../array/unzipWith.js';
|
|
11
9
|
export { windowed } from '../array/windowed.js';
|
|
12
|
-
export { xor } from '../array/xor.js';
|
|
13
10
|
export { xorBy } from '../array/xorBy.js';
|
|
14
11
|
export { xorWith } from '../array/xorWith.js';
|
|
15
12
|
export { AbortError } from '../error/AbortError.js';
|
|
@@ -28,7 +25,6 @@ export { randomInt } from '../math/randomInt.js';
|
|
|
28
25
|
export { clone } from '../object/clone.js';
|
|
29
26
|
export { flattenObject } from '../object/flattenObject.js';
|
|
30
27
|
export { invert } from '../object/invert.js';
|
|
31
|
-
export { omitBy } from '../object/omitBy.js';
|
|
32
28
|
export { toCamelCaseKeys } from '../object/toCamelCaseKeys.js';
|
|
33
29
|
export { toMerged } from '../object/toMerged.js';
|
|
34
30
|
export { toSnakeCaseKeys } from '../object/toSnakeCaseKeys.js';
|
|
@@ -105,6 +101,7 @@ export { reject } from './array/reject.js';
|
|
|
105
101
|
export { remove } from './array/remove.js';
|
|
106
102
|
export { reverse } from './array/reverse.js';
|
|
107
103
|
export { sample } from './array/sample.js';
|
|
104
|
+
export { sampleSize } from './array/sampleSize.js';
|
|
108
105
|
export { size } from './array/size.js';
|
|
109
106
|
export { slice } from './array/slice.js';
|
|
110
107
|
export { some } from './array/some.js';
|
|
@@ -126,7 +123,9 @@ export { uniq } from './array/uniq.js';
|
|
|
126
123
|
export { uniqBy } from './array/uniqBy.js';
|
|
127
124
|
export { uniqWith } from './array/uniqWith.js';
|
|
128
125
|
export { unzip } from './array/unzip.js';
|
|
126
|
+
export { unzipWith } from './array/unzipWith.js';
|
|
129
127
|
export { without } from './array/without.js';
|
|
128
|
+
export { xor } from './array/xor.js';
|
|
130
129
|
export { zip } from './array/zip.js';
|
|
131
130
|
export { zipObject } from './array/zipObject.js';
|
|
132
131
|
export { zipObjectDeep } from './array/zipObjectDeep.js';
|
|
@@ -202,14 +201,17 @@ export { mapValues } from './object/mapValues.js';
|
|
|
202
201
|
export { merge } from './object/merge.js';
|
|
203
202
|
export { mergeWith } from './object/mergeWith.js';
|
|
204
203
|
export { omit } from './object/omit.js';
|
|
204
|
+
export { omitBy } from './object/omitBy.js';
|
|
205
205
|
export { pick } from './object/pick.js';
|
|
206
206
|
export { pickBy } from './object/pickBy.js';
|
|
207
207
|
export { property } from './object/property.js';
|
|
208
208
|
export { propertyOf } from './object/propertyOf.js';
|
|
209
|
+
export { result } from './object/result.js';
|
|
209
210
|
export { set } from './object/set.js';
|
|
210
211
|
export { toDefaulted } from './object/toDefaulted.js';
|
|
211
212
|
export { toPairs } from './object/toPairs.js';
|
|
212
213
|
export { toPairsIn } from './object/toPairsIn.js';
|
|
214
|
+
export { transform } from './object/transform.js';
|
|
213
215
|
export { unset } from './object/unset.js';
|
|
214
216
|
export { update } from './object/update.js';
|
|
215
217
|
export { updateWith } from './object/updateWith.js';
|