Upload folder using huggingface_hub (part 14)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- node_modules/es-toolkit/dist/compat/array/uniq.d.mts +19 -0
- node_modules/es-toolkit/dist/compat/array/uniq.d.ts +19 -0
- node_modules/es-toolkit/dist/compat/array/uniq.js +24 -0
- node_modules/es-toolkit/dist/compat/array/uniq.mjs +24 -0
- node_modules/es-toolkit/dist/compat/array/uniqBy.d.mts +18 -0
- node_modules/es-toolkit/dist/compat/array/uniqBy.d.ts +18 -0
- node_modules/es-toolkit/dist/compat/array/uniqBy.js +12 -0
- node_modules/es-toolkit/dist/compat/array/uniqBy.mjs +12 -0
- node_modules/es-toolkit/dist/compat/array/uniqWith.d.mts +28 -0
- node_modules/es-toolkit/dist/compat/array/uniqWith.d.ts +28 -0
- node_modules/es-toolkit/dist/compat/array/uniqWith.js +34 -0
- node_modules/es-toolkit/dist/compat/array/uniqWith.mjs +34 -0
- node_modules/es-toolkit/dist/compat/array/unzip.d.mts +17 -0
- node_modules/es-toolkit/dist/compat/array/unzip.d.ts +17 -0
- node_modules/es-toolkit/dist/compat/array/unzip.js +25 -0
- node_modules/es-toolkit/dist/compat/array/unzip.mjs +25 -0
- node_modules/es-toolkit/dist/compat/array/unzipWith.d.mts +31 -0
- node_modules/es-toolkit/dist/compat/array/unzipWith.d.ts +31 -0
- node_modules/es-toolkit/dist/compat/array/unzipWith.js +33 -0
- node_modules/es-toolkit/dist/compat/array/unzipWith.mjs +33 -0
- node_modules/es-toolkit/dist/compat/array/without.d.mts +24 -0
- node_modules/es-toolkit/dist/compat/array/without.d.ts +24 -0
- node_modules/es-toolkit/dist/compat/array/without.js +29 -0
- node_modules/es-toolkit/dist/compat/array/without.mjs +29 -0
- node_modules/es-toolkit/dist/compat/array/xor.d.mts +24 -0
- node_modules/es-toolkit/dist/compat/array/xor.d.ts +24 -0
- node_modules/es-toolkit/dist/compat/array/xor.js +38 -0
- node_modules/es-toolkit/dist/compat/array/xor.mjs +38 -0
- node_modules/es-toolkit/dist/compat/array/xorBy.d.mts +57 -0
- node_modules/es-toolkit/dist/compat/array/xorBy.d.ts +57 -0
- node_modules/es-toolkit/dist/compat/array/xorBy.js +40 -0
- node_modules/es-toolkit/dist/compat/array/xorBy.mjs +38 -0
- node_modules/es-toolkit/dist/compat/array/xorWith.d.mts +53 -0
- node_modules/es-toolkit/dist/compat/array/xorWith.d.ts +53 -0
- node_modules/es-toolkit/dist/compat/array/xorWith.js +39 -0
- node_modules/es-toolkit/dist/compat/array/xorWith.mjs +37 -0
- node_modules/es-toolkit/dist/compat/array/zip.d.mts +187 -0
- node_modules/es-toolkit/dist/compat/array/zip.d.ts +187 -0
- node_modules/es-toolkit/dist/compat/array/zip.js +30 -0
- node_modules/es-toolkit/dist/compat/array/zip.mjs +30 -0
- node_modules/es-toolkit/dist/compat/array/zipObject.d.mts +30 -0
- node_modules/es-toolkit/dist/compat/array/zipObject.d.ts +30 -0
- node_modules/es-toolkit/dist/compat/array/zipObject.js +39 -0
- node_modules/es-toolkit/dist/compat/array/zipObject.mjs +39 -0
- node_modules/es-toolkit/dist/compat/array/zipObjectDeep.d.mts +39 -0
- node_modules/es-toolkit/dist/compat/array/zipObjectDeep.d.ts +39 -0
- node_modules/es-toolkit/dist/compat/array/zipObjectDeep.js +50 -0
- node_modules/es-toolkit/dist/compat/array/zipObjectDeep.mjs +50 -0
- node_modules/es-toolkit/dist/compat/array/zipWith.d.mts +93 -0
- node_modules/es-toolkit/dist/compat/array/zipWith.d.ts +93 -0
node_modules/es-toolkit/dist/compat/array/uniq.d.mts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/uniq.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a duplicate-free version of an array.
|
| 4 |
+
*
|
| 5 |
+
* This function takes an array and returns a new array containing only the unique values
|
| 6 |
+
* from the original array, preserving the order of first occurrence.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the array.
|
| 9 |
+
* @param arr - The array to process.
|
| 10 |
+
* @returns A new array with only unique values from the original array.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* const array = [1, 2, 2, 3, 4, 4, 5];
|
| 14 |
+
* const result = uniq(array);
|
| 15 |
+
* // result will be [1, 2, 3, 4, 5]
|
| 16 |
+
*/
|
| 17 |
+
declare function uniq<T>(arr: ArrayLike<T> | null | undefined): T[];
|
| 18 |
+
//#endregion
|
| 19 |
+
export { uniq };
|
node_modules/es-toolkit/dist/compat/array/uniq.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/uniq.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a duplicate-free version of an array.
|
| 4 |
+
*
|
| 5 |
+
* This function takes an array and returns a new array containing only the unique values
|
| 6 |
+
* from the original array, preserving the order of first occurrence.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the array.
|
| 9 |
+
* @param arr - The array to process.
|
| 10 |
+
* @returns A new array with only unique values from the original array.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* const array = [1, 2, 2, 3, 4, 4, 5];
|
| 14 |
+
* const result = uniq(array);
|
| 15 |
+
* // result will be [1, 2, 3, 4, 5]
|
| 16 |
+
*/
|
| 17 |
+
declare function uniq<T>(arr: ArrayLike<T> | null | undefined): T[];
|
| 18 |
+
//#endregion
|
| 19 |
+
export { uniq };
|
node_modules/es-toolkit/dist/compat/array/uniq.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_uniq = require("../../array/uniq.js");
|
| 2 |
+
const require_isArrayLike = require("../predicate/isArrayLike.js");
|
| 3 |
+
//#region src/compat/array/uniq.ts
|
| 4 |
+
/**
|
| 5 |
+
* Creates a duplicate-free version of an array.
|
| 6 |
+
*
|
| 7 |
+
* This function takes an array and returns a new array containing only the unique values
|
| 8 |
+
* from the original array, preserving the order of first occurrence.
|
| 9 |
+
*
|
| 10 |
+
* @template T - The type of elements in the array.
|
| 11 |
+
* @param arr - The array to process.
|
| 12 |
+
* @returns A new array with only unique values from the original array.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* const array = [1, 2, 2, 3, 4, 4, 5];
|
| 16 |
+
* const result = uniq(array);
|
| 17 |
+
* // result will be [1, 2, 3, 4, 5]
|
| 18 |
+
*/
|
| 19 |
+
function uniq(arr) {
|
| 20 |
+
if (!require_isArrayLike.isArrayLike(arr)) return [];
|
| 21 |
+
return require_uniq.uniq(Array.from(arr));
|
| 22 |
+
}
|
| 23 |
+
//#endregion
|
| 24 |
+
exports.uniq = uniq;
|
node_modules/es-toolkit/dist/compat/array/uniq.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { uniq as uniq$1 } from "../../array/uniq.mjs";
|
| 2 |
+
import { isArrayLike } from "../predicate/isArrayLike.mjs";
|
| 3 |
+
//#region src/compat/array/uniq.ts
|
| 4 |
+
/**
|
| 5 |
+
* Creates a duplicate-free version of an array.
|
| 6 |
+
*
|
| 7 |
+
* This function takes an array and returns a new array containing only the unique values
|
| 8 |
+
* from the original array, preserving the order of first occurrence.
|
| 9 |
+
*
|
| 10 |
+
* @template T - The type of elements in the array.
|
| 11 |
+
* @param arr - The array to process.
|
| 12 |
+
* @returns A new array with only unique values from the original array.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* const array = [1, 2, 2, 3, 4, 4, 5];
|
| 16 |
+
* const result = uniq(array);
|
| 17 |
+
* // result will be [1, 2, 3, 4, 5]
|
| 18 |
+
*/
|
| 19 |
+
function uniq(arr) {
|
| 20 |
+
if (!isArrayLike(arr)) return [];
|
| 21 |
+
return uniq$1(Array.from(arr));
|
| 22 |
+
}
|
| 23 |
+
//#endregion
|
| 24 |
+
export { uniq };
|
node_modules/es-toolkit/dist/compat/array/uniqBy.d.mts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { ValueIteratee } from "../_internal/ValueIteratee.mjs";
|
| 2 |
+
|
| 3 |
+
//#region src/compat/array/uniqBy.d.ts
|
| 4 |
+
/**
|
| 5 |
+
* Creates a duplicate-free version of an array, using an optional transform function.
|
| 6 |
+
*
|
| 7 |
+
* @template T
|
| 8 |
+
* @param array - The array to inspect.
|
| 9 |
+
* @param iteratee - The transform function or property name to get values from.
|
| 10 |
+
* @returns Returns the new duplicate-free array.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* uniqBy([2.1, 1.2, 2.3], Math.floor);
|
| 14 |
+
* // => [2.1, 1.2]
|
| 15 |
+
*/
|
| 16 |
+
declare function uniqBy<T>(array: ArrayLike<T> | null | undefined, iteratee: ValueIteratee<T>): T[];
|
| 17 |
+
//#endregion
|
| 18 |
+
export { uniqBy };
|
node_modules/es-toolkit/dist/compat/array/uniqBy.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { ValueIteratee } from "../_internal/ValueIteratee.js";
|
| 2 |
+
|
| 3 |
+
//#region src/compat/array/uniqBy.d.ts
|
| 4 |
+
/**
|
| 5 |
+
* Creates a duplicate-free version of an array, using an optional transform function.
|
| 6 |
+
*
|
| 7 |
+
* @template T
|
| 8 |
+
* @param array - The array to inspect.
|
| 9 |
+
* @param iteratee - The transform function or property name to get values from.
|
| 10 |
+
* @returns Returns the new duplicate-free array.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* uniqBy([2.1, 1.2, 2.3], Math.floor);
|
| 14 |
+
* // => [2.1, 1.2]
|
| 15 |
+
*/
|
| 16 |
+
declare function uniqBy<T>(array: ArrayLike<T> | null | undefined, iteratee: ValueIteratee<T>): T[];
|
| 17 |
+
//#endregion
|
| 18 |
+
export { uniqBy };
|
node_modules/es-toolkit/dist/compat/array/uniqBy.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_uniqBy = require("../../array/uniqBy.js");
|
| 2 |
+
const require_ary = require("../../function/ary.js");
|
| 3 |
+
const require_identity = require("../../function/identity.js");
|
| 4 |
+
const require_iteratee = require("../util/iteratee.js");
|
| 5 |
+
const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js");
|
| 6 |
+
//#region src/compat/array/uniqBy.ts
|
| 7 |
+
function uniqBy(array, iteratee$1 = require_identity.identity) {
|
| 8 |
+
if (!require_isArrayLikeObject.isArrayLikeObject(array)) return [];
|
| 9 |
+
return require_uniqBy.uniqBy(Array.from(array), require_ary.ary(require_iteratee.iteratee(iteratee$1), 1));
|
| 10 |
+
}
|
| 11 |
+
//#endregion
|
| 12 |
+
exports.uniqBy = uniqBy;
|
node_modules/es-toolkit/dist/compat/array/uniqBy.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { uniqBy as uniqBy$1 } from "../../array/uniqBy.mjs";
|
| 2 |
+
import { ary } from "../../function/ary.mjs";
|
| 3 |
+
import { identity } from "../../function/identity.mjs";
|
| 4 |
+
import { iteratee } from "../util/iteratee.mjs";
|
| 5 |
+
import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs";
|
| 6 |
+
//#region src/compat/array/uniqBy.ts
|
| 7 |
+
function uniqBy(array, iteratee$1 = identity) {
|
| 8 |
+
if (!isArrayLikeObject(array)) return [];
|
| 9 |
+
return uniqBy$1(Array.from(array), ary(iteratee(iteratee$1), 1));
|
| 10 |
+
}
|
| 11 |
+
//#endregion
|
| 12 |
+
export { uniqBy };
|
node_modules/es-toolkit/dist/compat/array/uniqWith.d.mts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/uniqWith.d.ts
|
| 2 |
+
type Comparator<T> = (a: T, b: T) => boolean;
|
| 3 |
+
/**
|
| 4 |
+
* This method is like `uniq`, except that it accepts a `comparator` which is used to determine the equality of elements.
|
| 5 |
+
*
|
| 6 |
+
* It creates a duplicate-free version of an array, in which only the first occurrence of each element is kept.
|
| 7 |
+
* If a `comparator` is provided, it will be invoked with two arguments: `(arrVal, othVal)` to compare elements.
|
| 8 |
+
* If no comparator is provided, shallow equality is used.
|
| 9 |
+
*
|
| 10 |
+
* The order of result values is determined by the order they appear in the input array.
|
| 11 |
+
*
|
| 12 |
+
* @template T - The type of elements in the array.
|
| 13 |
+
* @param arr - The array to process.
|
| 14 |
+
* @param [comparator] - Optional function to compare elements for equality.
|
| 15 |
+
* @returns A new array with only unique values based on the comparator.
|
| 16 |
+
*
|
| 17 |
+
* @example
|
| 18 |
+
* const array = [1, 2, 2, 3];
|
| 19 |
+
* const result = uniqWith(array);
|
| 20 |
+
* // result will be [1, 2, 3]
|
| 21 |
+
*
|
| 22 |
+
* const array = [1, 2, 3];
|
| 23 |
+
* const result = uniqWith(array, (a, b) => a % 2 === b % 2)
|
| 24 |
+
* // result will be [1, 2]
|
| 25 |
+
*/
|
| 26 |
+
declare function uniqWith<T>(arr: ArrayLike<T> | null | undefined, comparator?: Comparator<T>): T[];
|
| 27 |
+
//#endregion
|
| 28 |
+
export { uniqWith };
|
node_modules/es-toolkit/dist/compat/array/uniqWith.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/uniqWith.d.ts
|
| 2 |
+
type Comparator<T> = (a: T, b: T) => boolean;
|
| 3 |
+
/**
|
| 4 |
+
* This method is like `uniq`, except that it accepts a `comparator` which is used to determine the equality of elements.
|
| 5 |
+
*
|
| 6 |
+
* It creates a duplicate-free version of an array, in which only the first occurrence of each element is kept.
|
| 7 |
+
* If a `comparator` is provided, it will be invoked with two arguments: `(arrVal, othVal)` to compare elements.
|
| 8 |
+
* If no comparator is provided, shallow equality is used.
|
| 9 |
+
*
|
| 10 |
+
* The order of result values is determined by the order they appear in the input array.
|
| 11 |
+
*
|
| 12 |
+
* @template T - The type of elements in the array.
|
| 13 |
+
* @param arr - The array to process.
|
| 14 |
+
* @param [comparator] - Optional function to compare elements for equality.
|
| 15 |
+
* @returns A new array with only unique values based on the comparator.
|
| 16 |
+
*
|
| 17 |
+
* @example
|
| 18 |
+
* const array = [1, 2, 2, 3];
|
| 19 |
+
* const result = uniqWith(array);
|
| 20 |
+
* // result will be [1, 2, 3]
|
| 21 |
+
*
|
| 22 |
+
* const array = [1, 2, 3];
|
| 23 |
+
* const result = uniqWith(array, (a, b) => a % 2 === b % 2)
|
| 24 |
+
* // result will be [1, 2]
|
| 25 |
+
*/
|
| 26 |
+
declare function uniqWith<T>(arr: ArrayLike<T> | null | undefined, comparator?: Comparator<T>): T[];
|
| 27 |
+
//#endregion
|
| 28 |
+
export { uniqWith };
|
node_modules/es-toolkit/dist/compat/array/uniqWith.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_uniqWith = require("../../array/uniqWith.js");
|
| 2 |
+
const require_isArrayLike = require("../predicate/isArrayLike.js");
|
| 3 |
+
const require_uniq = require("./uniq.js");
|
| 4 |
+
//#region src/compat/array/uniqWith.ts
|
| 5 |
+
/**
|
| 6 |
+
* This method is like `uniq`, except that it accepts a `comparator` which is used to determine the equality of elements.
|
| 7 |
+
*
|
| 8 |
+
* It creates a duplicate-free version of an array, in which only the first occurrence of each element is kept.
|
| 9 |
+
* If a `comparator` is provided, it will be invoked with two arguments: `(arrVal, othVal)` to compare elements.
|
| 10 |
+
* If no comparator is provided, shallow equality is used.
|
| 11 |
+
*
|
| 12 |
+
* The order of result values is determined by the order they appear in the input array.
|
| 13 |
+
*
|
| 14 |
+
* @template T - The type of elements in the array.
|
| 15 |
+
* @param arr - The array to process.
|
| 16 |
+
* @param [comparator] - Optional function to compare elements for equality.
|
| 17 |
+
* @returns A new array with only unique values based on the comparator.
|
| 18 |
+
*
|
| 19 |
+
* @example
|
| 20 |
+
* const array = [1, 2, 2, 3];
|
| 21 |
+
* const result = uniqWith(array);
|
| 22 |
+
* // result will be [1, 2, 3]
|
| 23 |
+
*
|
| 24 |
+
* const array = [1, 2, 3];
|
| 25 |
+
* const result = uniqWith(array, (a, b) => a % 2 === b % 2)
|
| 26 |
+
* // result will be [1, 2]
|
| 27 |
+
*/
|
| 28 |
+
function uniqWith(arr, comparator) {
|
| 29 |
+
if (!require_isArrayLike.isArrayLike(arr)) return [];
|
| 30 |
+
if (typeof comparator !== "function") return require_uniq.uniq(Array.from(arr));
|
| 31 |
+
return require_uniqWith.uniqWith(Array.from(arr), (kept, candidate) => comparator(candidate, kept));
|
| 32 |
+
}
|
| 33 |
+
//#endregion
|
| 34 |
+
exports.uniqWith = uniqWith;
|
node_modules/es-toolkit/dist/compat/array/uniqWith.mjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { uniqWith as uniqWith$1 } from "../../array/uniqWith.mjs";
|
| 2 |
+
import { isArrayLike } from "../predicate/isArrayLike.mjs";
|
| 3 |
+
import { uniq } from "./uniq.mjs";
|
| 4 |
+
//#region src/compat/array/uniqWith.ts
|
| 5 |
+
/**
|
| 6 |
+
* This method is like `uniq`, except that it accepts a `comparator` which is used to determine the equality of elements.
|
| 7 |
+
*
|
| 8 |
+
* It creates a duplicate-free version of an array, in which only the first occurrence of each element is kept.
|
| 9 |
+
* If a `comparator` is provided, it will be invoked with two arguments: `(arrVal, othVal)` to compare elements.
|
| 10 |
+
* If no comparator is provided, shallow equality is used.
|
| 11 |
+
*
|
| 12 |
+
* The order of result values is determined by the order they appear in the input array.
|
| 13 |
+
*
|
| 14 |
+
* @template T - The type of elements in the array.
|
| 15 |
+
* @param arr - The array to process.
|
| 16 |
+
* @param [comparator] - Optional function to compare elements for equality.
|
| 17 |
+
* @returns A new array with only unique values based on the comparator.
|
| 18 |
+
*
|
| 19 |
+
* @example
|
| 20 |
+
* const array = [1, 2, 2, 3];
|
| 21 |
+
* const result = uniqWith(array);
|
| 22 |
+
* // result will be [1, 2, 3]
|
| 23 |
+
*
|
| 24 |
+
* const array = [1, 2, 3];
|
| 25 |
+
* const result = uniqWith(array, (a, b) => a % 2 === b % 2)
|
| 26 |
+
* // result will be [1, 2]
|
| 27 |
+
*/
|
| 28 |
+
function uniqWith(arr, comparator) {
|
| 29 |
+
if (!isArrayLike(arr)) return [];
|
| 30 |
+
if (typeof comparator !== "function") return uniq(Array.from(arr));
|
| 31 |
+
return uniqWith$1(Array.from(arr), (kept, candidate) => comparator(candidate, kept));
|
| 32 |
+
}
|
| 33 |
+
//#endregion
|
| 34 |
+
export { uniqWith };
|
node_modules/es-toolkit/dist/compat/array/unzip.d.mts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/unzip.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Gathers elements in the same position in an internal array
|
| 4 |
+
* from a grouped array of elements and returns them as a new array.
|
| 5 |
+
*
|
| 6 |
+
* @template T - The type of elements in the nested array.
|
| 7 |
+
* @param array - The nested array to unzip.
|
| 8 |
+
* @returns A new array of unzipped elements.
|
| 9 |
+
*
|
| 10 |
+
* @example
|
| 11 |
+
* const zipped = [['a', true, 1],['b', false, 2]];
|
| 12 |
+
* const result = unzip(zipped);
|
| 13 |
+
* // result will be [['a', 'b'], [true, false], [1, 2]]
|
| 14 |
+
*/
|
| 15 |
+
declare function unzip<T>(array: T[][] | ArrayLike<ArrayLike<T>> | null | undefined): T[][];
|
| 16 |
+
//#endregion
|
| 17 |
+
export { unzip };
|
node_modules/es-toolkit/dist/compat/array/unzip.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/unzip.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Gathers elements in the same position in an internal array
|
| 4 |
+
* from a grouped array of elements and returns them as a new array.
|
| 5 |
+
*
|
| 6 |
+
* @template T - The type of elements in the nested array.
|
| 7 |
+
* @param array - The nested array to unzip.
|
| 8 |
+
* @returns A new array of unzipped elements.
|
| 9 |
+
*
|
| 10 |
+
* @example
|
| 11 |
+
* const zipped = [['a', true, 1],['b', false, 2]];
|
| 12 |
+
* const result = unzip(zipped);
|
| 13 |
+
* // result will be [['a', 'b'], [true, false], [1, 2]]
|
| 14 |
+
*/
|
| 15 |
+
declare function unzip<T>(array: T[][] | ArrayLike<ArrayLike<T>> | null | undefined): T[][];
|
| 16 |
+
//#endregion
|
| 17 |
+
export { unzip };
|
node_modules/es-toolkit/dist/compat/array/unzip.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_unzip = require("../../array/unzip.js");
|
| 2 |
+
const require_isArray = require("../predicate/isArray.js");
|
| 3 |
+
const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js");
|
| 4 |
+
//#region src/compat/array/unzip.ts
|
| 5 |
+
/**
|
| 6 |
+
* Gathers elements in the same position in an internal array
|
| 7 |
+
* from a grouped array of elements and returns them as a new array.
|
| 8 |
+
*
|
| 9 |
+
* @template T - The type of elements in the nested array.
|
| 10 |
+
* @param array - The nested array to unzip.
|
| 11 |
+
* @returns A new array of unzipped elements.
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* const zipped = [['a', true, 1],['b', false, 2]];
|
| 15 |
+
* const result = unzip(zipped);
|
| 16 |
+
* // result will be [['a', 'b'], [true, false], [1, 2]]
|
| 17 |
+
*/
|
| 18 |
+
function unzip(array) {
|
| 19 |
+
if (!require_isArrayLikeObject.isArrayLikeObject(array) || !array.length) return [];
|
| 20 |
+
array = require_isArray.isArray(array) ? array : Array.from(array);
|
| 21 |
+
array = array.filter((item) => require_isArrayLikeObject.isArrayLikeObject(item));
|
| 22 |
+
return require_unzip.unzip(array);
|
| 23 |
+
}
|
| 24 |
+
//#endregion
|
| 25 |
+
exports.unzip = unzip;
|
node_modules/es-toolkit/dist/compat/array/unzip.mjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { unzip as unzip$1 } from "../../array/unzip.mjs";
|
| 2 |
+
import { isArray } from "../predicate/isArray.mjs";
|
| 3 |
+
import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs";
|
| 4 |
+
//#region src/compat/array/unzip.ts
|
| 5 |
+
/**
|
| 6 |
+
* Gathers elements in the same position in an internal array
|
| 7 |
+
* from a grouped array of elements and returns them as a new array.
|
| 8 |
+
*
|
| 9 |
+
* @template T - The type of elements in the nested array.
|
| 10 |
+
* @param array - The nested array to unzip.
|
| 11 |
+
* @returns A new array of unzipped elements.
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* const zipped = [['a', true, 1],['b', false, 2]];
|
| 15 |
+
* const result = unzip(zipped);
|
| 16 |
+
* // result will be [['a', 'b'], [true, false], [1, 2]]
|
| 17 |
+
*/
|
| 18 |
+
function unzip(array) {
|
| 19 |
+
if (!isArrayLikeObject(array) || !array.length) return [];
|
| 20 |
+
array = isArray(array) ? array : Array.from(array);
|
| 21 |
+
array = array.filter((item) => isArrayLikeObject(item));
|
| 22 |
+
return unzip$1(array);
|
| 23 |
+
}
|
| 24 |
+
//#endregion
|
| 25 |
+
export { unzip };
|
node_modules/es-toolkit/dist/compat/array/unzipWith.d.mts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/unzipWith.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* This method is like `unzip` except that it accepts an iteratee to specify
|
| 4 |
+
* how regrouped values should be combined. The iteratee is invoked with the
|
| 5 |
+
* elements of each group: (...group).
|
| 6 |
+
*
|
| 7 |
+
* @template T, R
|
| 8 |
+
* @param array - The array of grouped elements to process.
|
| 9 |
+
* @param iteratee - The function to combine regrouped values.
|
| 10 |
+
* @returns Returns the new array of regrouped elements.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* unzipWith([[1, 10, 100], [2, 20, 200]], (a, b) => a + b);
|
| 14 |
+
* // => [3, 30, 300]
|
| 15 |
+
*/
|
| 16 |
+
declare function unzipWith<T, R>(array: ArrayLike<ArrayLike<T>> | null | undefined, iteratee: (...values: T[]) => R): R[];
|
| 17 |
+
/**
|
| 18 |
+
* This method is like `unzip` except that it accepts an iteratee to specify
|
| 19 |
+
* how regrouped values should be combined.
|
| 20 |
+
*
|
| 21 |
+
* @template T
|
| 22 |
+
* @param array - The array of grouped elements to process.
|
| 23 |
+
* @returns Returns the new array of regrouped elements.
|
| 24 |
+
*
|
| 25 |
+
* @example
|
| 26 |
+
* unzipWith([[1, 10, 100], [2, 20, 200]]);
|
| 27 |
+
* // => [[1, 2], [10, 20], [100, 200]]
|
| 28 |
+
*/
|
| 29 |
+
declare function unzipWith<T>(array: ArrayLike<ArrayLike<T>> | null | undefined): T[][];
|
| 30 |
+
//#endregion
|
| 31 |
+
export { unzipWith };
|
node_modules/es-toolkit/dist/compat/array/unzipWith.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/unzipWith.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* This method is like `unzip` except that it accepts an iteratee to specify
|
| 4 |
+
* how regrouped values should be combined. The iteratee is invoked with the
|
| 5 |
+
* elements of each group: (...group).
|
| 6 |
+
*
|
| 7 |
+
* @template T, R
|
| 8 |
+
* @param array - The array of grouped elements to process.
|
| 9 |
+
* @param iteratee - The function to combine regrouped values.
|
| 10 |
+
* @returns Returns the new array of regrouped elements.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* unzipWith([[1, 10, 100], [2, 20, 200]], (a, b) => a + b);
|
| 14 |
+
* // => [3, 30, 300]
|
| 15 |
+
*/
|
| 16 |
+
declare function unzipWith<T, R>(array: ArrayLike<ArrayLike<T>> | null | undefined, iteratee: (...values: T[]) => R): R[];
|
| 17 |
+
/**
|
| 18 |
+
* This method is like `unzip` except that it accepts an iteratee to specify
|
| 19 |
+
* how regrouped values should be combined.
|
| 20 |
+
*
|
| 21 |
+
* @template T
|
| 22 |
+
* @param array - The array of grouped elements to process.
|
| 23 |
+
* @returns Returns the new array of regrouped elements.
|
| 24 |
+
*
|
| 25 |
+
* @example
|
| 26 |
+
* unzipWith([[1, 10, 100], [2, 20, 200]]);
|
| 27 |
+
* // => [[1, 2], [10, 20], [100, 200]]
|
| 28 |
+
*/
|
| 29 |
+
declare function unzipWith<T>(array: ArrayLike<ArrayLike<T>> | null | undefined): T[][];
|
| 30 |
+
//#endregion
|
| 31 |
+
export { unzipWith };
|
node_modules/es-toolkit/dist/compat/array/unzipWith.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_unzip = require("../../array/unzip.js");
|
| 2 |
+
const require_isArray = require("../predicate/isArray.js");
|
| 3 |
+
const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js");
|
| 4 |
+
//#region src/compat/array/unzipWith.ts
|
| 5 |
+
/**
|
| 6 |
+
* Unzips an array of arrays, applying an `iteratee` function to regrouped elements.
|
| 7 |
+
*
|
| 8 |
+
* If the array is `null` or `undefined`, returns an empty array.
|
| 9 |
+
*
|
| 10 |
+
* @template T
|
| 11 |
+
* @param array - The nested array to unzip. This is an array of arrays,
|
| 12 |
+
* where each inner array contains elements to be unzipped.
|
| 13 |
+
* @param iteratee - A function to transform the unzipped elements.
|
| 14 |
+
* @returns A new array of unzipped and transformed elements.
|
| 15 |
+
*
|
| 16 |
+
* @example
|
| 17 |
+
* const nestedArray = [[1, 2], [3, 4], [5, 6]];
|
| 18 |
+
* const result = unzipWith(nestedArray, (a, b) => a + b);
|
| 19 |
+
* console.log(result); // [9, 12]
|
| 20 |
+
*/
|
| 21 |
+
function unzipWith(array, iteratee) {
|
| 22 |
+
if (!require_isArrayLikeObject.isArrayLikeObject(array) || !array.length) return [];
|
| 23 |
+
const unzipped = require_isArray.isArray(array) ? require_unzip.unzip(array) : require_unzip.unzip(Array.from(array, (value) => Array.from(value)));
|
| 24 |
+
if (!iteratee) return unzipped;
|
| 25 |
+
const result = new Array(unzipped.length);
|
| 26 |
+
for (let i = 0; i < unzipped.length; i++) {
|
| 27 |
+
const value = unzipped[i];
|
| 28 |
+
result[i] = iteratee(...value);
|
| 29 |
+
}
|
| 30 |
+
return result;
|
| 31 |
+
}
|
| 32 |
+
//#endregion
|
| 33 |
+
exports.unzipWith = unzipWith;
|
node_modules/es-toolkit/dist/compat/array/unzipWith.mjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { unzip } from "../../array/unzip.mjs";
|
| 2 |
+
import { isArray } from "../predicate/isArray.mjs";
|
| 3 |
+
import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs";
|
| 4 |
+
//#region src/compat/array/unzipWith.ts
|
| 5 |
+
/**
|
| 6 |
+
* Unzips an array of arrays, applying an `iteratee` function to regrouped elements.
|
| 7 |
+
*
|
| 8 |
+
* If the array is `null` or `undefined`, returns an empty array.
|
| 9 |
+
*
|
| 10 |
+
* @template T
|
| 11 |
+
* @param array - The nested array to unzip. This is an array of arrays,
|
| 12 |
+
* where each inner array contains elements to be unzipped.
|
| 13 |
+
* @param iteratee - A function to transform the unzipped elements.
|
| 14 |
+
* @returns A new array of unzipped and transformed elements.
|
| 15 |
+
*
|
| 16 |
+
* @example
|
| 17 |
+
* const nestedArray = [[1, 2], [3, 4], [5, 6]];
|
| 18 |
+
* const result = unzipWith(nestedArray, (a, b) => a + b);
|
| 19 |
+
* console.log(result); // [9, 12]
|
| 20 |
+
*/
|
| 21 |
+
function unzipWith(array, iteratee) {
|
| 22 |
+
if (!isArrayLikeObject(array) || !array.length) return [];
|
| 23 |
+
const unzipped = isArray(array) ? unzip(array) : unzip(Array.from(array, (value) => Array.from(value)));
|
| 24 |
+
if (!iteratee) return unzipped;
|
| 25 |
+
const result = new Array(unzipped.length);
|
| 26 |
+
for (let i = 0; i < unzipped.length; i++) {
|
| 27 |
+
const value = unzipped[i];
|
| 28 |
+
result[i] = iteratee(...value);
|
| 29 |
+
}
|
| 30 |
+
return result;
|
| 31 |
+
}
|
| 32 |
+
//#endregion
|
| 33 |
+
export { unzipWith };
|
node_modules/es-toolkit/dist/compat/array/without.d.mts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/without.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates an array that excludes all specified values.
|
| 4 |
+
*
|
| 5 |
+
* It correctly excludes `NaN`, as it compares values using [SameValueZero](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero).
|
| 6 |
+
*
|
| 7 |
+
* @template T The type of elements in the array.
|
| 8 |
+
* @param array - The array to filter.
|
| 9 |
+
* @param values - The values to exclude.
|
| 10 |
+
* @returns A new array without the specified values.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* // Removes the specified values from the array
|
| 14 |
+
* without([1, 2, 3, 4, 5], 2, 4);
|
| 15 |
+
* // Returns: [1, 3, 5]
|
| 16 |
+
*
|
| 17 |
+
* @example
|
| 18 |
+
* // Removes specified string values from the array
|
| 19 |
+
* without(['a', 'b', 'c', 'a'], 'a');
|
| 20 |
+
* // Returns: ['b', 'c']
|
| 21 |
+
*/
|
| 22 |
+
declare function without<T>(array: ArrayLike<T> | null | undefined, ...values: T[]): T[];
|
| 23 |
+
//#endregion
|
| 24 |
+
export { without };
|
node_modules/es-toolkit/dist/compat/array/without.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/without.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates an array that excludes all specified values.
|
| 4 |
+
*
|
| 5 |
+
* It correctly excludes `NaN`, as it compares values using [SameValueZero](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero).
|
| 6 |
+
*
|
| 7 |
+
* @template T The type of elements in the array.
|
| 8 |
+
* @param array - The array to filter.
|
| 9 |
+
* @param values - The values to exclude.
|
| 10 |
+
* @returns A new array without the specified values.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* // Removes the specified values from the array
|
| 14 |
+
* without([1, 2, 3, 4, 5], 2, 4);
|
| 15 |
+
* // Returns: [1, 3, 5]
|
| 16 |
+
*
|
| 17 |
+
* @example
|
| 18 |
+
* // Removes specified string values from the array
|
| 19 |
+
* without(['a', 'b', 'c', 'a'], 'a');
|
| 20 |
+
* // Returns: ['b', 'c']
|
| 21 |
+
*/
|
| 22 |
+
declare function without<T>(array: ArrayLike<T> | null | undefined, ...values: T[]): T[];
|
| 23 |
+
//#endregion
|
| 24 |
+
export { without };
|
node_modules/es-toolkit/dist/compat/array/without.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_without = require("../../array/without.js");
|
| 2 |
+
const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js");
|
| 3 |
+
//#region src/compat/array/without.ts
|
| 4 |
+
/**
|
| 5 |
+
* Creates an array that excludes all specified values.
|
| 6 |
+
*
|
| 7 |
+
* It correctly excludes `NaN`, as it compares values using [SameValueZero](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero).
|
| 8 |
+
*
|
| 9 |
+
* @template T The type of elements in the array.
|
| 10 |
+
* @param array - The array to filter.
|
| 11 |
+
* @param values - The values to exclude.
|
| 12 |
+
* @returns A new array without the specified values.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* // Removes the specified values from the array
|
| 16 |
+
* without([1, 2, 3, 4, 5], 2, 4);
|
| 17 |
+
* // Returns: [1, 3, 5]
|
| 18 |
+
*
|
| 19 |
+
* @example
|
| 20 |
+
* // Removes specified string values from the array
|
| 21 |
+
* without(['a', 'b', 'c', 'a'], 'a');
|
| 22 |
+
* // Returns: ['b', 'c']
|
| 23 |
+
*/
|
| 24 |
+
function without(array, ...values) {
|
| 25 |
+
if (!require_isArrayLikeObject.isArrayLikeObject(array)) return [];
|
| 26 |
+
return require_without.without(Array.from(array), ...values);
|
| 27 |
+
}
|
| 28 |
+
//#endregion
|
| 29 |
+
exports.without = without;
|
node_modules/es-toolkit/dist/compat/array/without.mjs
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { without as without$1 } from "../../array/without.mjs";
|
| 2 |
+
import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs";
|
| 3 |
+
//#region src/compat/array/without.ts
|
| 4 |
+
/**
|
| 5 |
+
* Creates an array that excludes all specified values.
|
| 6 |
+
*
|
| 7 |
+
* It correctly excludes `NaN`, as it compares values using [SameValueZero](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero).
|
| 8 |
+
*
|
| 9 |
+
* @template T The type of elements in the array.
|
| 10 |
+
* @param array - The array to filter.
|
| 11 |
+
* @param values - The values to exclude.
|
| 12 |
+
* @returns A new array without the specified values.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* // Removes the specified values from the array
|
| 16 |
+
* without([1, 2, 3, 4, 5], 2, 4);
|
| 17 |
+
* // Returns: [1, 3, 5]
|
| 18 |
+
*
|
| 19 |
+
* @example
|
| 20 |
+
* // Removes specified string values from the array
|
| 21 |
+
* without(['a', 'b', 'c', 'a'], 'a');
|
| 22 |
+
* // Returns: ['b', 'c']
|
| 23 |
+
*/
|
| 24 |
+
function without(array, ...values) {
|
| 25 |
+
if (!isArrayLikeObject(array)) return [];
|
| 26 |
+
return without$1(Array.from(array), ...values);
|
| 27 |
+
}
|
| 28 |
+
//#endregion
|
| 29 |
+
export { without };
|
node_modules/es-toolkit/dist/compat/array/xor.d.mts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/xor.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Computes the symmetric difference of the provided arrays, returning an array of elements
|
| 4 |
+
* that exist in only one of the arrays.
|
| 5 |
+
*
|
| 6 |
+
* @template T - The type of elements in the arrays.
|
| 7 |
+
* @param arrays - The arrays to compare.
|
| 8 |
+
* @returns An array containing the elements that are present in only one of the provided `arrays`.
|
| 9 |
+
*
|
| 10 |
+
* @example
|
| 11 |
+
* // Returns [1, 2, 5, 6]
|
| 12 |
+
* xor([1, 2, 3, 4], [3, 4, 5, 6]);
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* // Returns ['a', 'c']
|
| 16 |
+
* xor(['a', 'b'], ['b', 'c']);
|
| 17 |
+
*
|
| 18 |
+
* @example
|
| 19 |
+
* // Returns [1, 3, 5]
|
| 20 |
+
* xor([1, 2], [2, 3], [4, 5]);
|
| 21 |
+
*/
|
| 22 |
+
declare function xor<T>(...arrays: Array<ArrayLike<T> | null | undefined>): T[];
|
| 23 |
+
//#endregion
|
| 24 |
+
export { xor };
|
node_modules/es-toolkit/dist/compat/array/xor.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/xor.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Computes the symmetric difference of the provided arrays, returning an array of elements
|
| 4 |
+
* that exist in only one of the arrays.
|
| 5 |
+
*
|
| 6 |
+
* @template T - The type of elements in the arrays.
|
| 7 |
+
* @param arrays - The arrays to compare.
|
| 8 |
+
* @returns An array containing the elements that are present in only one of the provided `arrays`.
|
| 9 |
+
*
|
| 10 |
+
* @example
|
| 11 |
+
* // Returns [1, 2, 5, 6]
|
| 12 |
+
* xor([1, 2, 3, 4], [3, 4, 5, 6]);
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* // Returns ['a', 'c']
|
| 16 |
+
* xor(['a', 'b'], ['b', 'c']);
|
| 17 |
+
*
|
| 18 |
+
* @example
|
| 19 |
+
* // Returns [1, 3, 5]
|
| 20 |
+
* xor([1, 2], [2, 3], [4, 5]);
|
| 21 |
+
*/
|
| 22 |
+
declare function xor<T>(...arrays: Array<ArrayLike<T> | null | undefined>): T[];
|
| 23 |
+
//#endregion
|
| 24 |
+
export { xor };
|
node_modules/es-toolkit/dist/compat/array/xor.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js");
|
| 2 |
+
const require_toArray = require("../util/toArray.js");
|
| 3 |
+
//#region src/compat/array/xor.ts
|
| 4 |
+
/**
|
| 5 |
+
* Computes the symmetric difference of the provided arrays, returning an array of elements
|
| 6 |
+
* that exist in only one of the arrays.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the arrays.
|
| 9 |
+
* @param arrays - The arrays to compare.
|
| 10 |
+
* @returns An array containing the elements that are present in only one of the provided `arrays`.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* // Returns [1, 2, 5, 6]
|
| 14 |
+
* xor([1, 2, 3, 4], [3, 4, 5, 6]);
|
| 15 |
+
*
|
| 16 |
+
* @example
|
| 17 |
+
* // Returns ['a', 'c']
|
| 18 |
+
* xor(['a', 'b'], ['b', 'c']);
|
| 19 |
+
*
|
| 20 |
+
* @example
|
| 21 |
+
* // Returns [1, 3, 5]
|
| 22 |
+
* xor([1, 2], [2, 3], [4, 5]);
|
| 23 |
+
*/
|
| 24 |
+
function xor(...arrays) {
|
| 25 |
+
const itemCounts = /* @__PURE__ */ new Map();
|
| 26 |
+
for (let i = 0; i < arrays.length; i++) {
|
| 27 |
+
const array = arrays[i];
|
| 28 |
+
if (!require_isArrayLikeObject.isArrayLikeObject(array)) continue;
|
| 29 |
+
const itemSet = new Set(require_toArray.toArray(array));
|
| 30 |
+
for (const item of itemSet) if (!itemCounts.has(item)) itemCounts.set(item, 1);
|
| 31 |
+
else itemCounts.set(item, itemCounts.get(item) + 1);
|
| 32 |
+
}
|
| 33 |
+
const result = [];
|
| 34 |
+
for (const [item, count] of itemCounts) if (count === 1) result.push(item);
|
| 35 |
+
return result;
|
| 36 |
+
}
|
| 37 |
+
//#endregion
|
| 38 |
+
exports.xor = xor;
|
node_modules/es-toolkit/dist/compat/array/xor.mjs
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs";
|
| 2 |
+
import { toArray } from "../util/toArray.mjs";
|
| 3 |
+
//#region src/compat/array/xor.ts
|
| 4 |
+
/**
|
| 5 |
+
* Computes the symmetric difference of the provided arrays, returning an array of elements
|
| 6 |
+
* that exist in only one of the arrays.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the arrays.
|
| 9 |
+
* @param arrays - The arrays to compare.
|
| 10 |
+
* @returns An array containing the elements that are present in only one of the provided `arrays`.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* // Returns [1, 2, 5, 6]
|
| 14 |
+
* xor([1, 2, 3, 4], [3, 4, 5, 6]);
|
| 15 |
+
*
|
| 16 |
+
* @example
|
| 17 |
+
* // Returns ['a', 'c']
|
| 18 |
+
* xor(['a', 'b'], ['b', 'c']);
|
| 19 |
+
*
|
| 20 |
+
* @example
|
| 21 |
+
* // Returns [1, 3, 5]
|
| 22 |
+
* xor([1, 2], [2, 3], [4, 5]);
|
| 23 |
+
*/
|
| 24 |
+
function xor(...arrays) {
|
| 25 |
+
const itemCounts = /* @__PURE__ */ new Map();
|
| 26 |
+
for (let i = 0; i < arrays.length; i++) {
|
| 27 |
+
const array = arrays[i];
|
| 28 |
+
if (!isArrayLikeObject(array)) continue;
|
| 29 |
+
const itemSet = new Set(toArray(array));
|
| 30 |
+
for (const item of itemSet) if (!itemCounts.has(item)) itemCounts.set(item, 1);
|
| 31 |
+
else itemCounts.set(item, itemCounts.get(item) + 1);
|
| 32 |
+
}
|
| 33 |
+
const result = [];
|
| 34 |
+
for (const [item, count] of itemCounts) if (count === 1) result.push(item);
|
| 35 |
+
return result;
|
| 36 |
+
}
|
| 37 |
+
//#endregion
|
| 38 |
+
export { xor };
|
node_modules/es-toolkit/dist/compat/array/xorBy.d.mts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { ValueIteratee } from "../_internal/ValueIteratee.mjs";
|
| 2 |
+
|
| 3 |
+
//#region src/compat/array/xorBy.d.ts
|
| 4 |
+
/**
|
| 5 |
+
* This method is like `xor` except that it accepts `iteratee` which is
|
| 6 |
+
* invoked for each element of each `arrays` to generate the criterion by which
|
| 7 |
+
* uniqueness is computed. The iteratee is invoked with one argument: (value).
|
| 8 |
+
*
|
| 9 |
+
* @template T
|
| 10 |
+
* @param arrays - The arrays to inspect.
|
| 11 |
+
* @param [iteratee] - The iteratee invoked per element.
|
| 12 |
+
* @returns Returns the new array of values.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* xorBy([2.1, 1.2], [4.3, 2.4], Math.floor);
|
| 16 |
+
* // => [1.2, 4.3]
|
| 17 |
+
*
|
| 18 |
+
* @example
|
| 19 |
+
* xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
| 20 |
+
* // => [{ 'x': 2 }]
|
| 21 |
+
*/
|
| 22 |
+
declare function xorBy<T>(arrays: ArrayLike<T> | null | undefined, iteratee?: ValueIteratee<T>): T[];
|
| 23 |
+
/**
|
| 24 |
+
* This method is like `xor` except that it accepts `iteratee` which is
|
| 25 |
+
* invoked for each element of each `arrays` to generate the criterion by which
|
| 26 |
+
* uniqueness is computed. The iteratee is invoked with one argument: (value).
|
| 27 |
+
*
|
| 28 |
+
* @template T
|
| 29 |
+
* @param arrays - The first array to inspect.
|
| 30 |
+
* @param arrays2 - The second array to inspect.
|
| 31 |
+
* @param [iteratee] - The iteratee invoked per element.
|
| 32 |
+
* @returns Returns the new array of values.
|
| 33 |
+
*
|
| 34 |
+
* @example
|
| 35 |
+
* xorBy([2.1, 1.2], [4.3, 2.4], Math.floor);
|
| 36 |
+
* // => [1.2, 4.3]
|
| 37 |
+
*/
|
| 38 |
+
declare function xorBy<T>(arrays: ArrayLike<T> | null | undefined, arrays2: ArrayLike<T> | null | undefined, iteratee?: ValueIteratee<T>): T[];
|
| 39 |
+
/**
|
| 40 |
+
* This method is like `xor` except that it accepts `iteratee` which is
|
| 41 |
+
* invoked for each element of each `arrays` to generate the criterion by which
|
| 42 |
+
* uniqueness is computed. The iteratee is invoked with one argument: (value).
|
| 43 |
+
*
|
| 44 |
+
* @template T
|
| 45 |
+
* @param arrays - The first array to inspect.
|
| 46 |
+
* @param arrays2 - The second array to inspect.
|
| 47 |
+
* @param arrays3 - The third array to inspect.
|
| 48 |
+
* @param iteratee - The iteratee invoked per element.
|
| 49 |
+
* @returns Returns the new array of values.
|
| 50 |
+
*
|
| 51 |
+
* @example
|
| 52 |
+
* xorBy([1.2, 2.3], [3.4, 4.5], [5.6, 6.7], Math.floor);
|
| 53 |
+
* // => [1.2, 3.4, 5.6]
|
| 54 |
+
*/
|
| 55 |
+
declare function xorBy<T>(arrays: ArrayLike<T> | null | undefined, arrays2: ArrayLike<T> | null | undefined, arrays3: ArrayLike<T> | null | undefined, ...iteratee: Array<ValueIteratee<T> | ArrayLike<T> | null | undefined>): T[];
|
| 56 |
+
//#endregion
|
| 57 |
+
export { xorBy };
|
node_modules/es-toolkit/dist/compat/array/xorBy.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { ValueIteratee } from "../_internal/ValueIteratee.js";
|
| 2 |
+
|
| 3 |
+
//#region src/compat/array/xorBy.d.ts
|
| 4 |
+
/**
|
| 5 |
+
* This method is like `xor` except that it accepts `iteratee` which is
|
| 6 |
+
* invoked for each element of each `arrays` to generate the criterion by which
|
| 7 |
+
* uniqueness is computed. The iteratee is invoked with one argument: (value).
|
| 8 |
+
*
|
| 9 |
+
* @template T
|
| 10 |
+
* @param arrays - The arrays to inspect.
|
| 11 |
+
* @param [iteratee] - The iteratee invoked per element.
|
| 12 |
+
* @returns Returns the new array of values.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* xorBy([2.1, 1.2], [4.3, 2.4], Math.floor);
|
| 16 |
+
* // => [1.2, 4.3]
|
| 17 |
+
*
|
| 18 |
+
* @example
|
| 19 |
+
* xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
| 20 |
+
* // => [{ 'x': 2 }]
|
| 21 |
+
*/
|
| 22 |
+
declare function xorBy<T>(arrays: ArrayLike<T> | null | undefined, iteratee?: ValueIteratee<T>): T[];
|
| 23 |
+
/**
|
| 24 |
+
* This method is like `xor` except that it accepts `iteratee` which is
|
| 25 |
+
* invoked for each element of each `arrays` to generate the criterion by which
|
| 26 |
+
* uniqueness is computed. The iteratee is invoked with one argument: (value).
|
| 27 |
+
*
|
| 28 |
+
* @template T
|
| 29 |
+
* @param arrays - The first array to inspect.
|
| 30 |
+
* @param arrays2 - The second array to inspect.
|
| 31 |
+
* @param [iteratee] - The iteratee invoked per element.
|
| 32 |
+
* @returns Returns the new array of values.
|
| 33 |
+
*
|
| 34 |
+
* @example
|
| 35 |
+
* xorBy([2.1, 1.2], [4.3, 2.4], Math.floor);
|
| 36 |
+
* // => [1.2, 4.3]
|
| 37 |
+
*/
|
| 38 |
+
declare function xorBy<T>(arrays: ArrayLike<T> | null | undefined, arrays2: ArrayLike<T> | null | undefined, iteratee?: ValueIteratee<T>): T[];
|
| 39 |
+
/**
|
| 40 |
+
* This method is like `xor` except that it accepts `iteratee` which is
|
| 41 |
+
* invoked for each element of each `arrays` to generate the criterion by which
|
| 42 |
+
* uniqueness is computed. The iteratee is invoked with one argument: (value).
|
| 43 |
+
*
|
| 44 |
+
* @template T
|
| 45 |
+
* @param arrays - The first array to inspect.
|
| 46 |
+
* @param arrays2 - The second array to inspect.
|
| 47 |
+
* @param arrays3 - The third array to inspect.
|
| 48 |
+
* @param iteratee - The iteratee invoked per element.
|
| 49 |
+
* @returns Returns the new array of values.
|
| 50 |
+
*
|
| 51 |
+
* @example
|
| 52 |
+
* xorBy([1.2, 2.3], [3.4, 4.5], [5.6, 6.7], Math.floor);
|
| 53 |
+
* // => [1.2, 3.4, 5.6]
|
| 54 |
+
*/
|
| 55 |
+
declare function xorBy<T>(arrays: ArrayLike<T> | null | undefined, arrays2: ArrayLike<T> | null | undefined, arrays3: ArrayLike<T> | null | undefined, ...iteratee: Array<ValueIteratee<T> | ArrayLike<T> | null | undefined>): T[];
|
| 56 |
+
//#endregion
|
| 57 |
+
export { xorBy };
|
node_modules/es-toolkit/dist/compat/array/xorBy.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_windowed = require("../../array/windowed.js");
|
| 2 |
+
const require_identity = require("../../function/identity.js");
|
| 3 |
+
const require_iteratee = require("../util/iteratee.js");
|
| 4 |
+
const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js");
|
| 5 |
+
const require_last = require("./last.js");
|
| 6 |
+
const require_differenceBy = require("./differenceBy.js");
|
| 7 |
+
const require_intersectionBy = require("./intersectionBy.js");
|
| 8 |
+
const require_unionBy = require("./unionBy.js");
|
| 9 |
+
//#region src/compat/array/xorBy.ts
|
| 10 |
+
/**
|
| 11 |
+
* Computes the symmetric difference between two arrays using a custom mapping function.
|
| 12 |
+
* The symmetric difference is the set of elements which are in either of the arrays,
|
| 13 |
+
* but not in their intersection, determined by the result of the mapping function.
|
| 14 |
+
*
|
| 15 |
+
* @template T - Type of elements in the input arrays.
|
| 16 |
+
* @template U - Type of the values returned by the mapping function.
|
| 17 |
+
*
|
| 18 |
+
* @param values - The arrays to inspect, or the function to map array elements to comparison values.
|
| 19 |
+
* @returns An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the values returned by the mapping function.
|
| 20 |
+
*
|
| 21 |
+
* @example
|
| 22 |
+
* // Custom mapping function for objects with an 'id' property
|
| 23 |
+
* const idMapper = obj => obj.id;
|
| 24 |
+
* xorBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper);
|
| 25 |
+
* // Returns [{ id: 1 }, { id: 3 }]
|
| 26 |
+
*/
|
| 27 |
+
function xorBy(...values) {
|
| 28 |
+
const lastValue = require_last.last(values);
|
| 29 |
+
let mapper = require_identity.identity;
|
| 30 |
+
if (!require_isArrayLikeObject.isArrayLikeObject(lastValue) && lastValue != null) {
|
| 31 |
+
mapper = require_iteratee.iteratee(lastValue);
|
| 32 |
+
values = values.slice(0, -1);
|
| 33 |
+
}
|
| 34 |
+
const arrays = values.filter(require_isArrayLikeObject.isArrayLikeObject);
|
| 35 |
+
const union = require_unionBy.unionBy(...arrays, mapper);
|
| 36 |
+
const intersections = require_windowed.windowed(arrays, 2).map(([arr1, arr2]) => require_intersectionBy.intersectionBy(arr1, arr2, mapper));
|
| 37 |
+
return require_differenceBy.differenceBy(union, require_unionBy.unionBy(...intersections, mapper), mapper);
|
| 38 |
+
}
|
| 39 |
+
//#endregion
|
| 40 |
+
exports.xorBy = xorBy;
|
node_modules/es-toolkit/dist/compat/array/xorBy.mjs
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { windowed } from "../../array/windowed.mjs";
|
| 2 |
+
import { identity } from "../../function/identity.mjs";
|
| 3 |
+
import { iteratee } from "../util/iteratee.mjs";
|
| 4 |
+
import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs";
|
| 5 |
+
import { last } from "./last.mjs";
|
| 6 |
+
import { differenceBy } from "./differenceBy.mjs";
|
| 7 |
+
import { intersectionBy } from "./intersectionBy.mjs";
|
| 8 |
+
import { unionBy } from "./unionBy.mjs";
|
| 9 |
+
//#region src/compat/array/xorBy.ts
|
| 10 |
+
/**
|
| 11 |
+
* Computes the symmetric difference between two arrays using a custom mapping function.
|
| 12 |
+
* The symmetric difference is the set of elements which are in either of the arrays,
|
| 13 |
+
* but not in their intersection, determined by the result of the mapping function.
|
| 14 |
+
*
|
| 15 |
+
* @template T - Type of elements in the input arrays.
|
| 16 |
+
* @template U - Type of the values returned by the mapping function.
|
| 17 |
+
*
|
| 18 |
+
* @param values - The arrays to inspect, or the function to map array elements to comparison values.
|
| 19 |
+
* @returns An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the values returned by the mapping function.
|
| 20 |
+
*
|
| 21 |
+
* @example
|
| 22 |
+
* // Custom mapping function for objects with an 'id' property
|
| 23 |
+
* const idMapper = obj => obj.id;
|
| 24 |
+
* xorBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper);
|
| 25 |
+
* // Returns [{ id: 1 }, { id: 3 }]
|
| 26 |
+
*/
|
| 27 |
+
function xorBy(...values) {
|
| 28 |
+
const lastValue = last(values);
|
| 29 |
+
let mapper = identity;
|
| 30 |
+
if (!isArrayLikeObject(lastValue) && lastValue != null) {
|
| 31 |
+
mapper = iteratee(lastValue);
|
| 32 |
+
values = values.slice(0, -1);
|
| 33 |
+
}
|
| 34 |
+
const arrays = values.filter(isArrayLikeObject);
|
| 35 |
+
return differenceBy(unionBy(...arrays, mapper), unionBy(...windowed(arrays, 2).map(([arr1, arr2]) => intersectionBy(arr1, arr2, mapper)), mapper), mapper);
|
| 36 |
+
}
|
| 37 |
+
//#endregion
|
| 38 |
+
export { xorBy };
|
node_modules/es-toolkit/dist/compat/array/xorWith.d.mts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/xorWith.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* This method is like `xor` except that it accepts `comparator` which is
|
| 4 |
+
* invoked to compare elements of `arrays`. The comparator is invoked
|
| 5 |
+
* with two arguments: (arrVal, othVal).
|
| 6 |
+
*
|
| 7 |
+
* @template T
|
| 8 |
+
* @param arrays - The arrays to inspect.
|
| 9 |
+
* @param [comparator] - The comparator invoked per element.
|
| 10 |
+
* @returns Returns the new array of values.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
| 14 |
+
* const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
| 15 |
+
* xorWith(objects, others, isEqual);
|
| 16 |
+
* // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
|
| 17 |
+
*/
|
| 18 |
+
declare function xorWith<T>(arrays: ArrayLike<T> | null | undefined, comparator?: (a: T, b: T) => boolean): T[];
|
| 19 |
+
/**
|
| 20 |
+
* This method is like `xor` except that it accepts `comparator` which is
|
| 21 |
+
* invoked to compare elements of `arrays`. The comparator is invoked
|
| 22 |
+
* with two arguments: (arrVal, othVal).
|
| 23 |
+
*
|
| 24 |
+
* @template T
|
| 25 |
+
* @param arrays - The first array to inspect.
|
| 26 |
+
* @param arrays2 - The second array to inspect.
|
| 27 |
+
* @param [comparator] - The comparator invoked per element.
|
| 28 |
+
* @returns Returns the new array of values.
|
| 29 |
+
*
|
| 30 |
+
* @example
|
| 31 |
+
* xorWith([1, 2], [2, 3], (a, b) => a === b);
|
| 32 |
+
* // => [1, 3]
|
| 33 |
+
*/
|
| 34 |
+
declare function xorWith<T>(arrays: ArrayLike<T> | null | undefined, arrays2: ArrayLike<T> | null | undefined, comparator?: (a: T, b: T) => boolean): T[];
|
| 35 |
+
/**
|
| 36 |
+
* This method is like `xor` except that it accepts `comparator` which is
|
| 37 |
+
* invoked to compare elements of `arrays`. The comparator is invoked
|
| 38 |
+
* with two arguments: (arrVal, othVal).
|
| 39 |
+
*
|
| 40 |
+
* @template T
|
| 41 |
+
* @param arrays - The first array to inspect.
|
| 42 |
+
* @param arrays2 - The second array to inspect.
|
| 43 |
+
* @param arrays3 - The third array to inspect.
|
| 44 |
+
* @param comparator - The comparator invoked per element.
|
| 45 |
+
* @returns Returns the new array of values.
|
| 46 |
+
*
|
| 47 |
+
* @example
|
| 48 |
+
* xorWith([1], [2], [3], (a, b) => a === b);
|
| 49 |
+
* // => [1, 2, 3]
|
| 50 |
+
*/
|
| 51 |
+
declare function xorWith<T>(arrays: ArrayLike<T> | null | undefined, arrays2: ArrayLike<T> | null | undefined, arrays3: ArrayLike<T> | null | undefined, ...comparator: Array<((a: T, b: T) => boolean) | ArrayLike<T> | null | undefined>): T[];
|
| 52 |
+
//#endregion
|
| 53 |
+
export { xorWith };
|
node_modules/es-toolkit/dist/compat/array/xorWith.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/xorWith.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* This method is like `xor` except that it accepts `comparator` which is
|
| 4 |
+
* invoked to compare elements of `arrays`. The comparator is invoked
|
| 5 |
+
* with two arguments: (arrVal, othVal).
|
| 6 |
+
*
|
| 7 |
+
* @template T
|
| 8 |
+
* @param arrays - The arrays to inspect.
|
| 9 |
+
* @param [comparator] - The comparator invoked per element.
|
| 10 |
+
* @returns Returns the new array of values.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
| 14 |
+
* const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
| 15 |
+
* xorWith(objects, others, isEqual);
|
| 16 |
+
* // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
|
| 17 |
+
*/
|
| 18 |
+
declare function xorWith<T>(arrays: ArrayLike<T> | null | undefined, comparator?: (a: T, b: T) => boolean): T[];
|
| 19 |
+
/**
|
| 20 |
+
* This method is like `xor` except that it accepts `comparator` which is
|
| 21 |
+
* invoked to compare elements of `arrays`. The comparator is invoked
|
| 22 |
+
* with two arguments: (arrVal, othVal).
|
| 23 |
+
*
|
| 24 |
+
* @template T
|
| 25 |
+
* @param arrays - The first array to inspect.
|
| 26 |
+
* @param arrays2 - The second array to inspect.
|
| 27 |
+
* @param [comparator] - The comparator invoked per element.
|
| 28 |
+
* @returns Returns the new array of values.
|
| 29 |
+
*
|
| 30 |
+
* @example
|
| 31 |
+
* xorWith([1, 2], [2, 3], (a, b) => a === b);
|
| 32 |
+
* // => [1, 3]
|
| 33 |
+
*/
|
| 34 |
+
declare function xorWith<T>(arrays: ArrayLike<T> | null | undefined, arrays2: ArrayLike<T> | null | undefined, comparator?: (a: T, b: T) => boolean): T[];
|
| 35 |
+
/**
|
| 36 |
+
* This method is like `xor` except that it accepts `comparator` which is
|
| 37 |
+
* invoked to compare elements of `arrays`. The comparator is invoked
|
| 38 |
+
* with two arguments: (arrVal, othVal).
|
| 39 |
+
*
|
| 40 |
+
* @template T
|
| 41 |
+
* @param arrays - The first array to inspect.
|
| 42 |
+
* @param arrays2 - The second array to inspect.
|
| 43 |
+
* @param arrays3 - The third array to inspect.
|
| 44 |
+
* @param comparator - The comparator invoked per element.
|
| 45 |
+
* @returns Returns the new array of values.
|
| 46 |
+
*
|
| 47 |
+
* @example
|
| 48 |
+
* xorWith([1], [2], [3], (a, b) => a === b);
|
| 49 |
+
* // => [1, 2, 3]
|
| 50 |
+
*/
|
| 51 |
+
declare function xorWith<T>(arrays: ArrayLike<T> | null | undefined, arrays2: ArrayLike<T> | null | undefined, arrays3: ArrayLike<T> | null | undefined, ...comparator: Array<((a: T, b: T) => boolean) | ArrayLike<T> | null | undefined>): T[];
|
| 52 |
+
//#endregion
|
| 53 |
+
export { xorWith };
|
node_modules/es-toolkit/dist/compat/array/xorWith.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_windowed = require("../../array/windowed.js");
|
| 2 |
+
const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js");
|
| 3 |
+
const require_last = require("./last.js");
|
| 4 |
+
const require_differenceWith = require("./differenceWith.js");
|
| 5 |
+
const require_intersectionWith = require("./intersectionWith.js");
|
| 6 |
+
const require_unionWith = require("./unionWith.js");
|
| 7 |
+
//#region src/compat/array/xorWith.ts
|
| 8 |
+
/**
|
| 9 |
+
* Creates an array of unique values that is the symmetric difference of the given arrays using a custom comparator function.
|
| 10 |
+
*
|
| 11 |
+
* The symmetric difference is the set of elements which are in either of the arrays,
|
| 12 |
+
* but not in their intersection, determined by the comparator function.
|
| 13 |
+
*
|
| 14 |
+
* @template T - Type of elements in the input arrays.
|
| 15 |
+
*
|
| 16 |
+
* @param values - The arrays to inspect, or the comparator function.
|
| 17 |
+
* @returns An array containing the elements that are present in exactly one of the arrays
|
| 18 |
+
* as determined by the comparator.
|
| 19 |
+
*
|
| 20 |
+
* @example
|
| 21 |
+
* // Custom comparator function for objects with an 'id' property
|
| 22 |
+
* const idComparator = (a, b) => a.id === b.id;
|
| 23 |
+
* xorWith([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idComparator);
|
| 24 |
+
* // Returns [{ id: 1 }, { id: 3 }]
|
| 25 |
+
*/
|
| 26 |
+
function xorWith(...values) {
|
| 27 |
+
const lastValue = require_last.last(values);
|
| 28 |
+
let comparator = (a, b) => a === b;
|
| 29 |
+
if (typeof lastValue === "function") {
|
| 30 |
+
comparator = lastValue;
|
| 31 |
+
values = values.slice(0, -1);
|
| 32 |
+
}
|
| 33 |
+
const arrays = values.filter(require_isArrayLikeObject.isArrayLikeObject);
|
| 34 |
+
const union = require_unionWith.unionWith(...arrays, comparator);
|
| 35 |
+
const intersections = require_windowed.windowed(arrays, 2).map(([arr1, arr2]) => require_intersectionWith.intersectionWith(arr1, arr2, comparator));
|
| 36 |
+
return require_differenceWith.differenceWith(union, require_unionWith.unionWith(...intersections, comparator), comparator);
|
| 37 |
+
}
|
| 38 |
+
//#endregion
|
| 39 |
+
exports.xorWith = xorWith;
|
node_modules/es-toolkit/dist/compat/array/xorWith.mjs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { windowed } from "../../array/windowed.mjs";
|
| 2 |
+
import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs";
|
| 3 |
+
import { last } from "./last.mjs";
|
| 4 |
+
import { differenceWith } from "./differenceWith.mjs";
|
| 5 |
+
import { intersectionWith } from "./intersectionWith.mjs";
|
| 6 |
+
import { unionWith } from "./unionWith.mjs";
|
| 7 |
+
//#region src/compat/array/xorWith.ts
|
| 8 |
+
/**
|
| 9 |
+
* Creates an array of unique values that is the symmetric difference of the given arrays using a custom comparator function.
|
| 10 |
+
*
|
| 11 |
+
* The symmetric difference is the set of elements which are in either of the arrays,
|
| 12 |
+
* but not in their intersection, determined by the comparator function.
|
| 13 |
+
*
|
| 14 |
+
* @template T - Type of elements in the input arrays.
|
| 15 |
+
*
|
| 16 |
+
* @param values - The arrays to inspect, or the comparator function.
|
| 17 |
+
* @returns An array containing the elements that are present in exactly one of the arrays
|
| 18 |
+
* as determined by the comparator.
|
| 19 |
+
*
|
| 20 |
+
* @example
|
| 21 |
+
* // Custom comparator function for objects with an 'id' property
|
| 22 |
+
* const idComparator = (a, b) => a.id === b.id;
|
| 23 |
+
* xorWith([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idComparator);
|
| 24 |
+
* // Returns [{ id: 1 }, { id: 3 }]
|
| 25 |
+
*/
|
| 26 |
+
function xorWith(...values) {
|
| 27 |
+
const lastValue = last(values);
|
| 28 |
+
let comparator = (a, b) => a === b;
|
| 29 |
+
if (typeof lastValue === "function") {
|
| 30 |
+
comparator = lastValue;
|
| 31 |
+
values = values.slice(0, -1);
|
| 32 |
+
}
|
| 33 |
+
const arrays = values.filter(isArrayLikeObject);
|
| 34 |
+
return differenceWith(unionWith(...arrays, comparator), unionWith(...windowed(arrays, 2).map(([arr1, arr2]) => intersectionWith(arr1, arr2, comparator)), comparator), comparator);
|
| 35 |
+
}
|
| 36 |
+
//#endregion
|
| 37 |
+
export { xorWith };
|
node_modules/es-toolkit/dist/compat/array/zip.d.mts
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/zip.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Combines multiple arrays into a single array of tuples.
|
| 4 |
+
*
|
| 5 |
+
* This function takes multiple arrays and returns a new array where each element is a tuple
|
| 6 |
+
* containing the corresponding elements from the input arrays. If the input arrays are of
|
| 7 |
+
* different lengths, the resulting array will have the length of the longest input array,
|
| 8 |
+
* with undefined values for missing elements.
|
| 9 |
+
*
|
| 10 |
+
* @template T, U
|
| 11 |
+
* @param arr1 - The first array to zip.
|
| 12 |
+
* @param arr2 - The second array to zip.
|
| 13 |
+
* @returns A new array of tuples containing the corresponding elements from the input arrays.
|
| 14 |
+
*
|
| 15 |
+
* @example
|
| 16 |
+
* const arr1 = [1, 2, 3];
|
| 17 |
+
* const arr2 = ['a', 'b', 'c'];
|
| 18 |
+
* const result = zip(arr1, arr2);
|
| 19 |
+
* // result will be [[1, 'a'], [2, 'b'], [3, 'c']]
|
| 20 |
+
*/
|
| 21 |
+
/**
|
| 22 |
+
* Creates an array of grouped elements, the first of which contains the first elements of the given arrays,
|
| 23 |
+
* the second of which contains the second elements of the given arrays, and so on.
|
| 24 |
+
*
|
| 25 |
+
* @template T, U
|
| 26 |
+
* @param arr1 - The first array to zip.
|
| 27 |
+
* @param arr2 - The second array to zip.
|
| 28 |
+
* @returns Returns the new array of grouped elements.
|
| 29 |
+
*
|
| 30 |
+
* @example
|
| 31 |
+
* zip([1, 2], ['a', 'b']);
|
| 32 |
+
* // => [[1, 'a'], [2, 'b']]
|
| 33 |
+
*/
|
| 34 |
+
declare function zip<T, U>(arr1: ArrayLike<T>, arr2: ArrayLike<U>): Array<[T | undefined, U | undefined]>;
|
| 35 |
+
/**
|
| 36 |
+
* Combines multiple arrays into a single array of tuples.
|
| 37 |
+
*
|
| 38 |
+
* This function takes multiple arrays and returns a new array where each element is a tuple
|
| 39 |
+
* containing the corresponding elements from the input arrays. If the input arrays are of
|
| 40 |
+
* different lengths, the resulting array will have the length of the longest input array,
|
| 41 |
+
* with undefined values for missing elements.
|
| 42 |
+
*
|
| 43 |
+
* @template T, U, V
|
| 44 |
+
* @param arr1 - The first array to zip.
|
| 45 |
+
* @param arr2 - The second array to zip.
|
| 46 |
+
* @param arr3 - The third array to zip.
|
| 47 |
+
* @returns A new array of tuples containing the corresponding elements from the input arrays.
|
| 48 |
+
*
|
| 49 |
+
* @example
|
| 50 |
+
* const arr1 = [1, 2, 3];
|
| 51 |
+
* const arr2 = ['a', 'b', 'c'];
|
| 52 |
+
* const arr3 = [true, false];
|
| 53 |
+
* const result = zip(arr1, arr2, arr3);
|
| 54 |
+
* // result will be [[1, 'a', true], [2, 'b', false], [3, 'c', undefined]]
|
| 55 |
+
*/
|
| 56 |
+
/**
|
| 57 |
+
* Creates an array of grouped elements, the first of which contains the first elements of the given arrays,
|
| 58 |
+
* the second of which contains the second elements of the given arrays, and so on.
|
| 59 |
+
*
|
| 60 |
+
* @template T, U, V
|
| 61 |
+
* @param arr1 - The first array to zip.
|
| 62 |
+
* @param arr2 - The second array to zip.
|
| 63 |
+
* @param arr3 - The third array to zip.
|
| 64 |
+
* @returns Returns the new array of grouped elements.
|
| 65 |
+
*
|
| 66 |
+
* @example
|
| 67 |
+
* zip([1, 2], ['a', 'b'], [true, false]);
|
| 68 |
+
* // => [[1, 'a', true], [2, 'b', false]]
|
| 69 |
+
*/
|
| 70 |
+
declare function zip<T, U, V>(arr1: ArrayLike<T>, arr2: ArrayLike<U>, arr3: ArrayLike<V>): Array<[T | undefined, U | undefined, V | undefined]>;
|
| 71 |
+
/**
|
| 72 |
+
* Combines multiple arrays into a single array of tuples.
|
| 73 |
+
*
|
| 74 |
+
* This function takes multiple arrays and returns a new array where each element is a tuple
|
| 75 |
+
* containing the corresponding elements from the input arrays. If the input arrays are of
|
| 76 |
+
* different lengths, the resulting array will have the length of the longest input array,
|
| 77 |
+
* with undefined values for missing elements.
|
| 78 |
+
*
|
| 79 |
+
* @template T, U, V, W
|
| 80 |
+
* @param arr1 - The first array to zip.
|
| 81 |
+
* @param arr2 - The second array to zip.
|
| 82 |
+
* @param arr3 - The third array to zip.
|
| 83 |
+
* @param arr4 - The fourth array to zip.
|
| 84 |
+
* @returns A new array of tuples containing the corresponding elements from the input arrays.
|
| 85 |
+
*
|
| 86 |
+
* @example
|
| 87 |
+
* const arr1 = [1, 2, 3];
|
| 88 |
+
* const arr2 = ['a', 'b', 'c'];
|
| 89 |
+
* const arr3 = [true, false];
|
| 90 |
+
* const arr4 = [null, null, null];
|
| 91 |
+
* const result = zip(arr1, arr2, arr3, arr4);
|
| 92 |
+
* // result will be [[1, 'a', true, null], [2, 'b', false, null], [3, 'c', undefined, null]]
|
| 93 |
+
*/
|
| 94 |
+
/**
|
| 95 |
+
* Creates an array of grouped elements, the first of which contains the first elements of the given arrays,
|
| 96 |
+
* the second of which contains the second elements of the given arrays, and so on.
|
| 97 |
+
*
|
| 98 |
+
* @template T, U, V, W
|
| 99 |
+
* @param arr1 - The first array to zip.
|
| 100 |
+
* @param arr2 - The second array to zip.
|
| 101 |
+
* @param arr3 - The third array to zip.
|
| 102 |
+
* @param arr4 - The fourth array to zip.
|
| 103 |
+
* @returns Returns the new array of grouped elements.
|
| 104 |
+
*
|
| 105 |
+
* @example
|
| 106 |
+
* zip([1], ['a'], [true], [null]);
|
| 107 |
+
* // => [[1, 'a', true, null]]
|
| 108 |
+
*/
|
| 109 |
+
declare function zip<T, U, V, W>(arr1: ArrayLike<T>, arr2: ArrayLike<U>, arr3: ArrayLike<V>, arr4: ArrayLike<W>): Array<[T | undefined, U | undefined, V | undefined, W | undefined]>;
|
| 110 |
+
/**
|
| 111 |
+
* Combines multiple arrays into a single array of tuples.
|
| 112 |
+
*
|
| 113 |
+
* This function takes multiple arrays and returns a new array where each element is a tuple
|
| 114 |
+
* containing the corresponding elements from the input arrays. If the input arrays are of
|
| 115 |
+
* different lengths, the resulting array will have the length of the longest input array,
|
| 116 |
+
* with undefined values for missing elements.
|
| 117 |
+
*
|
| 118 |
+
* @template T, U, V, W
|
| 119 |
+
* @param arr1 - The first array to zip.
|
| 120 |
+
* @param arr2 - The second array to zip.
|
| 121 |
+
* @param arr3 - The third array to zip.
|
| 122 |
+
* @param arr4 - The fourth array to zip.
|
| 123 |
+
* @param arr5 - The fifth array to zip.
|
| 124 |
+
* @returns A new array of tuples containing the corresponding elements from the input arrays.
|
| 125 |
+
*
|
| 126 |
+
* @example
|
| 127 |
+
* const arr1 = [1, 2, 3];
|
| 128 |
+
* const arr2 = ['a', 'b', 'c'];
|
| 129 |
+
* const arr3 = [true, false];
|
| 130 |
+
* const arr4 = [null, null, null];
|
| 131 |
+
* const arr5 = [undefined, undefined, undefined];
|
| 132 |
+
* const result = zip(arr1, arr2, arr3, arr4, arr5);
|
| 133 |
+
* // result will be [[1, 'a', true, null, undefined], [2, 'b', false, null, undefined], [3, 'c', undefined, null, undefined]]
|
| 134 |
+
*/
|
| 135 |
+
/**
|
| 136 |
+
* Creates an array of grouped elements, the first of which contains the first elements of the given arrays,
|
| 137 |
+
* the second of which contains the second elements of the given arrays, and so on.
|
| 138 |
+
*
|
| 139 |
+
* @template T, U, V, W, X
|
| 140 |
+
* @param arr1 - The first array to zip.
|
| 141 |
+
* @param arr2 - The second array to zip.
|
| 142 |
+
* @param arr3 - The third array to zip.
|
| 143 |
+
* @param arr4 - The fourth array to zip.
|
| 144 |
+
* @param arr5 - The fifth array to zip.
|
| 145 |
+
* @returns Returns the new array of grouped elements.
|
| 146 |
+
*
|
| 147 |
+
* @example
|
| 148 |
+
* zip([1], ['a'], [true], [null], [undefined]);
|
| 149 |
+
* // => [[1, 'a', true, null, undefined]]
|
| 150 |
+
*/
|
| 151 |
+
declare function zip<T, U, V, W, X>(arr1: ArrayLike<T>, arr2: ArrayLike<U>, arr3: ArrayLike<V>, arr4: ArrayLike<W>, arr5: ArrayLike<X>): Array<[T | undefined, U | undefined, V | undefined, W | undefined, X | undefined]>;
|
| 152 |
+
/**
|
| 153 |
+
* Combines multiple arrays into a single array of tuples.
|
| 154 |
+
*
|
| 155 |
+
* This function takes multiple arrays and returns a new array where each element is a tuple
|
| 156 |
+
* containing the corresponding elements from the input arrays. If the input arrays are of
|
| 157 |
+
* different lengths, the resulting array will have the length of the longest input array,
|
| 158 |
+
* with undefined values for missing elements.
|
| 159 |
+
*
|
| 160 |
+
* @template T
|
| 161 |
+
* @param arrays - The arrays to zip.
|
| 162 |
+
* @returns A new array of tuples containing the corresponding elements from the input arrays.
|
| 163 |
+
*
|
| 164 |
+
* @example
|
| 165 |
+
* const arr1 = [1, 2, 3];
|
| 166 |
+
* const arr2 = ['a', 'b', 'c'];
|
| 167 |
+
* const arr3 = [true, false];
|
| 168 |
+
* const arr4 = [null, null, null];
|
| 169 |
+
* const arr5 = [undefined, undefined, undefined];
|
| 170 |
+
* const result = zip(arr1, arr2, arr3, arr4, arr5);
|
| 171 |
+
* // result will be [[1, 'a', true, null, undefined], [2, 'b', false, null, undefined], [3, 'c', undefined, null, undefined]]
|
| 172 |
+
*/
|
| 173 |
+
/**
|
| 174 |
+
* Creates an array of grouped elements, the first of which contains the first elements of the given arrays,
|
| 175 |
+
* the second of which contains the second elements of the given arrays, and so on.
|
| 176 |
+
*
|
| 177 |
+
* @template T
|
| 178 |
+
* @param arrays - The arrays to process.
|
| 179 |
+
* @returns Returns the new array of grouped elements.
|
| 180 |
+
*
|
| 181 |
+
* @example
|
| 182 |
+
* zip([1, 2], ['a', 'b'], [true, false]);
|
| 183 |
+
* // => [[1, 'a', true], [2, 'b', false]]
|
| 184 |
+
*/
|
| 185 |
+
declare function zip<T>(...arrays: Array<ArrayLike<T> | null | undefined>): Array<Array<T | undefined>>;
|
| 186 |
+
//#endregion
|
| 187 |
+
export { zip };
|
node_modules/es-toolkit/dist/compat/array/zip.d.ts
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/zip.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Combines multiple arrays into a single array of tuples.
|
| 4 |
+
*
|
| 5 |
+
* This function takes multiple arrays and returns a new array where each element is a tuple
|
| 6 |
+
* containing the corresponding elements from the input arrays. If the input arrays are of
|
| 7 |
+
* different lengths, the resulting array will have the length of the longest input array,
|
| 8 |
+
* with undefined values for missing elements.
|
| 9 |
+
*
|
| 10 |
+
* @template T, U
|
| 11 |
+
* @param arr1 - The first array to zip.
|
| 12 |
+
* @param arr2 - The second array to zip.
|
| 13 |
+
* @returns A new array of tuples containing the corresponding elements from the input arrays.
|
| 14 |
+
*
|
| 15 |
+
* @example
|
| 16 |
+
* const arr1 = [1, 2, 3];
|
| 17 |
+
* const arr2 = ['a', 'b', 'c'];
|
| 18 |
+
* const result = zip(arr1, arr2);
|
| 19 |
+
* // result will be [[1, 'a'], [2, 'b'], [3, 'c']]
|
| 20 |
+
*/
|
| 21 |
+
/**
|
| 22 |
+
* Creates an array of grouped elements, the first of which contains the first elements of the given arrays,
|
| 23 |
+
* the second of which contains the second elements of the given arrays, and so on.
|
| 24 |
+
*
|
| 25 |
+
* @template T, U
|
| 26 |
+
* @param arr1 - The first array to zip.
|
| 27 |
+
* @param arr2 - The second array to zip.
|
| 28 |
+
* @returns Returns the new array of grouped elements.
|
| 29 |
+
*
|
| 30 |
+
* @example
|
| 31 |
+
* zip([1, 2], ['a', 'b']);
|
| 32 |
+
* // => [[1, 'a'], [2, 'b']]
|
| 33 |
+
*/
|
| 34 |
+
declare function zip<T, U>(arr1: ArrayLike<T>, arr2: ArrayLike<U>): Array<[T | undefined, U | undefined]>;
|
| 35 |
+
/**
|
| 36 |
+
* Combines multiple arrays into a single array of tuples.
|
| 37 |
+
*
|
| 38 |
+
* This function takes multiple arrays and returns a new array where each element is a tuple
|
| 39 |
+
* containing the corresponding elements from the input arrays. If the input arrays are of
|
| 40 |
+
* different lengths, the resulting array will have the length of the longest input array,
|
| 41 |
+
* with undefined values for missing elements.
|
| 42 |
+
*
|
| 43 |
+
* @template T, U, V
|
| 44 |
+
* @param arr1 - The first array to zip.
|
| 45 |
+
* @param arr2 - The second array to zip.
|
| 46 |
+
* @param arr3 - The third array to zip.
|
| 47 |
+
* @returns A new array of tuples containing the corresponding elements from the input arrays.
|
| 48 |
+
*
|
| 49 |
+
* @example
|
| 50 |
+
* const arr1 = [1, 2, 3];
|
| 51 |
+
* const arr2 = ['a', 'b', 'c'];
|
| 52 |
+
* const arr3 = [true, false];
|
| 53 |
+
* const result = zip(arr1, arr2, arr3);
|
| 54 |
+
* // result will be [[1, 'a', true], [2, 'b', false], [3, 'c', undefined]]
|
| 55 |
+
*/
|
| 56 |
+
/**
|
| 57 |
+
* Creates an array of grouped elements, the first of which contains the first elements of the given arrays,
|
| 58 |
+
* the second of which contains the second elements of the given arrays, and so on.
|
| 59 |
+
*
|
| 60 |
+
* @template T, U, V
|
| 61 |
+
* @param arr1 - The first array to zip.
|
| 62 |
+
* @param arr2 - The second array to zip.
|
| 63 |
+
* @param arr3 - The third array to zip.
|
| 64 |
+
* @returns Returns the new array of grouped elements.
|
| 65 |
+
*
|
| 66 |
+
* @example
|
| 67 |
+
* zip([1, 2], ['a', 'b'], [true, false]);
|
| 68 |
+
* // => [[1, 'a', true], [2, 'b', false]]
|
| 69 |
+
*/
|
| 70 |
+
declare function zip<T, U, V>(arr1: ArrayLike<T>, arr2: ArrayLike<U>, arr3: ArrayLike<V>): Array<[T | undefined, U | undefined, V | undefined]>;
|
| 71 |
+
/**
|
| 72 |
+
* Combines multiple arrays into a single array of tuples.
|
| 73 |
+
*
|
| 74 |
+
* This function takes multiple arrays and returns a new array where each element is a tuple
|
| 75 |
+
* containing the corresponding elements from the input arrays. If the input arrays are of
|
| 76 |
+
* different lengths, the resulting array will have the length of the longest input array,
|
| 77 |
+
* with undefined values for missing elements.
|
| 78 |
+
*
|
| 79 |
+
* @template T, U, V, W
|
| 80 |
+
* @param arr1 - The first array to zip.
|
| 81 |
+
* @param arr2 - The second array to zip.
|
| 82 |
+
* @param arr3 - The third array to zip.
|
| 83 |
+
* @param arr4 - The fourth array to zip.
|
| 84 |
+
* @returns A new array of tuples containing the corresponding elements from the input arrays.
|
| 85 |
+
*
|
| 86 |
+
* @example
|
| 87 |
+
* const arr1 = [1, 2, 3];
|
| 88 |
+
* const arr2 = ['a', 'b', 'c'];
|
| 89 |
+
* const arr3 = [true, false];
|
| 90 |
+
* const arr4 = [null, null, null];
|
| 91 |
+
* const result = zip(arr1, arr2, arr3, arr4);
|
| 92 |
+
* // result will be [[1, 'a', true, null], [2, 'b', false, null], [3, 'c', undefined, null]]
|
| 93 |
+
*/
|
| 94 |
+
/**
|
| 95 |
+
* Creates an array of grouped elements, the first of which contains the first elements of the given arrays,
|
| 96 |
+
* the second of which contains the second elements of the given arrays, and so on.
|
| 97 |
+
*
|
| 98 |
+
* @template T, U, V, W
|
| 99 |
+
* @param arr1 - The first array to zip.
|
| 100 |
+
* @param arr2 - The second array to zip.
|
| 101 |
+
* @param arr3 - The third array to zip.
|
| 102 |
+
* @param arr4 - The fourth array to zip.
|
| 103 |
+
* @returns Returns the new array of grouped elements.
|
| 104 |
+
*
|
| 105 |
+
* @example
|
| 106 |
+
* zip([1], ['a'], [true], [null]);
|
| 107 |
+
* // => [[1, 'a', true, null]]
|
| 108 |
+
*/
|
| 109 |
+
declare function zip<T, U, V, W>(arr1: ArrayLike<T>, arr2: ArrayLike<U>, arr3: ArrayLike<V>, arr4: ArrayLike<W>): Array<[T | undefined, U | undefined, V | undefined, W | undefined]>;
|
| 110 |
+
/**
|
| 111 |
+
* Combines multiple arrays into a single array of tuples.
|
| 112 |
+
*
|
| 113 |
+
* This function takes multiple arrays and returns a new array where each element is a tuple
|
| 114 |
+
* containing the corresponding elements from the input arrays. If the input arrays are of
|
| 115 |
+
* different lengths, the resulting array will have the length of the longest input array,
|
| 116 |
+
* with undefined values for missing elements.
|
| 117 |
+
*
|
| 118 |
+
* @template T, U, V, W
|
| 119 |
+
* @param arr1 - The first array to zip.
|
| 120 |
+
* @param arr2 - The second array to zip.
|
| 121 |
+
* @param arr3 - The third array to zip.
|
| 122 |
+
* @param arr4 - The fourth array to zip.
|
| 123 |
+
* @param arr5 - The fifth array to zip.
|
| 124 |
+
* @returns A new array of tuples containing the corresponding elements from the input arrays.
|
| 125 |
+
*
|
| 126 |
+
* @example
|
| 127 |
+
* const arr1 = [1, 2, 3];
|
| 128 |
+
* const arr2 = ['a', 'b', 'c'];
|
| 129 |
+
* const arr3 = [true, false];
|
| 130 |
+
* const arr4 = [null, null, null];
|
| 131 |
+
* const arr5 = [undefined, undefined, undefined];
|
| 132 |
+
* const result = zip(arr1, arr2, arr3, arr4, arr5);
|
| 133 |
+
* // result will be [[1, 'a', true, null, undefined], [2, 'b', false, null, undefined], [3, 'c', undefined, null, undefined]]
|
| 134 |
+
*/
|
| 135 |
+
/**
|
| 136 |
+
* Creates an array of grouped elements, the first of which contains the first elements of the given arrays,
|
| 137 |
+
* the second of which contains the second elements of the given arrays, and so on.
|
| 138 |
+
*
|
| 139 |
+
* @template T, U, V, W, X
|
| 140 |
+
* @param arr1 - The first array to zip.
|
| 141 |
+
* @param arr2 - The second array to zip.
|
| 142 |
+
* @param arr3 - The third array to zip.
|
| 143 |
+
* @param arr4 - The fourth array to zip.
|
| 144 |
+
* @param arr5 - The fifth array to zip.
|
| 145 |
+
* @returns Returns the new array of grouped elements.
|
| 146 |
+
*
|
| 147 |
+
* @example
|
| 148 |
+
* zip([1], ['a'], [true], [null], [undefined]);
|
| 149 |
+
* // => [[1, 'a', true, null, undefined]]
|
| 150 |
+
*/
|
| 151 |
+
declare function zip<T, U, V, W, X>(arr1: ArrayLike<T>, arr2: ArrayLike<U>, arr3: ArrayLike<V>, arr4: ArrayLike<W>, arr5: ArrayLike<X>): Array<[T | undefined, U | undefined, V | undefined, W | undefined, X | undefined]>;
|
| 152 |
+
/**
|
| 153 |
+
* Combines multiple arrays into a single array of tuples.
|
| 154 |
+
*
|
| 155 |
+
* This function takes multiple arrays and returns a new array where each element is a tuple
|
| 156 |
+
* containing the corresponding elements from the input arrays. If the input arrays are of
|
| 157 |
+
* different lengths, the resulting array will have the length of the longest input array,
|
| 158 |
+
* with undefined values for missing elements.
|
| 159 |
+
*
|
| 160 |
+
* @template T
|
| 161 |
+
* @param arrays - The arrays to zip.
|
| 162 |
+
* @returns A new array of tuples containing the corresponding elements from the input arrays.
|
| 163 |
+
*
|
| 164 |
+
* @example
|
| 165 |
+
* const arr1 = [1, 2, 3];
|
| 166 |
+
* const arr2 = ['a', 'b', 'c'];
|
| 167 |
+
* const arr3 = [true, false];
|
| 168 |
+
* const arr4 = [null, null, null];
|
| 169 |
+
* const arr5 = [undefined, undefined, undefined];
|
| 170 |
+
* const result = zip(arr1, arr2, arr3, arr4, arr5);
|
| 171 |
+
* // result will be [[1, 'a', true, null, undefined], [2, 'b', false, null, undefined], [3, 'c', undefined, null, undefined]]
|
| 172 |
+
*/
|
| 173 |
+
/**
|
| 174 |
+
* Creates an array of grouped elements, the first of which contains the first elements of the given arrays,
|
| 175 |
+
* the second of which contains the second elements of the given arrays, and so on.
|
| 176 |
+
*
|
| 177 |
+
* @template T
|
| 178 |
+
* @param arrays - The arrays to process.
|
| 179 |
+
* @returns Returns the new array of grouped elements.
|
| 180 |
+
*
|
| 181 |
+
* @example
|
| 182 |
+
* zip([1, 2], ['a', 'b'], [true, false]);
|
| 183 |
+
* // => [[1, 'a', true], [2, 'b', false]]
|
| 184 |
+
*/
|
| 185 |
+
declare function zip<T>(...arrays: Array<ArrayLike<T> | null | undefined>): Array<Array<T | undefined>>;
|
| 186 |
+
//#endregion
|
| 187 |
+
export { zip };
|
node_modules/es-toolkit/dist/compat/array/zip.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_zip = require("../../array/zip.js");
|
| 2 |
+
const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js");
|
| 3 |
+
//#region src/compat/array/zip.ts
|
| 4 |
+
/**
|
| 5 |
+
* Combines multiple arrays into a single array of tuples.
|
| 6 |
+
*
|
| 7 |
+
* This function takes multiple arrays and returns a new array where each element is a tuple
|
| 8 |
+
* containing the corresponding elements from the input arrays. If the input arrays are of
|
| 9 |
+
* different lengths, the resulting array will have the length of the longest input array,
|
| 10 |
+
* with undefined values for missing elements.
|
| 11 |
+
*
|
| 12 |
+
* @template T
|
| 13 |
+
* @param arrays - The arrays to zip.
|
| 14 |
+
* @returns A new array of tuples containing the corresponding elements from the input arrays.
|
| 15 |
+
*
|
| 16 |
+
* @example
|
| 17 |
+
* const arr1 = [1, 2, 3];
|
| 18 |
+
* const arr2 = ['a', 'b', 'c'];
|
| 19 |
+
* const arr3 = [true, false];
|
| 20 |
+
* const arr4 = [null, null, null];
|
| 21 |
+
* const arr5 = [undefined, undefined, undefined];
|
| 22 |
+
* const result = zip(arr1, arr2, arr3, arr4, arr5);
|
| 23 |
+
* // result will be [[1, 'a', true, null, undefined], [2, 'b', false, null, undefined], [3, 'c', undefined, null, undefined]]
|
| 24 |
+
*/
|
| 25 |
+
function zip(...arrays) {
|
| 26 |
+
if (!arrays.length) return [];
|
| 27 |
+
return require_zip.zip(...arrays.filter((group) => require_isArrayLikeObject.isArrayLikeObject(group)));
|
| 28 |
+
}
|
| 29 |
+
//#endregion
|
| 30 |
+
exports.zip = zip;
|
node_modules/es-toolkit/dist/compat/array/zip.mjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { zip as zip$1 } from "../../array/zip.mjs";
|
| 2 |
+
import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs";
|
| 3 |
+
//#region src/compat/array/zip.ts
|
| 4 |
+
/**
|
| 5 |
+
* Combines multiple arrays into a single array of tuples.
|
| 6 |
+
*
|
| 7 |
+
* This function takes multiple arrays and returns a new array where each element is a tuple
|
| 8 |
+
* containing the corresponding elements from the input arrays. If the input arrays are of
|
| 9 |
+
* different lengths, the resulting array will have the length of the longest input array,
|
| 10 |
+
* with undefined values for missing elements.
|
| 11 |
+
*
|
| 12 |
+
* @template T
|
| 13 |
+
* @param arrays - The arrays to zip.
|
| 14 |
+
* @returns A new array of tuples containing the corresponding elements from the input arrays.
|
| 15 |
+
*
|
| 16 |
+
* @example
|
| 17 |
+
* const arr1 = [1, 2, 3];
|
| 18 |
+
* const arr2 = ['a', 'b', 'c'];
|
| 19 |
+
* const arr3 = [true, false];
|
| 20 |
+
* const arr4 = [null, null, null];
|
| 21 |
+
* const arr5 = [undefined, undefined, undefined];
|
| 22 |
+
* const result = zip(arr1, arr2, arr3, arr4, arr5);
|
| 23 |
+
* // result will be [[1, 'a', true, null, undefined], [2, 'b', false, null, undefined], [3, 'c', undefined, null, undefined]]
|
| 24 |
+
*/
|
| 25 |
+
function zip(...arrays) {
|
| 26 |
+
if (!arrays.length) return [];
|
| 27 |
+
return zip$1(...arrays.filter((group) => isArrayLikeObject(group)));
|
| 28 |
+
}
|
| 29 |
+
//#endregion
|
| 30 |
+
export { zip };
|
node_modules/es-toolkit/dist/compat/array/zipObject.d.mts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/zipObject.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Combines two arrays, one of property names and one of corresponding values, into a single object.
|
| 4 |
+
*
|
| 5 |
+
* @template T - The type of values in the values array
|
| 6 |
+
* @param props - An array of property names
|
| 7 |
+
* @param values - An array of values corresponding to the property names
|
| 8 |
+
* @returns A new object composed of the given property names and values
|
| 9 |
+
*
|
| 10 |
+
* @example
|
| 11 |
+
* const props = ['a', 'b', 'c'];
|
| 12 |
+
* const values = [1, 2, 3];
|
| 13 |
+
* zipObject(props, values);
|
| 14 |
+
* // => { a: 1, b: 2, c: 3 }
|
| 15 |
+
*/
|
| 16 |
+
declare function zipObject<T>(props: ArrayLike<PropertyKey>, values: ArrayLike<T>): Record<string, T>;
|
| 17 |
+
/**
|
| 18 |
+
* Creates an object from an array of property names, with undefined values.
|
| 19 |
+
*
|
| 20 |
+
* @param [props] - An array of property names
|
| 21 |
+
* @returns A new object with the given property names and undefined values
|
| 22 |
+
*
|
| 23 |
+
* @example
|
| 24 |
+
* const props = ['a', 'b', 'c'];
|
| 25 |
+
* zipObject(props);
|
| 26 |
+
* // => { a: undefined, b: undefined, c: undefined }
|
| 27 |
+
*/
|
| 28 |
+
declare function zipObject(props?: ArrayLike<PropertyKey>): Record<string, undefined>;
|
| 29 |
+
//#endregion
|
| 30 |
+
export { zipObject };
|
node_modules/es-toolkit/dist/compat/array/zipObject.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/zipObject.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Combines two arrays, one of property names and one of corresponding values, into a single object.
|
| 4 |
+
*
|
| 5 |
+
* @template T - The type of values in the values array
|
| 6 |
+
* @param props - An array of property names
|
| 7 |
+
* @param values - An array of values corresponding to the property names
|
| 8 |
+
* @returns A new object composed of the given property names and values
|
| 9 |
+
*
|
| 10 |
+
* @example
|
| 11 |
+
* const props = ['a', 'b', 'c'];
|
| 12 |
+
* const values = [1, 2, 3];
|
| 13 |
+
* zipObject(props, values);
|
| 14 |
+
* // => { a: 1, b: 2, c: 3 }
|
| 15 |
+
*/
|
| 16 |
+
declare function zipObject<T>(props: ArrayLike<PropertyKey>, values: ArrayLike<T>): Record<string, T>;
|
| 17 |
+
/**
|
| 18 |
+
* Creates an object from an array of property names, with undefined values.
|
| 19 |
+
*
|
| 20 |
+
* @param [props] - An array of property names
|
| 21 |
+
* @returns A new object with the given property names and undefined values
|
| 22 |
+
*
|
| 23 |
+
* @example
|
| 24 |
+
* const props = ['a', 'b', 'c'];
|
| 25 |
+
* zipObject(props);
|
| 26 |
+
* // => { a: undefined, b: undefined, c: undefined }
|
| 27 |
+
*/
|
| 28 |
+
declare function zipObject(props?: ArrayLike<PropertyKey>): Record<string, undefined>;
|
| 29 |
+
//#endregion
|
| 30 |
+
export { zipObject };
|
node_modules/es-toolkit/dist/compat/array/zipObject.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_assignValue = require("../_internal/assignValue.js");
|
| 2 |
+
//#region src/compat/array/zipObject.ts
|
| 3 |
+
/**
|
| 4 |
+
* Combines two arrays, one of property names and one of corresponding values, into a single object.
|
| 5 |
+
*
|
| 6 |
+
* This function takes two arrays: one containing property names and another containing corresponding values.
|
| 7 |
+
* It returns a new object where the property names from the first array are keys, and the corresponding elements
|
| 8 |
+
* from the second array are values. If the `keys` array is longer than the `values` array, the remaining keys will
|
| 9 |
+
* have `undefined` as their values.
|
| 10 |
+
*
|
| 11 |
+
* @template P - The type of elements in the array.
|
| 12 |
+
* @template V - The type of elements in the array.
|
| 13 |
+
* @param keys - An array of property names.
|
| 14 |
+
* @param values - An array of values corresponding to the property names.
|
| 15 |
+
* @returns A new object composed of the given property names and values.
|
| 16 |
+
*
|
| 17 |
+
* @example
|
| 18 |
+
* const keys = ['a', 'b', 'c'];
|
| 19 |
+
* const values = [1, 2, 3];
|
| 20 |
+
* const result = zipObject(keys, values);
|
| 21 |
+
* // result will be { a: 1, b: 2, c: 3 }
|
| 22 |
+
*
|
| 23 |
+
* const keys2 = ['a', 'b', 'c'];
|
| 24 |
+
* const values2 = [1, 2];
|
| 25 |
+
* const result2 = zipObject(keys2, values2);
|
| 26 |
+
* // result2 will be { a: 1, b: 2, c: undefined }
|
| 27 |
+
*
|
| 28 |
+
* const keys2 = ['a', 'b'];
|
| 29 |
+
* const values2 = [1, 2, 3];
|
| 30 |
+
* const result2 = zipObject(keys2, values2);
|
| 31 |
+
* // result2 will be { a: 1, b: 2 }
|
| 32 |
+
*/
|
| 33 |
+
function zipObject(keys = [], values = []) {
|
| 34 |
+
const result = {};
|
| 35 |
+
for (let i = 0; i < keys.length; i++) require_assignValue.assignValue(result, keys[i], values[i]);
|
| 36 |
+
return result;
|
| 37 |
+
}
|
| 38 |
+
//#endregion
|
| 39 |
+
exports.zipObject = zipObject;
|
node_modules/es-toolkit/dist/compat/array/zipObject.mjs
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { assignValue } from "../_internal/assignValue.mjs";
|
| 2 |
+
//#region src/compat/array/zipObject.ts
|
| 3 |
+
/**
|
| 4 |
+
* Combines two arrays, one of property names and one of corresponding values, into a single object.
|
| 5 |
+
*
|
| 6 |
+
* This function takes two arrays: one containing property names and another containing corresponding values.
|
| 7 |
+
* It returns a new object where the property names from the first array are keys, and the corresponding elements
|
| 8 |
+
* from the second array are values. If the `keys` array is longer than the `values` array, the remaining keys will
|
| 9 |
+
* have `undefined` as their values.
|
| 10 |
+
*
|
| 11 |
+
* @template P - The type of elements in the array.
|
| 12 |
+
* @template V - The type of elements in the array.
|
| 13 |
+
* @param keys - An array of property names.
|
| 14 |
+
* @param values - An array of values corresponding to the property names.
|
| 15 |
+
* @returns A new object composed of the given property names and values.
|
| 16 |
+
*
|
| 17 |
+
* @example
|
| 18 |
+
* const keys = ['a', 'b', 'c'];
|
| 19 |
+
* const values = [1, 2, 3];
|
| 20 |
+
* const result = zipObject(keys, values);
|
| 21 |
+
* // result will be { a: 1, b: 2, c: 3 }
|
| 22 |
+
*
|
| 23 |
+
* const keys2 = ['a', 'b', 'c'];
|
| 24 |
+
* const values2 = [1, 2];
|
| 25 |
+
* const result2 = zipObject(keys2, values2);
|
| 26 |
+
* // result2 will be { a: 1, b: 2, c: undefined }
|
| 27 |
+
*
|
| 28 |
+
* const keys2 = ['a', 'b'];
|
| 29 |
+
* const values2 = [1, 2, 3];
|
| 30 |
+
* const result2 = zipObject(keys2, values2);
|
| 31 |
+
* // result2 will be { a: 1, b: 2 }
|
| 32 |
+
*/
|
| 33 |
+
function zipObject(keys = [], values = []) {
|
| 34 |
+
const result = {};
|
| 35 |
+
for (let i = 0; i < keys.length; i++) assignValue(result, keys[i], values[i]);
|
| 36 |
+
return result;
|
| 37 |
+
}
|
| 38 |
+
//#endregion
|
| 39 |
+
export { zipObject };
|
node_modules/es-toolkit/dist/compat/array/zipObjectDeep.d.mts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { PropertyPath } from "../_internal/PropertyPath.mjs";
|
| 2 |
+
|
| 3 |
+
//#region src/compat/array/zipObjectDeep.d.ts
|
| 4 |
+
/**
|
| 5 |
+
* Creates a deeply nested object given arrays of paths and values.
|
| 6 |
+
*
|
| 7 |
+
* This function takes two arrays: one containing arrays of property paths, and the other containing corresponding values.
|
| 8 |
+
* It returns a new object where paths from the first array are used as key paths to set values, with corresponding elements from the second array as values.
|
| 9 |
+
* Paths can be dot-separated strings or arrays of property names.
|
| 10 |
+
*
|
| 11 |
+
* If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values.
|
| 12 |
+
*
|
| 13 |
+
* @template P - The type of property paths.
|
| 14 |
+
* @template V - The type of values corresponding to the property paths.
|
| 15 |
+
* @param keys - An array of property paths, each path can be a dot-separated string or an array of property names.
|
| 16 |
+
* @param values - An array of values corresponding to the property paths.
|
| 17 |
+
* @returns A new object composed of the given property paths and values.
|
| 18 |
+
*
|
| 19 |
+
* @example
|
| 20 |
+
* const paths = ['a.b.c', 'd.e.f'];
|
| 21 |
+
* const values = [1, 2];
|
| 22 |
+
* const result = zipObjectDeep(paths, values);
|
| 23 |
+
* // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }
|
| 24 |
+
*
|
| 25 |
+
* @example
|
| 26 |
+
* const paths = [['a', 'b', 'c'], ['d', 'e', 'f']];
|
| 27 |
+
* const values = [1, 2];
|
| 28 |
+
* const result = zipObjectDeep(paths, values);
|
| 29 |
+
* // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }
|
| 30 |
+
*
|
| 31 |
+
* @example
|
| 32 |
+
* const paths = ['a.b[0].c', 'a.b[1].d'];
|
| 33 |
+
* const values = [1, 2];
|
| 34 |
+
* const result = zipObjectDeep(paths, values);
|
| 35 |
+
* // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
|
| 36 |
+
*/
|
| 37 |
+
declare function zipObjectDeep(keys?: ArrayLike<PropertyPath>, values?: ArrayLike<any>): object;
|
| 38 |
+
//#endregion
|
| 39 |
+
export { zipObjectDeep };
|
node_modules/es-toolkit/dist/compat/array/zipObjectDeep.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { PropertyPath } from "../_internal/PropertyPath.js";
|
| 2 |
+
|
| 3 |
+
//#region src/compat/array/zipObjectDeep.d.ts
|
| 4 |
+
/**
|
| 5 |
+
* Creates a deeply nested object given arrays of paths and values.
|
| 6 |
+
*
|
| 7 |
+
* This function takes two arrays: one containing arrays of property paths, and the other containing corresponding values.
|
| 8 |
+
* It returns a new object where paths from the first array are used as key paths to set values, with corresponding elements from the second array as values.
|
| 9 |
+
* Paths can be dot-separated strings or arrays of property names.
|
| 10 |
+
*
|
| 11 |
+
* If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values.
|
| 12 |
+
*
|
| 13 |
+
* @template P - The type of property paths.
|
| 14 |
+
* @template V - The type of values corresponding to the property paths.
|
| 15 |
+
* @param keys - An array of property paths, each path can be a dot-separated string or an array of property names.
|
| 16 |
+
* @param values - An array of values corresponding to the property paths.
|
| 17 |
+
* @returns A new object composed of the given property paths and values.
|
| 18 |
+
*
|
| 19 |
+
* @example
|
| 20 |
+
* const paths = ['a.b.c', 'd.e.f'];
|
| 21 |
+
* const values = [1, 2];
|
| 22 |
+
* const result = zipObjectDeep(paths, values);
|
| 23 |
+
* // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }
|
| 24 |
+
*
|
| 25 |
+
* @example
|
| 26 |
+
* const paths = [['a', 'b', 'c'], ['d', 'e', 'f']];
|
| 27 |
+
* const values = [1, 2];
|
| 28 |
+
* const result = zipObjectDeep(paths, values);
|
| 29 |
+
* // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }
|
| 30 |
+
*
|
| 31 |
+
* @example
|
| 32 |
+
* const paths = ['a.b[0].c', 'a.b[1].d'];
|
| 33 |
+
* const values = [1, 2];
|
| 34 |
+
* const result = zipObjectDeep(paths, values);
|
| 35 |
+
* // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
|
| 36 |
+
*/
|
| 37 |
+
declare function zipObjectDeep(keys?: ArrayLike<PropertyPath>, values?: ArrayLike<any>): object;
|
| 38 |
+
//#endregion
|
| 39 |
+
export { zipObjectDeep };
|
node_modules/es-toolkit/dist/compat/array/zipObjectDeep.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_zip = require("../../array/zip.js");
|
| 2 |
+
const require_isArrayLike = require("../predicate/isArrayLike.js");
|
| 3 |
+
const require_set = require("../object/set.js");
|
| 4 |
+
//#region src/compat/array/zipObjectDeep.ts
|
| 5 |
+
/**
|
| 6 |
+
* Creates a deeply nested object given arrays of paths and values.
|
| 7 |
+
*
|
| 8 |
+
* This function takes two arrays: one containing arrays of property paths, and the other containing corresponding values.
|
| 9 |
+
* It returns a new object where paths from the first array are used as key paths to set values, with corresponding elements from the second array as values.
|
| 10 |
+
* Paths can be dot-separated strings or arrays of property names.
|
| 11 |
+
*
|
| 12 |
+
* If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values.
|
| 13 |
+
*
|
| 14 |
+
* @template P - The type of property paths.
|
| 15 |
+
* @template V - The type of values corresponding to the property paths.
|
| 16 |
+
* @param keys - An array of property paths, each path can be a dot-separated string or an array of property names.
|
| 17 |
+
* @param values - An array of values corresponding to the property paths.
|
| 18 |
+
* @returns A new object composed of the given property paths and values.
|
| 19 |
+
*
|
| 20 |
+
* @example
|
| 21 |
+
* const paths = ['a.b.c', 'd.e.f'];
|
| 22 |
+
* const values = [1, 2];
|
| 23 |
+
* const result = zipObjectDeep(paths, values);
|
| 24 |
+
* // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }
|
| 25 |
+
*
|
| 26 |
+
* @example
|
| 27 |
+
* const paths = [['a', 'b', 'c'], ['d', 'e', 'f']];
|
| 28 |
+
* const values = [1, 2];
|
| 29 |
+
* const result = zipObjectDeep(paths, values);
|
| 30 |
+
* // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }
|
| 31 |
+
*
|
| 32 |
+
* @example
|
| 33 |
+
* const paths = ['a.b[0].c', 'a.b[1].d'];
|
| 34 |
+
* const values = [1, 2];
|
| 35 |
+
* const result = zipObjectDeep(paths, values);
|
| 36 |
+
* // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
|
| 37 |
+
*/
|
| 38 |
+
function zipObjectDeep(keys, values) {
|
| 39 |
+
const result = {};
|
| 40 |
+
if (!require_isArrayLike.isArrayLike(keys)) return result;
|
| 41 |
+
if (!require_isArrayLike.isArrayLike(values)) values = [];
|
| 42 |
+
const zipped = require_zip.zip(Array.from(keys), Array.from(values));
|
| 43 |
+
for (let i = 0; i < zipped.length; i++) {
|
| 44 |
+
const [key, value] = zipped[i];
|
| 45 |
+
if (key != null) require_set.set(result, key, value);
|
| 46 |
+
}
|
| 47 |
+
return result;
|
| 48 |
+
}
|
| 49 |
+
//#endregion
|
| 50 |
+
exports.zipObjectDeep = zipObjectDeep;
|
node_modules/es-toolkit/dist/compat/array/zipObjectDeep.mjs
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { zip } from "../../array/zip.mjs";
|
| 2 |
+
import { isArrayLike } from "../predicate/isArrayLike.mjs";
|
| 3 |
+
import { set } from "../object/set.mjs";
|
| 4 |
+
//#region src/compat/array/zipObjectDeep.ts
|
| 5 |
+
/**
|
| 6 |
+
* Creates a deeply nested object given arrays of paths and values.
|
| 7 |
+
*
|
| 8 |
+
* This function takes two arrays: one containing arrays of property paths, and the other containing corresponding values.
|
| 9 |
+
* It returns a new object where paths from the first array are used as key paths to set values, with corresponding elements from the second array as values.
|
| 10 |
+
* Paths can be dot-separated strings or arrays of property names.
|
| 11 |
+
*
|
| 12 |
+
* If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values.
|
| 13 |
+
*
|
| 14 |
+
* @template P - The type of property paths.
|
| 15 |
+
* @template V - The type of values corresponding to the property paths.
|
| 16 |
+
* @param keys - An array of property paths, each path can be a dot-separated string or an array of property names.
|
| 17 |
+
* @param values - An array of values corresponding to the property paths.
|
| 18 |
+
* @returns A new object composed of the given property paths and values.
|
| 19 |
+
*
|
| 20 |
+
* @example
|
| 21 |
+
* const paths = ['a.b.c', 'd.e.f'];
|
| 22 |
+
* const values = [1, 2];
|
| 23 |
+
* const result = zipObjectDeep(paths, values);
|
| 24 |
+
* // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }
|
| 25 |
+
*
|
| 26 |
+
* @example
|
| 27 |
+
* const paths = [['a', 'b', 'c'], ['d', 'e', 'f']];
|
| 28 |
+
* const values = [1, 2];
|
| 29 |
+
* const result = zipObjectDeep(paths, values);
|
| 30 |
+
* // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }
|
| 31 |
+
*
|
| 32 |
+
* @example
|
| 33 |
+
* const paths = ['a.b[0].c', 'a.b[1].d'];
|
| 34 |
+
* const values = [1, 2];
|
| 35 |
+
* const result = zipObjectDeep(paths, values);
|
| 36 |
+
* // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
|
| 37 |
+
*/
|
| 38 |
+
function zipObjectDeep(keys, values) {
|
| 39 |
+
const result = {};
|
| 40 |
+
if (!isArrayLike(keys)) return result;
|
| 41 |
+
if (!isArrayLike(values)) values = [];
|
| 42 |
+
const zipped = zip(Array.from(keys), Array.from(values));
|
| 43 |
+
for (let i = 0; i < zipped.length; i++) {
|
| 44 |
+
const [key, value] = zipped[i];
|
| 45 |
+
if (key != null) set(result, key, value);
|
| 46 |
+
}
|
| 47 |
+
return result;
|
| 48 |
+
}
|
| 49 |
+
//#endregion
|
| 50 |
+
export { zipObjectDeep };
|
node_modules/es-toolkit/dist/compat/array/zipWith.d.mts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/zipWith.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Combines one array into a single array using a custom combiner function.
|
| 4 |
+
*
|
| 5 |
+
* @template T - The type of elements in the first array.
|
| 6 |
+
* @template R - The type of elements in the resulting array.
|
| 7 |
+
* @param arr1 - The first array to zip.
|
| 8 |
+
* @param combine - The combiner function that takes corresponding elements from each array and returns a single value.
|
| 9 |
+
* @returns A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
|
| 10 |
+
*/
|
| 11 |
+
declare function zipWith<T, R>(arr1: ArrayLike<T>, combine: (item: T) => R): R[];
|
| 12 |
+
/**
|
| 13 |
+
* Combines two arrays into a single array using a custom combiner function.
|
| 14 |
+
*
|
| 15 |
+
* @template T - The type of elements in the first array.
|
| 16 |
+
* @template U - The type of elements in the second array.
|
| 17 |
+
* @template R - The type of elements in the resulting array.
|
| 18 |
+
* @param arr1 - The first array to zip.
|
| 19 |
+
* @param arr2 - The second array to zip.
|
| 20 |
+
* @param combine - The combiner function that takes corresponding elements from each array and returns a single value.
|
| 21 |
+
* @returns A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
|
| 22 |
+
*/
|
| 23 |
+
declare function zipWith<T, U, R>(arr1: ArrayLike<T>, arr2: ArrayLike<U>, combine: (item1: T, item2: U) => R): R[];
|
| 24 |
+
/**
|
| 25 |
+
* Combines three arrays into a single array using a custom combiner function.
|
| 26 |
+
*
|
| 27 |
+
* @template T - The type of elements in the first array.
|
| 28 |
+
* @template U - The type of elements in the second array.
|
| 29 |
+
* @template V - The type of elements in the third array.
|
| 30 |
+
* @template R - The type of elements in the resulting array.
|
| 31 |
+
* @param arr1 - The first array to zip.
|
| 32 |
+
* @param arr2 - The second array to zip.
|
| 33 |
+
* @param arr3 - The third array to zip.
|
| 34 |
+
* @param combine - The combiner function that takes corresponding elements from each array and returns a single value.
|
| 35 |
+
* @returns A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
|
| 36 |
+
*/
|
| 37 |
+
declare function zipWith<T, U, V, R>(arr1: ArrayLike<T>, arr2: ArrayLike<U>, arr3: ArrayLike<V>, combine: (item1: T, item2: U, item3: V) => R): R[];
|
| 38 |
+
/**
|
| 39 |
+
* Combines four arrays into a single array using a custom combiner function.
|
| 40 |
+
*
|
| 41 |
+
* @template T - The type of elements in the first array.
|
| 42 |
+
* @template U - The type of elements in the second array.
|
| 43 |
+
* @template V - The type of elements in the third array.
|
| 44 |
+
* @template W - The type of elements in the fourth array.
|
| 45 |
+
* @template R - The type of elements in the resulting array.
|
| 46 |
+
* @param arr1 - The first array to zip.
|
| 47 |
+
* @param arr2 - The second array to zip.
|
| 48 |
+
* @param arr3 - The third array to zip.
|
| 49 |
+
* @param arr4 - The fourth array to zip.
|
| 50 |
+
* @param combine - The combiner function that takes corresponding elements from each array and returns a single value.
|
| 51 |
+
* @returns A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
|
| 52 |
+
*/
|
| 53 |
+
declare function zipWith<T, U, V, W, R>(arr1: ArrayLike<T>, arr2: ArrayLike<U>, arr3: ArrayLike<V>, arr4: ArrayLike<W>, combine: (item1: T, item2: U, item3: V, item4: W) => R): R[];
|
| 54 |
+
/**
|
| 55 |
+
* Combines five arrays into a single array using a custom combiner function.
|
| 56 |
+
*
|
| 57 |
+
* @template T - The type of elements in the first array.
|
| 58 |
+
* @template U - The type of elements in the second array.
|
| 59 |
+
* @template V - The type of elements in the third array.
|
| 60 |
+
* @template W - The type of elements in the fourth array.
|
| 61 |
+
* @template X - The type of elements in the fifth array.
|
| 62 |
+
* @template R - The type of elements in the resulting array.
|
| 63 |
+
* @param arr1 - The first array to zip.
|
| 64 |
+
* @param arr2 - The second array to zip.
|
| 65 |
+
* @param arr3 - The third array to zip.
|
| 66 |
+
* @param arr4 - The fourth array to zip.
|
| 67 |
+
* @param arr5 - The fifth array to zip.
|
| 68 |
+
* @param combine - The combiner function that takes corresponding elements from each array and returns a single value.
|
| 69 |
+
* @returns A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
|
| 70 |
+
*/
|
| 71 |
+
declare function zipWith<T, U, V, W, X, R>(arr1: ArrayLike<T>, arr2: ArrayLike<U>, arr3: ArrayLike<V>, arr4: ArrayLike<W>, arr5: ArrayLike<X>, combine: (item1: T, item2: U, item3: V, item4: W, item5: X) => R): R[];
|
| 72 |
+
/**
|
| 73 |
+
* Combines multiple arrays into a single array using a custom combiner function.
|
| 74 |
+
*
|
| 75 |
+
* This function takes one array and a variable number of additional arrays,
|
| 76 |
+
* applying the provided combiner function to the corresponding elements of each array.
|
| 77 |
+
* If the input arrays are of different lengths, the resulting array will have the length
|
| 78 |
+
* of the longest input array, with undefined values for missing elements.
|
| 79 |
+
*
|
| 80 |
+
* @template T - The type of elements in the input arrays.
|
| 81 |
+
* @template R - The type of elements in the resulting array.
|
| 82 |
+
* @param combine - The combiner function that takes corresponding elements from each array and returns a single value.
|
| 83 |
+
* @returns A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
|
| 84 |
+
*
|
| 85 |
+
* @example
|
| 86 |
+
* const arr1 = [1, 2, 3];
|
| 87 |
+
* const arr2 = ['a', 'b', 'c'];
|
| 88 |
+
* const result = zipWith(arr1, arr2, (num, char) => `${num}${char}`);
|
| 89 |
+
* // result will be ['1a', '2b', '3c']
|
| 90 |
+
*/
|
| 91 |
+
declare function zipWith<T, R>(...combine: Array<((...group: T[]) => R) | ArrayLike<T> | null | undefined>): R[];
|
| 92 |
+
//#endregion
|
| 93 |
+
export { zipWith };
|
node_modules/es-toolkit/dist/compat/array/zipWith.d.ts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/zipWith.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Combines one array into a single array using a custom combiner function.
|
| 4 |
+
*
|
| 5 |
+
* @template T - The type of elements in the first array.
|
| 6 |
+
* @template R - The type of elements in the resulting array.
|
| 7 |
+
* @param arr1 - The first array to zip.
|
| 8 |
+
* @param combine - The combiner function that takes corresponding elements from each array and returns a single value.
|
| 9 |
+
* @returns A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
|
| 10 |
+
*/
|
| 11 |
+
declare function zipWith<T, R>(arr1: ArrayLike<T>, combine: (item: T) => R): R[];
|
| 12 |
+
/**
|
| 13 |
+
* Combines two arrays into a single array using a custom combiner function.
|
| 14 |
+
*
|
| 15 |
+
* @template T - The type of elements in the first array.
|
| 16 |
+
* @template U - The type of elements in the second array.
|
| 17 |
+
* @template R - The type of elements in the resulting array.
|
| 18 |
+
* @param arr1 - The first array to zip.
|
| 19 |
+
* @param arr2 - The second array to zip.
|
| 20 |
+
* @param combine - The combiner function that takes corresponding elements from each array and returns a single value.
|
| 21 |
+
* @returns A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
|
| 22 |
+
*/
|
| 23 |
+
declare function zipWith<T, U, R>(arr1: ArrayLike<T>, arr2: ArrayLike<U>, combine: (item1: T, item2: U) => R): R[];
|
| 24 |
+
/**
|
| 25 |
+
* Combines three arrays into a single array using a custom combiner function.
|
| 26 |
+
*
|
| 27 |
+
* @template T - The type of elements in the first array.
|
| 28 |
+
* @template U - The type of elements in the second array.
|
| 29 |
+
* @template V - The type of elements in the third array.
|
| 30 |
+
* @template R - The type of elements in the resulting array.
|
| 31 |
+
* @param arr1 - The first array to zip.
|
| 32 |
+
* @param arr2 - The second array to zip.
|
| 33 |
+
* @param arr3 - The third array to zip.
|
| 34 |
+
* @param combine - The combiner function that takes corresponding elements from each array and returns a single value.
|
| 35 |
+
* @returns A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
|
| 36 |
+
*/
|
| 37 |
+
declare function zipWith<T, U, V, R>(arr1: ArrayLike<T>, arr2: ArrayLike<U>, arr3: ArrayLike<V>, combine: (item1: T, item2: U, item3: V) => R): R[];
|
| 38 |
+
/**
|
| 39 |
+
* Combines four arrays into a single array using a custom combiner function.
|
| 40 |
+
*
|
| 41 |
+
* @template T - The type of elements in the first array.
|
| 42 |
+
* @template U - The type of elements in the second array.
|
| 43 |
+
* @template V - The type of elements in the third array.
|
| 44 |
+
* @template W - The type of elements in the fourth array.
|
| 45 |
+
* @template R - The type of elements in the resulting array.
|
| 46 |
+
* @param arr1 - The first array to zip.
|
| 47 |
+
* @param arr2 - The second array to zip.
|
| 48 |
+
* @param arr3 - The third array to zip.
|
| 49 |
+
* @param arr4 - The fourth array to zip.
|
| 50 |
+
* @param combine - The combiner function that takes corresponding elements from each array and returns a single value.
|
| 51 |
+
* @returns A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
|
| 52 |
+
*/
|
| 53 |
+
declare function zipWith<T, U, V, W, R>(arr1: ArrayLike<T>, arr2: ArrayLike<U>, arr3: ArrayLike<V>, arr4: ArrayLike<W>, combine: (item1: T, item2: U, item3: V, item4: W) => R): R[];
|
| 54 |
+
/**
|
| 55 |
+
* Combines five arrays into a single array using a custom combiner function.
|
| 56 |
+
*
|
| 57 |
+
* @template T - The type of elements in the first array.
|
| 58 |
+
* @template U - The type of elements in the second array.
|
| 59 |
+
* @template V - The type of elements in the third array.
|
| 60 |
+
* @template W - The type of elements in the fourth array.
|
| 61 |
+
* @template X - The type of elements in the fifth array.
|
| 62 |
+
* @template R - The type of elements in the resulting array.
|
| 63 |
+
* @param arr1 - The first array to zip.
|
| 64 |
+
* @param arr2 - The second array to zip.
|
| 65 |
+
* @param arr3 - The third array to zip.
|
| 66 |
+
* @param arr4 - The fourth array to zip.
|
| 67 |
+
* @param arr5 - The fifth array to zip.
|
| 68 |
+
* @param combine - The combiner function that takes corresponding elements from each array and returns a single value.
|
| 69 |
+
* @returns A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
|
| 70 |
+
*/
|
| 71 |
+
declare function zipWith<T, U, V, W, X, R>(arr1: ArrayLike<T>, arr2: ArrayLike<U>, arr3: ArrayLike<V>, arr4: ArrayLike<W>, arr5: ArrayLike<X>, combine: (item1: T, item2: U, item3: V, item4: W, item5: X) => R): R[];
|
| 72 |
+
/**
|
| 73 |
+
* Combines multiple arrays into a single array using a custom combiner function.
|
| 74 |
+
*
|
| 75 |
+
* This function takes one array and a variable number of additional arrays,
|
| 76 |
+
* applying the provided combiner function to the corresponding elements of each array.
|
| 77 |
+
* If the input arrays are of different lengths, the resulting array will have the length
|
| 78 |
+
* of the longest input array, with undefined values for missing elements.
|
| 79 |
+
*
|
| 80 |
+
* @template T - The type of elements in the input arrays.
|
| 81 |
+
* @template R - The type of elements in the resulting array.
|
| 82 |
+
* @param combine - The combiner function that takes corresponding elements from each array and returns a single value.
|
| 83 |
+
* @returns A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays.
|
| 84 |
+
*
|
| 85 |
+
* @example
|
| 86 |
+
* const arr1 = [1, 2, 3];
|
| 87 |
+
* const arr2 = ['a', 'b', 'c'];
|
| 88 |
+
* const result = zipWith(arr1, arr2, (num, char) => `${num}${char}`);
|
| 89 |
+
* // result will be ['1a', '2b', '3c']
|
| 90 |
+
*/
|
| 91 |
+
declare function zipWith<T, R>(...combine: Array<((...group: T[]) => R) | ArrayLike<T> | null | undefined>): R[];
|
| 92 |
+
//#endregion
|
| 93 |
+
export { zipWith };
|