Upload folder using huggingface_hub (part 34)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- tools/ui/node_modules/es-toolkit/dist/compat/array/partition.d.ts +51 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/partition.js +42 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/partition.mjs +42 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/pull.d.mts +39 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/pull.d.ts +39 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/pull.js +23 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/pull.mjs +23 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/pullAll.d.mts +42 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/pullAll.d.ts +42 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/pullAll.js +23 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/pullAll.mjs +23 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllBy.d.mts +87 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllBy.d.ts +87 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllBy.js +43 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllBy.mjs +43 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllWith.d.mts +90 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllWith.d.ts +90 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllWith.js +44 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllWith.mjs +44 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/pullAt.d.mts +51 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/pullAt.d.ts +51 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/pullAt.js +44 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/pullAt.mjs +43 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/reduce.d.mts +81 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/reduce.d.ts +81 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/reduce.js +53 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/reduce.mjs +53 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/reduceRight.d.mts +119 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/reduceRight.d.ts +119 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/reduceRight.js +53 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/reduceRight.mjs +53 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/reject.d.mts +51 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/reject.d.ts +51 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/reject.js +32 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/reject.mjs +32 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/remove.d.mts +22 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/remove.d.ts +22 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/remove.js +36 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/remove.mjs +36 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/reverse.d.mts +19 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/reverse.d.ts +19 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/reverse.js +28 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/reverse.mjs +28 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/sample.d.mts +39 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/sample.d.ts +39 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/sample.js +21 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/sample.mjs +21 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/sampleSize.d.mts +29 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/sampleSize.d.ts +29 -0
- tools/ui/node_modules/es-toolkit/dist/compat/array/sampleSize.js +31 -0
tools/ui/node_modules/es-toolkit/dist/compat/array/partition.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { ValueIteratee } from "../_internal/ValueIteratee.js";
|
| 2 |
+
import { ValueIteratorTypeGuard } from "../_internal/ValueIteratorTypeGuard.js";
|
| 3 |
+
|
| 4 |
+
//#region src/compat/array/partition.d.ts
|
| 5 |
+
/**
|
| 6 |
+
* Creates an array of elements split into two groups, the first of which contains elements
|
| 7 |
+
* predicate returns truthy for, while the second of which contains elements predicate returns falsey for.
|
| 8 |
+
* The predicate is invoked with one argument: (value).
|
| 9 |
+
*
|
| 10 |
+
* @template T, U
|
| 11 |
+
* @param {ArrayLike<T> | null | undefined} collection - The collection to iterate over.
|
| 12 |
+
* @param {(value: T) => value is U} callback - The function invoked per iteration.
|
| 13 |
+
* @returns {[U[], Array<Exclude<T, U>>]} Returns the array of grouped elements.
|
| 14 |
+
*
|
| 15 |
+
* @example
|
| 16 |
+
* partition([1, 2, 3, 4], n => n % 2 === 0);
|
| 17 |
+
* // => [[2, 4], [1, 3]]
|
| 18 |
+
*/
|
| 19 |
+
declare function partition<T, U extends T>(collection: ArrayLike<T> | null | undefined, callback: ValueIteratorTypeGuard<T, U>): [U[], Array<Exclude<T, U>>];
|
| 20 |
+
/**
|
| 21 |
+
* Creates an array of elements split into two groups, the first of which contains elements
|
| 22 |
+
* predicate returns truthy for, while the second of which contains elements predicate returns falsey for.
|
| 23 |
+
* The predicate is invoked with one argument: (value).
|
| 24 |
+
*
|
| 25 |
+
* @template T
|
| 26 |
+
* @param {ArrayLike<T> | null | undefined} collection - The collection to iterate over.
|
| 27 |
+
* @param {((value: T) => unknown) | PropertyKey | [PropertyKey, any] | Partial<T>} callback - The function invoked per iteration.
|
| 28 |
+
* @returns {[T[], T[]]} Returns the array of grouped elements.
|
| 29 |
+
*
|
| 30 |
+
* @example
|
| 31 |
+
* partition([1, 2, 3, 4], n => n % 2 === 0);
|
| 32 |
+
* // => [[2, 4], [1, 3]]
|
| 33 |
+
*/
|
| 34 |
+
declare function partition<T>(collection: ArrayLike<T> | null | undefined, callback: ValueIteratee<T>): [T[], T[]];
|
| 35 |
+
/**
|
| 36 |
+
* Creates an array of elements split into two groups, the first of which contains elements
|
| 37 |
+
* predicate returns truthy for, while the second of which contains elements predicate returns falsey for.
|
| 38 |
+
* The predicate is invoked with one argument: (value).
|
| 39 |
+
*
|
| 40 |
+
* @template T
|
| 41 |
+
* @param {T | null | undefined} collection - The collection to iterate over.
|
| 42 |
+
* @param {((value: T[keyof T]) => unknown) | PropertyKey | [PropertyKey, any] | Partial<T[keyof T]>} callback - The function invoked per iteration.
|
| 43 |
+
* @returns {[Array<T[keyof T]>, Array<T[keyof T]>]} Returns the array of grouped elements.
|
| 44 |
+
*
|
| 45 |
+
* @example
|
| 46 |
+
* partition({ a: 1, b: 2, c: 3 }, n => n % 2 === 0);
|
| 47 |
+
* // => [[2], [1, 3]]
|
| 48 |
+
*/
|
| 49 |
+
declare function partition<T extends object>(collection: T | null | undefined, callback: ValueIteratee<T[keyof T]>): [Array<T[keyof T]>, Array<T[keyof T]>];
|
| 50 |
+
//#endregion
|
| 51 |
+
export { partition };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/partition.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_identity = require("../../function/identity.js");
|
| 2 |
+
const require_isArrayLike = require("../predicate/isArrayLike.js");
|
| 3 |
+
const require_iteratee = require("../util/iteratee.js");
|
| 4 |
+
//#region src/compat/array/partition.ts
|
| 5 |
+
/**
|
| 6 |
+
* Creates an array of elements split into two groups, the first of which contains elements
|
| 7 |
+
* `predicate` returns truthy for, the second of which contains elements
|
| 8 |
+
* `predicate` returns falsy for. The predicate is invoked with one argument: (value).
|
| 9 |
+
*
|
| 10 |
+
* @template T
|
| 11 |
+
* @param {ArrayLike<T> | T | null | undefined} source - The array or object to iterate over.
|
| 12 |
+
* @param {((item: T, index: number, arr: any) => unknown) | Partial<T> | [keyof T, unknown] | PropertyKey} [predicate=identity] - The function invoked per iteration.
|
| 13 |
+
* @returns {[T[], T[]]} - Returns the array of grouped elements.
|
| 14 |
+
*
|
| 15 |
+
* @example
|
| 16 |
+
* partition([{ a: 1 }, { a: 2 }, { b: 1 }], 'a');
|
| 17 |
+
* // => [[{ a: 1 }, { a: 2 }], [{ b: 1 }]]
|
| 18 |
+
*
|
| 19 |
+
* partition([{ a: 1 }, { a: 2 }, { b: 1 }], { b: 1 });
|
| 20 |
+
* // => [[{ b: 1 }], [{ a: 1 }, { a: 2 }]]
|
| 21 |
+
*
|
| 22 |
+
* partition({ item1: { a: 0, b: true }, item2: { a: 1, b: true }, item3: { a: 2, b: false }}, { b: false })
|
| 23 |
+
* // => [[{ a: 2, b: false }], [{ a: 0, b: true }, { a: 1, b: true }]]
|
| 24 |
+
*
|
| 25 |
+
* partition([{ a: 1 }, { a: 2 }, { a: 3 }], ['a', 2]);
|
| 26 |
+
* // => [[{ a: 2 }], [{ a: 1 }, { a: 3 }]]
|
| 27 |
+
*/
|
| 28 |
+
function partition(source, predicate = require_identity.identity) {
|
| 29 |
+
if (!source) return [[], []];
|
| 30 |
+
const collection = require_isArrayLike.isArrayLike(source) ? source : Object.values(source);
|
| 31 |
+
predicate = require_iteratee.iteratee(predicate);
|
| 32 |
+
const matched = [];
|
| 33 |
+
const unmatched = [];
|
| 34 |
+
for (let i = 0; i < collection.length; i++) {
|
| 35 |
+
const value = collection[i];
|
| 36 |
+
if (predicate(value)) matched.push(value);
|
| 37 |
+
else unmatched.push(value);
|
| 38 |
+
}
|
| 39 |
+
return [matched, unmatched];
|
| 40 |
+
}
|
| 41 |
+
//#endregion
|
| 42 |
+
exports.partition = partition;
|
tools/ui/node_modules/es-toolkit/dist/compat/array/partition.mjs
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { identity } from "../../function/identity.mjs";
|
| 2 |
+
import { isArrayLike } from "../predicate/isArrayLike.mjs";
|
| 3 |
+
import { iteratee } from "../util/iteratee.mjs";
|
| 4 |
+
//#region src/compat/array/partition.ts
|
| 5 |
+
/**
|
| 6 |
+
* Creates an array of elements split into two groups, the first of which contains elements
|
| 7 |
+
* `predicate` returns truthy for, the second of which contains elements
|
| 8 |
+
* `predicate` returns falsy for. The predicate is invoked with one argument: (value).
|
| 9 |
+
*
|
| 10 |
+
* @template T
|
| 11 |
+
* @param {ArrayLike<T> | T | null | undefined} source - The array or object to iterate over.
|
| 12 |
+
* @param {((item: T, index: number, arr: any) => unknown) | Partial<T> | [keyof T, unknown] | PropertyKey} [predicate=identity] - The function invoked per iteration.
|
| 13 |
+
* @returns {[T[], T[]]} - Returns the array of grouped elements.
|
| 14 |
+
*
|
| 15 |
+
* @example
|
| 16 |
+
* partition([{ a: 1 }, { a: 2 }, { b: 1 }], 'a');
|
| 17 |
+
* // => [[{ a: 1 }, { a: 2 }], [{ b: 1 }]]
|
| 18 |
+
*
|
| 19 |
+
* partition([{ a: 1 }, { a: 2 }, { b: 1 }], { b: 1 });
|
| 20 |
+
* // => [[{ b: 1 }], [{ a: 1 }, { a: 2 }]]
|
| 21 |
+
*
|
| 22 |
+
* partition({ item1: { a: 0, b: true }, item2: { a: 1, b: true }, item3: { a: 2, b: false }}, { b: false })
|
| 23 |
+
* // => [[{ a: 2, b: false }], [{ a: 0, b: true }, { a: 1, b: true }]]
|
| 24 |
+
*
|
| 25 |
+
* partition([{ a: 1 }, { a: 2 }, { a: 3 }], ['a', 2]);
|
| 26 |
+
* // => [[{ a: 2 }], [{ a: 1 }, { a: 3 }]]
|
| 27 |
+
*/
|
| 28 |
+
function partition(source, predicate = identity) {
|
| 29 |
+
if (!source) return [[], []];
|
| 30 |
+
const collection = isArrayLike(source) ? source : Object.values(source);
|
| 31 |
+
predicate = iteratee(predicate);
|
| 32 |
+
const matched = [];
|
| 33 |
+
const unmatched = [];
|
| 34 |
+
for (let i = 0; i < collection.length; i++) {
|
| 35 |
+
const value = collection[i];
|
| 36 |
+
if (predicate(value)) matched.push(value);
|
| 37 |
+
else unmatched.push(value);
|
| 38 |
+
}
|
| 39 |
+
return [matched, unmatched];
|
| 40 |
+
}
|
| 41 |
+
//#endregion
|
| 42 |
+
export { partition };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/pull.d.mts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/pull.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Removes all provided values from array using SameValueZero for equality comparisons.
|
| 4 |
+
*
|
| 5 |
+
* **Note:** Unlike `_.without`, this method mutates `array`.
|
| 6 |
+
*
|
| 7 |
+
* @template T
|
| 8 |
+
* @param {T[]} array - The array to modify.
|
| 9 |
+
* @param {...T[]} values - The values to remove.
|
| 10 |
+
* @returns {T[]} Returns `array`.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* var array = [1, 2, 3, 1, 2, 3];
|
| 14 |
+
*
|
| 15 |
+
* pull(array, 2, 3);
|
| 16 |
+
* console.log(array);
|
| 17 |
+
* // => [1, 1]
|
| 18 |
+
*/
|
| 19 |
+
declare function pull<T>(array: T[], ...values: T[]): T[];
|
| 20 |
+
/**
|
| 21 |
+
* Removes all provided values from array using SameValueZero for equality comparisons.
|
| 22 |
+
*
|
| 23 |
+
* **Note:** Unlike `_.without`, this method mutates `array`.
|
| 24 |
+
*
|
| 25 |
+
* @template L
|
| 26 |
+
* @param {L} array - The array to modify.
|
| 27 |
+
* @param {...L[0][]} values - The values to remove.
|
| 28 |
+
* @returns {L} Returns `array`.
|
| 29 |
+
*
|
| 30 |
+
* @example
|
| 31 |
+
* var array = [1, 2, 3, 1, 2, 3];
|
| 32 |
+
*
|
| 33 |
+
* pull(array, 2, 3);
|
| 34 |
+
* console.log(array);
|
| 35 |
+
* // => [1, 1]
|
| 36 |
+
*/
|
| 37 |
+
declare function pull<L extends ArrayLike<any>>(array: L extends readonly any[] ? never : L, ...values: Array<L[0]>): L;
|
| 38 |
+
//#endregion
|
| 39 |
+
export { pull };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/pull.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/pull.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Removes all provided values from array using SameValueZero for equality comparisons.
|
| 4 |
+
*
|
| 5 |
+
* **Note:** Unlike `_.without`, this method mutates `array`.
|
| 6 |
+
*
|
| 7 |
+
* @template T
|
| 8 |
+
* @param {T[]} array - The array to modify.
|
| 9 |
+
* @param {...T[]} values - The values to remove.
|
| 10 |
+
* @returns {T[]} Returns `array`.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* var array = [1, 2, 3, 1, 2, 3];
|
| 14 |
+
*
|
| 15 |
+
* pull(array, 2, 3);
|
| 16 |
+
* console.log(array);
|
| 17 |
+
* // => [1, 1]
|
| 18 |
+
*/
|
| 19 |
+
declare function pull<T>(array: T[], ...values: T[]): T[];
|
| 20 |
+
/**
|
| 21 |
+
* Removes all provided values from array using SameValueZero for equality comparisons.
|
| 22 |
+
*
|
| 23 |
+
* **Note:** Unlike `_.without`, this method mutates `array`.
|
| 24 |
+
*
|
| 25 |
+
* @template L
|
| 26 |
+
* @param {L} array - The array to modify.
|
| 27 |
+
* @param {...L[0][]} values - The values to remove.
|
| 28 |
+
* @returns {L} Returns `array`.
|
| 29 |
+
*
|
| 30 |
+
* @example
|
| 31 |
+
* var array = [1, 2, 3, 1, 2, 3];
|
| 32 |
+
*
|
| 33 |
+
* pull(array, 2, 3);
|
| 34 |
+
* console.log(array);
|
| 35 |
+
* // => [1, 1]
|
| 36 |
+
*/
|
| 37 |
+
declare function pull<L extends ArrayLike<any>>(array: L extends readonly any[] ? never : L, ...values: Array<L[0]>): L;
|
| 38 |
+
//#endregion
|
| 39 |
+
export { pull };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/pull.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_pull = require("../../array/pull.js");
|
| 2 |
+
//#region src/compat/array/pull.ts
|
| 3 |
+
/**
|
| 4 |
+
* Removes all specified values from an array.
|
| 5 |
+
*
|
| 6 |
+
* This function changes `arr` in place.
|
| 7 |
+
* If you want to remove values without modifying the original array, use `difference`.
|
| 8 |
+
*
|
| 9 |
+
* @template T, U
|
| 10 |
+
* @param {T[]} arr - The array to modify.
|
| 11 |
+
* @param {...unknown[]} valuesToRemove - The values to remove from the array.
|
| 12 |
+
* @returns {T[]} The modified array with the specified values removed.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* const numbers = [1, 2, 3, 4, 5, 2, 4];
|
| 16 |
+
* pull(numbers, [2, 4]);
|
| 17 |
+
* console.log(numbers); // [1, 3, 5]
|
| 18 |
+
*/
|
| 19 |
+
function pull(arr, ...valuesToRemove) {
|
| 20 |
+
return require_pull.pull(arr, valuesToRemove);
|
| 21 |
+
}
|
| 22 |
+
//#endregion
|
| 23 |
+
exports.pull = pull;
|
tools/ui/node_modules/es-toolkit/dist/compat/array/pull.mjs
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { pull as pull$1 } from "../../array/pull.mjs";
|
| 2 |
+
//#region src/compat/array/pull.ts
|
| 3 |
+
/**
|
| 4 |
+
* Removes all specified values from an array.
|
| 5 |
+
*
|
| 6 |
+
* This function changes `arr` in place.
|
| 7 |
+
* If you want to remove values without modifying the original array, use `difference`.
|
| 8 |
+
*
|
| 9 |
+
* @template T, U
|
| 10 |
+
* @param {T[]} arr - The array to modify.
|
| 11 |
+
* @param {...unknown[]} valuesToRemove - The values to remove from the array.
|
| 12 |
+
* @returns {T[]} The modified array with the specified values removed.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* const numbers = [1, 2, 3, 4, 5, 2, 4];
|
| 16 |
+
* pull(numbers, [2, 4]);
|
| 17 |
+
* console.log(numbers); // [1, 3, 5]
|
| 18 |
+
*/
|
| 19 |
+
function pull(arr, ...valuesToRemove) {
|
| 20 |
+
return pull$1(arr, valuesToRemove);
|
| 21 |
+
}
|
| 22 |
+
//#endregion
|
| 23 |
+
export { pull };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/pullAll.d.mts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { MutableList } from "../_internal/MutableList.mjs";
|
| 2 |
+
import { RejectReadonly } from "../_internal/RejectReadonly.mjs";
|
| 3 |
+
|
| 4 |
+
//#region src/compat/array/pullAll.d.ts
|
| 5 |
+
/**
|
| 6 |
+
* This method is like `_.pull` except that it accepts an array of values to remove.
|
| 7 |
+
*
|
| 8 |
+
* **Note:** Unlike `_.difference`, this method mutates `array`.
|
| 9 |
+
*
|
| 10 |
+
* @template T
|
| 11 |
+
* @param {T[]} array - The array to modify.
|
| 12 |
+
* @param {ArrayLike<T>} [values] - The values to remove.
|
| 13 |
+
* @returns {T[]} Returns `array`.
|
| 14 |
+
*
|
| 15 |
+
* @example
|
| 16 |
+
* var array = [1, 2, 3, 1, 2, 3];
|
| 17 |
+
*
|
| 18 |
+
* pullAll(array, [2, 3]);
|
| 19 |
+
* console.log(array);
|
| 20 |
+
* // => [1, 1]
|
| 21 |
+
*/
|
| 22 |
+
declare function pullAll<T>(array: T[], values?: ArrayLike<T>): T[];
|
| 23 |
+
/**
|
| 24 |
+
* This method is like `_.pull` except that it accepts an array of values to remove.
|
| 25 |
+
*
|
| 26 |
+
* **Note:** Unlike `_.difference`, this method mutates `array`.
|
| 27 |
+
*
|
| 28 |
+
* @template L
|
| 29 |
+
* @param {RejectReadonly<L>} array - The array to modify.
|
| 30 |
+
* @param {List<L[0]>} [values] - The values to remove.
|
| 31 |
+
* @returns {L} Returns `array`.
|
| 32 |
+
*
|
| 33 |
+
* @example
|
| 34 |
+
* var array = [1, 2, 3, 1, 2, 3];
|
| 35 |
+
*
|
| 36 |
+
* pullAll(array, [2, 3]);
|
| 37 |
+
* console.log(array);
|
| 38 |
+
* // => [1, 1]
|
| 39 |
+
*/
|
| 40 |
+
declare function pullAll<L extends MutableList<any>>(array: RejectReadonly<L>, values?: ArrayLike<L[0]>): L;
|
| 41 |
+
//#endregion
|
| 42 |
+
export { pullAll };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/pullAll.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { MutableList } from "../_internal/MutableList.js";
|
| 2 |
+
import { RejectReadonly } from "../_internal/RejectReadonly.js";
|
| 3 |
+
|
| 4 |
+
//#region src/compat/array/pullAll.d.ts
|
| 5 |
+
/**
|
| 6 |
+
* This method is like `_.pull` except that it accepts an array of values to remove.
|
| 7 |
+
*
|
| 8 |
+
* **Note:** Unlike `_.difference`, this method mutates `array`.
|
| 9 |
+
*
|
| 10 |
+
* @template T
|
| 11 |
+
* @param {T[]} array - The array to modify.
|
| 12 |
+
* @param {ArrayLike<T>} [values] - The values to remove.
|
| 13 |
+
* @returns {T[]} Returns `array`.
|
| 14 |
+
*
|
| 15 |
+
* @example
|
| 16 |
+
* var array = [1, 2, 3, 1, 2, 3];
|
| 17 |
+
*
|
| 18 |
+
* pullAll(array, [2, 3]);
|
| 19 |
+
* console.log(array);
|
| 20 |
+
* // => [1, 1]
|
| 21 |
+
*/
|
| 22 |
+
declare function pullAll<T>(array: T[], values?: ArrayLike<T>): T[];
|
| 23 |
+
/**
|
| 24 |
+
* This method is like `_.pull` except that it accepts an array of values to remove.
|
| 25 |
+
*
|
| 26 |
+
* **Note:** Unlike `_.difference`, this method mutates `array`.
|
| 27 |
+
*
|
| 28 |
+
* @template L
|
| 29 |
+
* @param {RejectReadonly<L>} array - The array to modify.
|
| 30 |
+
* @param {List<L[0]>} [values] - The values to remove.
|
| 31 |
+
* @returns {L} Returns `array`.
|
| 32 |
+
*
|
| 33 |
+
* @example
|
| 34 |
+
* var array = [1, 2, 3, 1, 2, 3];
|
| 35 |
+
*
|
| 36 |
+
* pullAll(array, [2, 3]);
|
| 37 |
+
* console.log(array);
|
| 38 |
+
* // => [1, 1]
|
| 39 |
+
*/
|
| 40 |
+
declare function pullAll<L extends MutableList<any>>(array: RejectReadonly<L>, values?: ArrayLike<L[0]>): L;
|
| 41 |
+
//#endregion
|
| 42 |
+
export { pullAll };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/pullAll.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_pull = require("../../array/pull.js");
|
| 2 |
+
//#region src/compat/array/pullAll.ts
|
| 3 |
+
/**
|
| 4 |
+
* Removes all specified values from an array.
|
| 5 |
+
*
|
| 6 |
+
* This function changes `arr` in place.
|
| 7 |
+
* If you want to remove values without modifying the original array, use `difference`.
|
| 8 |
+
*
|
| 9 |
+
* @template T
|
| 10 |
+
* @param {T[]} arr - The array to modify.
|
| 11 |
+
* @param {ArrayLike<T>} valuesToRemove - The values to remove from the array.
|
| 12 |
+
* @returns {T[]} The modified array with the specified values removed.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* const numbers = [1, 2, 3, 4, 5, 2, 4];
|
| 16 |
+
* pullAll(numbers, [2, 4]);
|
| 17 |
+
* console.log(numbers); // [1, 3, 5]
|
| 18 |
+
*/
|
| 19 |
+
function pullAll(arr, valuesToRemove = []) {
|
| 20 |
+
return require_pull.pull(arr, Array.from(valuesToRemove));
|
| 21 |
+
}
|
| 22 |
+
//#endregion
|
| 23 |
+
exports.pullAll = pullAll;
|
tools/ui/node_modules/es-toolkit/dist/compat/array/pullAll.mjs
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { pull } from "../../array/pull.mjs";
|
| 2 |
+
//#region src/compat/array/pullAll.ts
|
| 3 |
+
/**
|
| 4 |
+
* Removes all specified values from an array.
|
| 5 |
+
*
|
| 6 |
+
* This function changes `arr` in place.
|
| 7 |
+
* If you want to remove values without modifying the original array, use `difference`.
|
| 8 |
+
*
|
| 9 |
+
* @template T
|
| 10 |
+
* @param {T[]} arr - The array to modify.
|
| 11 |
+
* @param {ArrayLike<T>} valuesToRemove - The values to remove from the array.
|
| 12 |
+
* @returns {T[]} The modified array with the specified values removed.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* const numbers = [1, 2, 3, 4, 5, 2, 4];
|
| 16 |
+
* pullAll(numbers, [2, 4]);
|
| 17 |
+
* console.log(numbers); // [1, 3, 5]
|
| 18 |
+
*/
|
| 19 |
+
function pullAll(arr, valuesToRemove = []) {
|
| 20 |
+
return pull(arr, Array.from(valuesToRemove));
|
| 21 |
+
}
|
| 22 |
+
//#endregion
|
| 23 |
+
export { pullAll };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllBy.d.mts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { ValueIteratee } from "../_internal/ValueIteratee.mjs";
|
| 2 |
+
import { MutableList } from "../_internal/MutableList.mjs";
|
| 3 |
+
import { RejectReadonly } from "../_internal/RejectReadonly.mjs";
|
| 4 |
+
|
| 5 |
+
//#region src/compat/array/pullAllBy.d.ts
|
| 6 |
+
/**
|
| 7 |
+
* Removes all specified values from an array using an iteratee function.
|
| 8 |
+
*
|
| 9 |
+
* This function changes `arr` in place.
|
| 10 |
+
* If you want to remove values without modifying the original array, use `differenceBy`.
|
| 11 |
+
*
|
| 12 |
+
* @template T
|
| 13 |
+
* @param {T[]} array - The array to modify.
|
| 14 |
+
* @param {ArrayLike<T>} [values] - The values to remove.
|
| 15 |
+
* @param {((value: T) => unknown) | PropertyKey | [PropertyKey, any] | Partial<T>} [iteratee] - The iteratee invoked per element.
|
| 16 |
+
* @returns {T[]} Returns `array`.
|
| 17 |
+
*
|
| 18 |
+
* @example
|
| 19 |
+
* var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
|
| 20 |
+
*
|
| 21 |
+
* pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
|
| 22 |
+
* console.log(array);
|
| 23 |
+
* // => [{ 'x': 2 }]
|
| 24 |
+
*/
|
| 25 |
+
declare function pullAllBy<T>(array: T[], values?: ArrayLike<T>, iteratee?: ValueIteratee<T>): T[];
|
| 26 |
+
/**
|
| 27 |
+
* Removes all specified values from an array using an iteratee function.
|
| 28 |
+
*
|
| 29 |
+
* This function changes `arr` in place.
|
| 30 |
+
* If you want to remove values without modifying the original array, use `differenceBy`.
|
| 31 |
+
*
|
| 32 |
+
* @template L
|
| 33 |
+
* @param {RejectReadonly<L>} array - The array to modify.
|
| 34 |
+
* @param {ArrayLike<L[0]>} [values] - The values to remove.
|
| 35 |
+
* @param {ValueIteratee<L[0]>} [iteratee] - The iteratee invoked per element.
|
| 36 |
+
* @returns {L} Returns `array`.
|
| 37 |
+
*
|
| 38 |
+
* @example
|
| 39 |
+
* var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
|
| 40 |
+
*
|
| 41 |
+
* pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
|
| 42 |
+
* console.log(array);
|
| 43 |
+
* // => [{ 'x': 2 }]
|
| 44 |
+
*/
|
| 45 |
+
declare function pullAllBy<L extends MutableList<any>>(array: RejectReadonly<L>, values?: ArrayLike<L[0]>, iteratee?: ValueIteratee<L[0]>): L;
|
| 46 |
+
/**
|
| 47 |
+
* Removes all specified values from an array using an iteratee function.
|
| 48 |
+
*
|
| 49 |
+
* This function changes `arr` in place.
|
| 50 |
+
* If you want to remove values without modifying the original array, use `differenceBy`.
|
| 51 |
+
*
|
| 52 |
+
* @template T, U
|
| 53 |
+
* @param {T[]} array - The array to modify.
|
| 54 |
+
* @param {ArrayLike<U>} values - The values to remove.
|
| 55 |
+
* @param {((value: T | U) => unknown) | PropertyKey | [PropertyKey, any] | Partial<T | U>} iteratee - The iteratee invoked per element.
|
| 56 |
+
* @returns {T[]} Returns `array`.
|
| 57 |
+
*
|
| 58 |
+
* @example
|
| 59 |
+
* var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
|
| 60 |
+
*
|
| 61 |
+
* pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
|
| 62 |
+
* console.log(array);
|
| 63 |
+
* // => [{ 'x': 2 }]
|
| 64 |
+
*/
|
| 65 |
+
declare function pullAllBy<T, U>(array: T[], values: ArrayLike<U>, iteratee: ValueIteratee<T | U>): T[];
|
| 66 |
+
/**
|
| 67 |
+
* Removes all specified values from an array using an iteratee function.
|
| 68 |
+
*
|
| 69 |
+
* This function changes `arr` in place.
|
| 70 |
+
* If you want to remove values without modifying the original array, use `differenceBy`.
|
| 71 |
+
*
|
| 72 |
+
* @template L, U
|
| 73 |
+
* @param {L} array - The array to modify.
|
| 74 |
+
* @param {ArrayLike<U>} values - The values to remove.
|
| 75 |
+
* @param {((value: L[0] | U) => unknown) | PropertyKey | [PropertyKey, any] | Partial<L[0] | U>} iteratee - The iteratee invoked per element.
|
| 76 |
+
* @returns {L} Returns `array`.
|
| 77 |
+
*
|
| 78 |
+
* @example
|
| 79 |
+
* var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
|
| 80 |
+
*
|
| 81 |
+
* pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
|
| 82 |
+
* console.log(array);
|
| 83 |
+
* // => [{ 'x': 2 }]
|
| 84 |
+
*/
|
| 85 |
+
declare function pullAllBy<L extends ArrayLike<any>, U>(array: L extends readonly any[] ? never : L, values: ArrayLike<U>, iteratee: ValueIteratee<L[0] | U>): L;
|
| 86 |
+
//#endregion
|
| 87 |
+
export { pullAllBy };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllBy.d.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { ValueIteratee } from "../_internal/ValueIteratee.js";
|
| 2 |
+
import { MutableList } from "../_internal/MutableList.js";
|
| 3 |
+
import { RejectReadonly } from "../_internal/RejectReadonly.js";
|
| 4 |
+
|
| 5 |
+
//#region src/compat/array/pullAllBy.d.ts
|
| 6 |
+
/**
|
| 7 |
+
* Removes all specified values from an array using an iteratee function.
|
| 8 |
+
*
|
| 9 |
+
* This function changes `arr` in place.
|
| 10 |
+
* If you want to remove values without modifying the original array, use `differenceBy`.
|
| 11 |
+
*
|
| 12 |
+
* @template T
|
| 13 |
+
* @param {T[]} array - The array to modify.
|
| 14 |
+
* @param {ArrayLike<T>} [values] - The values to remove.
|
| 15 |
+
* @param {((value: T) => unknown) | PropertyKey | [PropertyKey, any] | Partial<T>} [iteratee] - The iteratee invoked per element.
|
| 16 |
+
* @returns {T[]} Returns `array`.
|
| 17 |
+
*
|
| 18 |
+
* @example
|
| 19 |
+
* var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
|
| 20 |
+
*
|
| 21 |
+
* pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
|
| 22 |
+
* console.log(array);
|
| 23 |
+
* // => [{ 'x': 2 }]
|
| 24 |
+
*/
|
| 25 |
+
declare function pullAllBy<T>(array: T[], values?: ArrayLike<T>, iteratee?: ValueIteratee<T>): T[];
|
| 26 |
+
/**
|
| 27 |
+
* Removes all specified values from an array using an iteratee function.
|
| 28 |
+
*
|
| 29 |
+
* This function changes `arr` in place.
|
| 30 |
+
* If you want to remove values without modifying the original array, use `differenceBy`.
|
| 31 |
+
*
|
| 32 |
+
* @template L
|
| 33 |
+
* @param {RejectReadonly<L>} array - The array to modify.
|
| 34 |
+
* @param {ArrayLike<L[0]>} [values] - The values to remove.
|
| 35 |
+
* @param {ValueIteratee<L[0]>} [iteratee] - The iteratee invoked per element.
|
| 36 |
+
* @returns {L} Returns `array`.
|
| 37 |
+
*
|
| 38 |
+
* @example
|
| 39 |
+
* var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
|
| 40 |
+
*
|
| 41 |
+
* pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
|
| 42 |
+
* console.log(array);
|
| 43 |
+
* // => [{ 'x': 2 }]
|
| 44 |
+
*/
|
| 45 |
+
declare function pullAllBy<L extends MutableList<any>>(array: RejectReadonly<L>, values?: ArrayLike<L[0]>, iteratee?: ValueIteratee<L[0]>): L;
|
| 46 |
+
/**
|
| 47 |
+
* Removes all specified values from an array using an iteratee function.
|
| 48 |
+
*
|
| 49 |
+
* This function changes `arr` in place.
|
| 50 |
+
* If you want to remove values without modifying the original array, use `differenceBy`.
|
| 51 |
+
*
|
| 52 |
+
* @template T, U
|
| 53 |
+
* @param {T[]} array - The array to modify.
|
| 54 |
+
* @param {ArrayLike<U>} values - The values to remove.
|
| 55 |
+
* @param {((value: T | U) => unknown) | PropertyKey | [PropertyKey, any] | Partial<T | U>} iteratee - The iteratee invoked per element.
|
| 56 |
+
* @returns {T[]} Returns `array`.
|
| 57 |
+
*
|
| 58 |
+
* @example
|
| 59 |
+
* var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
|
| 60 |
+
*
|
| 61 |
+
* pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
|
| 62 |
+
* console.log(array);
|
| 63 |
+
* // => [{ 'x': 2 }]
|
| 64 |
+
*/
|
| 65 |
+
declare function pullAllBy<T, U>(array: T[], values: ArrayLike<U>, iteratee: ValueIteratee<T | U>): T[];
|
| 66 |
+
/**
|
| 67 |
+
* Removes all specified values from an array using an iteratee function.
|
| 68 |
+
*
|
| 69 |
+
* This function changes `arr` in place.
|
| 70 |
+
* If you want to remove values without modifying the original array, use `differenceBy`.
|
| 71 |
+
*
|
| 72 |
+
* @template L, U
|
| 73 |
+
* @param {L} array - The array to modify.
|
| 74 |
+
* @param {ArrayLike<U>} values - The values to remove.
|
| 75 |
+
* @param {((value: L[0] | U) => unknown) | PropertyKey | [PropertyKey, any] | Partial<L[0] | U>} iteratee - The iteratee invoked per element.
|
| 76 |
+
* @returns {L} Returns `array`.
|
| 77 |
+
*
|
| 78 |
+
* @example
|
| 79 |
+
* var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
|
| 80 |
+
*
|
| 81 |
+
* pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
|
| 82 |
+
* console.log(array);
|
| 83 |
+
* // => [{ 'x': 2 }]
|
| 84 |
+
*/
|
| 85 |
+
declare function pullAllBy<L extends ArrayLike<any>, U>(array: L extends readonly any[] ? never : L, values: ArrayLike<U>, iteratee: ValueIteratee<L[0] | U>): L;
|
| 86 |
+
//#endregion
|
| 87 |
+
export { pullAllBy };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllBy.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_iteratee = require("../util/iteratee.js");
|
| 2 |
+
//#region src/compat/array/pullAllBy.ts
|
| 3 |
+
/**
|
| 4 |
+
* Removes all specified values from an array using an iteratee function.
|
| 5 |
+
*
|
| 6 |
+
* This function changes `arr` in place.
|
| 7 |
+
* If you want to remove values without modifying the original array, use `differenceBy`.
|
| 8 |
+
*
|
| 9 |
+
* @template T
|
| 10 |
+
* @param {T[]} arr - The array to modify.
|
| 11 |
+
* @param {ArrayLike<T>} valuesToRemove - The values to remove from the array.
|
| 12 |
+
* @param {keyof T} getValue - The key of the property to match against each element.
|
| 13 |
+
* @returns {T[]} The modified array with the specified values removed.
|
| 14 |
+
*
|
| 15 |
+
* @example
|
| 16 |
+
* // Using a iteratee function
|
| 17 |
+
* const items = [{ value: 1 }, { value: 2 }, { value: 3 }, { value: 1 }];
|
| 18 |
+
* const result = pullAllBy(items, [{ value: 1 }, { value: 3 }], obj => obj.value);
|
| 19 |
+
* console.log(result); // [{ value: 2 }]
|
| 20 |
+
*
|
| 21 |
+
* // Using a property name
|
| 22 |
+
* const items = [{ value: 1 }, { value: 2 }, { value: 3 }, { value: 1 }];
|
| 23 |
+
* const result = pullAllBy(items, [{ value: 1 }, { value: 3 }], 'value');
|
| 24 |
+
* console.log(result); // [{ value: 2 }]
|
| 25 |
+
*/
|
| 26 |
+
function pullAllBy(arr, valuesToRemove, _getValue) {
|
| 27 |
+
const getValue = require_iteratee.iteratee(_getValue);
|
| 28 |
+
const valuesSet = new Set(Array.from(valuesToRemove).map((x) => getValue(x)));
|
| 29 |
+
let resultIndex = 0;
|
| 30 |
+
for (let i = 0; i < arr.length; i++) {
|
| 31 |
+
const value = getValue(arr[i]);
|
| 32 |
+
if (valuesSet.has(value)) continue;
|
| 33 |
+
if (!Object.hasOwn(arr, i)) {
|
| 34 |
+
delete arr[resultIndex++];
|
| 35 |
+
continue;
|
| 36 |
+
}
|
| 37 |
+
arr[resultIndex++] = arr[i];
|
| 38 |
+
}
|
| 39 |
+
arr.length = resultIndex;
|
| 40 |
+
return arr;
|
| 41 |
+
}
|
| 42 |
+
//#endregion
|
| 43 |
+
exports.pullAllBy = pullAllBy;
|
tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllBy.mjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { iteratee } from "../util/iteratee.mjs";
|
| 2 |
+
//#region src/compat/array/pullAllBy.ts
|
| 3 |
+
/**
|
| 4 |
+
* Removes all specified values from an array using an iteratee function.
|
| 5 |
+
*
|
| 6 |
+
* This function changes `arr` in place.
|
| 7 |
+
* If you want to remove values without modifying the original array, use `differenceBy`.
|
| 8 |
+
*
|
| 9 |
+
* @template T
|
| 10 |
+
* @param {T[]} arr - The array to modify.
|
| 11 |
+
* @param {ArrayLike<T>} valuesToRemove - The values to remove from the array.
|
| 12 |
+
* @param {keyof T} getValue - The key of the property to match against each element.
|
| 13 |
+
* @returns {T[]} The modified array with the specified values removed.
|
| 14 |
+
*
|
| 15 |
+
* @example
|
| 16 |
+
* // Using a iteratee function
|
| 17 |
+
* const items = [{ value: 1 }, { value: 2 }, { value: 3 }, { value: 1 }];
|
| 18 |
+
* const result = pullAllBy(items, [{ value: 1 }, { value: 3 }], obj => obj.value);
|
| 19 |
+
* console.log(result); // [{ value: 2 }]
|
| 20 |
+
*
|
| 21 |
+
* // Using a property name
|
| 22 |
+
* const items = [{ value: 1 }, { value: 2 }, { value: 3 }, { value: 1 }];
|
| 23 |
+
* const result = pullAllBy(items, [{ value: 1 }, { value: 3 }], 'value');
|
| 24 |
+
* console.log(result); // [{ value: 2 }]
|
| 25 |
+
*/
|
| 26 |
+
function pullAllBy(arr, valuesToRemove, _getValue) {
|
| 27 |
+
const getValue = iteratee(_getValue);
|
| 28 |
+
const valuesSet = new Set(Array.from(valuesToRemove).map((x) => getValue(x)));
|
| 29 |
+
let resultIndex = 0;
|
| 30 |
+
for (let i = 0; i < arr.length; i++) {
|
| 31 |
+
const value = getValue(arr[i]);
|
| 32 |
+
if (valuesSet.has(value)) continue;
|
| 33 |
+
if (!Object.hasOwn(arr, i)) {
|
| 34 |
+
delete arr[resultIndex++];
|
| 35 |
+
continue;
|
| 36 |
+
}
|
| 37 |
+
arr[resultIndex++] = arr[i];
|
| 38 |
+
}
|
| 39 |
+
arr.length = resultIndex;
|
| 40 |
+
return arr;
|
| 41 |
+
}
|
| 42 |
+
//#endregion
|
| 43 |
+
export { pullAllBy };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllWith.d.mts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { MutableList } from "../_internal/MutableList.mjs";
|
| 2 |
+
import { RejectReadonly } from "../_internal/RejectReadonly.mjs";
|
| 3 |
+
|
| 4 |
+
//#region src/compat/array/pullAllWith.d.ts
|
| 5 |
+
/**
|
| 6 |
+
* This method is like `_.pullAll` except that it accepts `comparator` which is
|
| 7 |
+
* invoked to compare elements of array to values. The comparator is invoked with
|
| 8 |
+
* two arguments: (arrVal, othVal).
|
| 9 |
+
*
|
| 10 |
+
* **Note:** Unlike `_.differenceWith`, this method mutates `array`.
|
| 11 |
+
*
|
| 12 |
+
* @template T
|
| 13 |
+
* @param {T[]} array - The array to modify.
|
| 14 |
+
* @param {ArrayLike<T>} [values] - The values to remove.
|
| 15 |
+
* @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element.
|
| 16 |
+
* @returns {T[]} Returns `array`.
|
| 17 |
+
*
|
| 18 |
+
* @example
|
| 19 |
+
* var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
|
| 20 |
+
*
|
| 21 |
+
* pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
|
| 22 |
+
* console.log(array);
|
| 23 |
+
* // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
|
| 24 |
+
*/
|
| 25 |
+
declare function pullAllWith<T>(array: T[], values?: ArrayLike<T>, comparator?: (a: T, b: T) => boolean): T[];
|
| 26 |
+
/**
|
| 27 |
+
* This method is like `_.pullAll` except that it accepts `comparator` which is
|
| 28 |
+
* invoked to compare elements of array to values. The comparator is invoked with
|
| 29 |
+
* two arguments: (arrVal, othVal).
|
| 30 |
+
*
|
| 31 |
+
* **Note:** Unlike `_.differenceWith`, this method mutates `array`.
|
| 32 |
+
*
|
| 33 |
+
* @template L
|
| 34 |
+
* @param {RejectReadonly<L>} array - The array to modify.
|
| 35 |
+
* @param {List<L[0]>} [values] - The values to remove.
|
| 36 |
+
* @param {Comparator<L[0]>} [comparator] - The comparator invoked per element.
|
| 37 |
+
* @returns {L} Returns `array`.
|
| 38 |
+
*
|
| 39 |
+
* @example
|
| 40 |
+
* var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
|
| 41 |
+
*
|
| 42 |
+
* pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
|
| 43 |
+
* console.log(array);
|
| 44 |
+
* // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
|
| 45 |
+
*/
|
| 46 |
+
declare function pullAllWith<L extends MutableList<any>>(array: RejectReadonly<L>, values?: ArrayLike<L[0]>, comparator?: (a: L[0], b: L[0]) => boolean): L;
|
| 47 |
+
/**
|
| 48 |
+
* This method is like `_.pullAll` except that it accepts `comparator` which is
|
| 49 |
+
* invoked to compare elements of array to values. The comparator is invoked with
|
| 50 |
+
* two arguments: (arrVal, othVal).
|
| 51 |
+
*
|
| 52 |
+
* **Note:** Unlike `_.differenceWith`, this method mutates `array`.
|
| 53 |
+
*
|
| 54 |
+
* @template T, U
|
| 55 |
+
* @param {T[]} array - The array to modify.
|
| 56 |
+
* @param {ArrayLike<U>} values - The values to remove.
|
| 57 |
+
* @param {(a: T, b: U) => boolean} comparator - The comparator invoked per element.
|
| 58 |
+
* @returns {T[]} Returns `array`.
|
| 59 |
+
*
|
| 60 |
+
* @example
|
| 61 |
+
* var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
|
| 62 |
+
*
|
| 63 |
+
* pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
|
| 64 |
+
* console.log(array);
|
| 65 |
+
* // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
|
| 66 |
+
*/
|
| 67 |
+
declare function pullAllWith<T, U>(array: T[], values: ArrayLike<U>, comparator: (a: T, b: U) => boolean): T[];
|
| 68 |
+
/**
|
| 69 |
+
* This method is like `_.pullAll` except that it accepts `comparator` which is
|
| 70 |
+
* invoked to compare elements of array to values. The comparator is invoked with
|
| 71 |
+
* two arguments: (arrVal, othVal).
|
| 72 |
+
*
|
| 73 |
+
* **Note:** Unlike `_.differenceWith`, this method mutates `array`.
|
| 74 |
+
*
|
| 75 |
+
* @template L1, L2
|
| 76 |
+
* @param {RejectReadonly<L1>} array - The array to modify.
|
| 77 |
+
* @param {List<L2>} values - The values to remove.
|
| 78 |
+
* @param {Comparator2<L1[0], L2>} comparator - The comparator invoked per element.
|
| 79 |
+
* @returns {L1} Returns `array`.
|
| 80 |
+
*
|
| 81 |
+
* @example
|
| 82 |
+
* var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
|
| 83 |
+
*
|
| 84 |
+
* pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
|
| 85 |
+
* console.log(array);
|
| 86 |
+
* // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
|
| 87 |
+
*/
|
| 88 |
+
declare function pullAllWith<L1 extends MutableList<any>, L2>(array: RejectReadonly<L1>, values: ArrayLike<L2>, comparator: (a: L1[0], b: L2) => boolean): L1;
|
| 89 |
+
//#endregion
|
| 90 |
+
export { pullAllWith };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllWith.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { MutableList } from "../_internal/MutableList.js";
|
| 2 |
+
import { RejectReadonly } from "../_internal/RejectReadonly.js";
|
| 3 |
+
|
| 4 |
+
//#region src/compat/array/pullAllWith.d.ts
|
| 5 |
+
/**
|
| 6 |
+
* This method is like `_.pullAll` except that it accepts `comparator` which is
|
| 7 |
+
* invoked to compare elements of array to values. The comparator is invoked with
|
| 8 |
+
* two arguments: (arrVal, othVal).
|
| 9 |
+
*
|
| 10 |
+
* **Note:** Unlike `_.differenceWith`, this method mutates `array`.
|
| 11 |
+
*
|
| 12 |
+
* @template T
|
| 13 |
+
* @param {T[]} array - The array to modify.
|
| 14 |
+
* @param {ArrayLike<T>} [values] - The values to remove.
|
| 15 |
+
* @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element.
|
| 16 |
+
* @returns {T[]} Returns `array`.
|
| 17 |
+
*
|
| 18 |
+
* @example
|
| 19 |
+
* var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
|
| 20 |
+
*
|
| 21 |
+
* pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
|
| 22 |
+
* console.log(array);
|
| 23 |
+
* // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
|
| 24 |
+
*/
|
| 25 |
+
declare function pullAllWith<T>(array: T[], values?: ArrayLike<T>, comparator?: (a: T, b: T) => boolean): T[];
|
| 26 |
+
/**
|
| 27 |
+
* This method is like `_.pullAll` except that it accepts `comparator` which is
|
| 28 |
+
* invoked to compare elements of array to values. The comparator is invoked with
|
| 29 |
+
* two arguments: (arrVal, othVal).
|
| 30 |
+
*
|
| 31 |
+
* **Note:** Unlike `_.differenceWith`, this method mutates `array`.
|
| 32 |
+
*
|
| 33 |
+
* @template L
|
| 34 |
+
* @param {RejectReadonly<L>} array - The array to modify.
|
| 35 |
+
* @param {List<L[0]>} [values] - The values to remove.
|
| 36 |
+
* @param {Comparator<L[0]>} [comparator] - The comparator invoked per element.
|
| 37 |
+
* @returns {L} Returns `array`.
|
| 38 |
+
*
|
| 39 |
+
* @example
|
| 40 |
+
* var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
|
| 41 |
+
*
|
| 42 |
+
* pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
|
| 43 |
+
* console.log(array);
|
| 44 |
+
* // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
|
| 45 |
+
*/
|
| 46 |
+
declare function pullAllWith<L extends MutableList<any>>(array: RejectReadonly<L>, values?: ArrayLike<L[0]>, comparator?: (a: L[0], b: L[0]) => boolean): L;
|
| 47 |
+
/**
|
| 48 |
+
* This method is like `_.pullAll` except that it accepts `comparator` which is
|
| 49 |
+
* invoked to compare elements of array to values. The comparator is invoked with
|
| 50 |
+
* two arguments: (arrVal, othVal).
|
| 51 |
+
*
|
| 52 |
+
* **Note:** Unlike `_.differenceWith`, this method mutates `array`.
|
| 53 |
+
*
|
| 54 |
+
* @template T, U
|
| 55 |
+
* @param {T[]} array - The array to modify.
|
| 56 |
+
* @param {ArrayLike<U>} values - The values to remove.
|
| 57 |
+
* @param {(a: T, b: U) => boolean} comparator - The comparator invoked per element.
|
| 58 |
+
* @returns {T[]} Returns `array`.
|
| 59 |
+
*
|
| 60 |
+
* @example
|
| 61 |
+
* var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
|
| 62 |
+
*
|
| 63 |
+
* pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
|
| 64 |
+
* console.log(array);
|
| 65 |
+
* // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
|
| 66 |
+
*/
|
| 67 |
+
declare function pullAllWith<T, U>(array: T[], values: ArrayLike<U>, comparator: (a: T, b: U) => boolean): T[];
|
| 68 |
+
/**
|
| 69 |
+
* This method is like `_.pullAll` except that it accepts `comparator` which is
|
| 70 |
+
* invoked to compare elements of array to values. The comparator is invoked with
|
| 71 |
+
* two arguments: (arrVal, othVal).
|
| 72 |
+
*
|
| 73 |
+
* **Note:** Unlike `_.differenceWith`, this method mutates `array`.
|
| 74 |
+
*
|
| 75 |
+
* @template L1, L2
|
| 76 |
+
* @param {RejectReadonly<L1>} array - The array to modify.
|
| 77 |
+
* @param {List<L2>} values - The values to remove.
|
| 78 |
+
* @param {Comparator2<L1[0], L2>} comparator - The comparator invoked per element.
|
| 79 |
+
* @returns {L1} Returns `array`.
|
| 80 |
+
*
|
| 81 |
+
* @example
|
| 82 |
+
* var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
|
| 83 |
+
*
|
| 84 |
+
* pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
|
| 85 |
+
* console.log(array);
|
| 86 |
+
* // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
|
| 87 |
+
*/
|
| 88 |
+
declare function pullAllWith<L1 extends MutableList<any>, L2>(array: RejectReadonly<L1>, values: ArrayLike<L2>, comparator: (a: L1[0], b: L2) => boolean): L1;
|
| 89 |
+
//#endregion
|
| 90 |
+
export { pullAllWith };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllWith.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_isEqualsSameValueZero = require("../../_internal/isEqualsSameValueZero.js");
|
| 2 |
+
require("../util/eq.js");
|
| 3 |
+
const require_copyArray = require("../_internal/copyArray.js");
|
| 4 |
+
//#region src/compat/array/pullAllWith.ts
|
| 5 |
+
/**
|
| 6 |
+
* Removes and returns elements from an array using a provided comparison function to determine which elements to remove.
|
| 7 |
+
*
|
| 8 |
+
* @template T
|
| 9 |
+
* @param {T[] | ArrayLike<T>} array - The array to modify.
|
| 10 |
+
* @param {T[] | ArrayLike<T>} values - The values to remove from the array.
|
| 11 |
+
* @param {(a: T, b: T) => boolean} comparator - The function to compare elements of `array` with elements of `values`. Should return `true` if the two elements are considered equal.
|
| 12 |
+
* @returns {T[] | ArrayLike<T>} - The array with specified values removed.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* import pullAllWith from './pullAllWith';
|
| 16 |
+
* import isEqual from '../predicate';
|
| 17 |
+
*
|
| 18 |
+
* const array = [{ x: 1, y: 2 }, { x: 3, y: 4 }, { x: 5, y: 6 }];
|
| 19 |
+
* const valuesToRemove = [{ x: 3, y: 4 }];
|
| 20 |
+
*
|
| 21 |
+
* const result = pullAllWith(array, valuesToRemove, isEqual);
|
| 22 |
+
*
|
| 23 |
+
* console.log(result); // [{ x: 1, y: 2 }, { x: 5, y: 6 }]
|
| 24 |
+
* console.log(array); // [{ x: 1, y: 2 }, { x: 5, y: 6 }]
|
| 25 |
+
*/
|
| 26 |
+
function pullAllWith(array, values, comparator) {
|
| 27 |
+
if (array?.length == null || values?.length == null) return array;
|
| 28 |
+
if (array === values) values = require_copyArray.default(values);
|
| 29 |
+
let resultLength = 0;
|
| 30 |
+
if (comparator == null) comparator = (a, b) => require_isEqualsSameValueZero.isEqualsSameValueZero(a, b);
|
| 31 |
+
const valuesArray = Array.isArray(values) ? values : Array.from(values);
|
| 32 |
+
const hasUndefined = valuesArray.includes(void 0);
|
| 33 |
+
for (let i = 0; i < array.length; i++) {
|
| 34 |
+
if (i in array) {
|
| 35 |
+
if (!valuesArray.some((value) => comparator(array[i], value))) array[resultLength++] = array[i];
|
| 36 |
+
continue;
|
| 37 |
+
}
|
| 38 |
+
if (!hasUndefined) delete array[resultLength++];
|
| 39 |
+
}
|
| 40 |
+
array.length = resultLength;
|
| 41 |
+
return array;
|
| 42 |
+
}
|
| 43 |
+
//#endregion
|
| 44 |
+
exports.pullAllWith = pullAllWith;
|
tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllWith.mjs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { isEqualsSameValueZero } from "../../_internal/isEqualsSameValueZero.mjs";
|
| 2 |
+
import "../util/eq.mjs";
|
| 3 |
+
import copyArray from "../_internal/copyArray.mjs";
|
| 4 |
+
//#region src/compat/array/pullAllWith.ts
|
| 5 |
+
/**
|
| 6 |
+
* Removes and returns elements from an array using a provided comparison function to determine which elements to remove.
|
| 7 |
+
*
|
| 8 |
+
* @template T
|
| 9 |
+
* @param {T[] | ArrayLike<T>} array - The array to modify.
|
| 10 |
+
* @param {T[] | ArrayLike<T>} values - The values to remove from the array.
|
| 11 |
+
* @param {(a: T, b: T) => boolean} comparator - The function to compare elements of `array` with elements of `values`. Should return `true` if the two elements are considered equal.
|
| 12 |
+
* @returns {T[] | ArrayLike<T>} - The array with specified values removed.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* import pullAllWith from './pullAllWith';
|
| 16 |
+
* import isEqual from '../predicate';
|
| 17 |
+
*
|
| 18 |
+
* const array = [{ x: 1, y: 2 }, { x: 3, y: 4 }, { x: 5, y: 6 }];
|
| 19 |
+
* const valuesToRemove = [{ x: 3, y: 4 }];
|
| 20 |
+
*
|
| 21 |
+
* const result = pullAllWith(array, valuesToRemove, isEqual);
|
| 22 |
+
*
|
| 23 |
+
* console.log(result); // [{ x: 1, y: 2 }, { x: 5, y: 6 }]
|
| 24 |
+
* console.log(array); // [{ x: 1, y: 2 }, { x: 5, y: 6 }]
|
| 25 |
+
*/
|
| 26 |
+
function pullAllWith(array, values, comparator) {
|
| 27 |
+
if (array?.length == null || values?.length == null) return array;
|
| 28 |
+
if (array === values) values = copyArray(values);
|
| 29 |
+
let resultLength = 0;
|
| 30 |
+
if (comparator == null) comparator = (a, b) => isEqualsSameValueZero(a, b);
|
| 31 |
+
const valuesArray = Array.isArray(values) ? values : Array.from(values);
|
| 32 |
+
const hasUndefined = valuesArray.includes(void 0);
|
| 33 |
+
for (let i = 0; i < array.length; i++) {
|
| 34 |
+
if (i in array) {
|
| 35 |
+
if (!valuesArray.some((value) => comparator(array[i], value))) array[resultLength++] = array[i];
|
| 36 |
+
continue;
|
| 37 |
+
}
|
| 38 |
+
if (!hasUndefined) delete array[resultLength++];
|
| 39 |
+
}
|
| 40 |
+
array.length = resultLength;
|
| 41 |
+
return array;
|
| 42 |
+
}
|
| 43 |
+
//#endregion
|
| 44 |
+
export { pullAllWith };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/pullAt.d.mts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { MutableList } from "../_internal/MutableList.mjs";
|
| 2 |
+
import { RejectReadonly } from "../_internal/RejectReadonly.mjs";
|
| 3 |
+
import { Many } from "../_internal/Many.mjs";
|
| 4 |
+
|
| 5 |
+
//#region src/compat/array/pullAt.d.ts
|
| 6 |
+
/**
|
| 7 |
+
* Removes elements from array corresponding to the given indexes and returns an array of the removed elements.
|
| 8 |
+
* Indexes may be specified as an array of indexes or as individual arguments.
|
| 9 |
+
*
|
| 10 |
+
* **Note:** Unlike `_.at`, this method mutates `array`.
|
| 11 |
+
*
|
| 12 |
+
* @template T
|
| 13 |
+
* @param {T[]} array - The array to modify.
|
| 14 |
+
* @param {...Array<number | number[]>} indexes - The indexes of elements to remove, specified as individual indexes or arrays of indexes.
|
| 15 |
+
* @returns {T[]} Returns the new array of removed elements.
|
| 16 |
+
*
|
| 17 |
+
* @example
|
| 18 |
+
* var array = [5, 10, 15, 20];
|
| 19 |
+
* var evens = pullAt(array, 1, 3);
|
| 20 |
+
*
|
| 21 |
+
* console.log(array);
|
| 22 |
+
* // => [5, 15]
|
| 23 |
+
*
|
| 24 |
+
* console.log(evens);
|
| 25 |
+
* // => [10, 20]
|
| 26 |
+
*/
|
| 27 |
+
declare function pullAt<T>(array: T[], ...indexes: Array<Many<number>>): T[];
|
| 28 |
+
/**
|
| 29 |
+
* Removes elements from array corresponding to the given indexes and returns an array of the removed elements.
|
| 30 |
+
* Indexes may be specified as an array of indexes or as individual arguments.
|
| 31 |
+
*
|
| 32 |
+
* **Note:** Unlike `_.at`, this method mutates `array`.
|
| 33 |
+
*
|
| 34 |
+
* @template L
|
| 35 |
+
* @param {L} array - The array to modify.
|
| 36 |
+
* @param {...Array<number | number[]>} indexes - The indexes of elements to remove, specified as individual indexes or arrays of indexes.
|
| 37 |
+
* @returns {L} Returns the new array of removed elements.
|
| 38 |
+
*
|
| 39 |
+
* @example
|
| 40 |
+
* var array = [5, 10, 15, 20];
|
| 41 |
+
* var evens = pullAt(array, 1, 3);
|
| 42 |
+
*
|
| 43 |
+
* console.log(array);
|
| 44 |
+
* // => [5, 15]
|
| 45 |
+
*
|
| 46 |
+
* console.log(evens);
|
| 47 |
+
* // => [10, 20]
|
| 48 |
+
*/
|
| 49 |
+
declare function pullAt<L extends MutableList<any>>(array: RejectReadonly<L>, ...indexes: Array<Many<number>>): L;
|
| 50 |
+
//#endregion
|
| 51 |
+
export { pullAt };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/pullAt.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { MutableList } from "../_internal/MutableList.js";
|
| 2 |
+
import { RejectReadonly } from "../_internal/RejectReadonly.js";
|
| 3 |
+
import { Many } from "../_internal/Many.js";
|
| 4 |
+
|
| 5 |
+
//#region src/compat/array/pullAt.d.ts
|
| 6 |
+
/**
|
| 7 |
+
* Removes elements from array corresponding to the given indexes and returns an array of the removed elements.
|
| 8 |
+
* Indexes may be specified as an array of indexes or as individual arguments.
|
| 9 |
+
*
|
| 10 |
+
* **Note:** Unlike `_.at`, this method mutates `array`.
|
| 11 |
+
*
|
| 12 |
+
* @template T
|
| 13 |
+
* @param {T[]} array - The array to modify.
|
| 14 |
+
* @param {...Array<number | number[]>} indexes - The indexes of elements to remove, specified as individual indexes or arrays of indexes.
|
| 15 |
+
* @returns {T[]} Returns the new array of removed elements.
|
| 16 |
+
*
|
| 17 |
+
* @example
|
| 18 |
+
* var array = [5, 10, 15, 20];
|
| 19 |
+
* var evens = pullAt(array, 1, 3);
|
| 20 |
+
*
|
| 21 |
+
* console.log(array);
|
| 22 |
+
* // => [5, 15]
|
| 23 |
+
*
|
| 24 |
+
* console.log(evens);
|
| 25 |
+
* // => [10, 20]
|
| 26 |
+
*/
|
| 27 |
+
declare function pullAt<T>(array: T[], ...indexes: Array<Many<number>>): T[];
|
| 28 |
+
/**
|
| 29 |
+
* Removes elements from array corresponding to the given indexes and returns an array of the removed elements.
|
| 30 |
+
* Indexes may be specified as an array of indexes or as individual arguments.
|
| 31 |
+
*
|
| 32 |
+
* **Note:** Unlike `_.at`, this method mutates `array`.
|
| 33 |
+
*
|
| 34 |
+
* @template L
|
| 35 |
+
* @param {L} array - The array to modify.
|
| 36 |
+
* @param {...Array<number | number[]>} indexes - The indexes of elements to remove, specified as individual indexes or arrays of indexes.
|
| 37 |
+
* @returns {L} Returns the new array of removed elements.
|
| 38 |
+
*
|
| 39 |
+
* @example
|
| 40 |
+
* var array = [5, 10, 15, 20];
|
| 41 |
+
* var evens = pullAt(array, 1, 3);
|
| 42 |
+
*
|
| 43 |
+
* console.log(array);
|
| 44 |
+
* // => [5, 15]
|
| 45 |
+
*
|
| 46 |
+
* console.log(evens);
|
| 47 |
+
* // => [10, 20]
|
| 48 |
+
*/
|
| 49 |
+
declare function pullAt<L extends MutableList<any>>(array: RejectReadonly<L>, ...indexes: Array<Many<number>>): L;
|
| 50 |
+
//#endregion
|
| 51 |
+
export { pullAt };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/pullAt.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_isArray = require("../predicate/isArray.js");
|
| 2 |
+
const require_toKey = require("../_internal/toKey.js");
|
| 3 |
+
const require_toPath = require("../util/toPath.js");
|
| 4 |
+
const require_isIndex = require("../_internal/isIndex.js");
|
| 5 |
+
const require_flattenDepth = require("./flattenDepth.js");
|
| 6 |
+
const require_isKey = require("../_internal/isKey.js");
|
| 7 |
+
const require_at = require("../object/at.js");
|
| 8 |
+
const require_unset = require("../object/unset.js");
|
| 9 |
+
//#region src/compat/array/pullAt.ts
|
| 10 |
+
/**
|
| 11 |
+
* Removes elements from an array at specified indices and returns the removed elements.
|
| 12 |
+
*
|
| 13 |
+
* @template T
|
| 14 |
+
* @param {ArrayLike<T>} array - The array from which elements will be removed.
|
| 15 |
+
* @param {Array<number | readonly number[] | string | readonly string[]>} _indices - An array of indices specifying the positions of elements to remove.
|
| 16 |
+
* @returns {ArrayLike<T>} An array containing the elements that were removed from the original array.
|
| 17 |
+
*
|
| 18 |
+
* @example
|
| 19 |
+
* const numbers = [10, 20, 30, 40, 50];
|
| 20 |
+
* const removed = pullAt(numbers, [1, 3, 4]);
|
| 21 |
+
* console.log(removed); // [20, 40, 50]
|
| 22 |
+
* console.log(numbers); // [10, 30]
|
| 23 |
+
*/
|
| 24 |
+
function pullAt(array, ..._indices) {
|
| 25 |
+
const indices = require_flattenDepth.flattenDepth(_indices, 1);
|
| 26 |
+
if (!array) return Array(indices.length);
|
| 27 |
+
const result = require_at.at(array, indices);
|
| 28 |
+
const indicesToPull = indices.map((index) => require_isIndex.isIndex(index, array.length) ? Number(index) : index).sort((a, b) => b - a);
|
| 29 |
+
for (const index of new Set(indicesToPull)) {
|
| 30 |
+
if (require_isIndex.isIndex(index, array.length)) {
|
| 31 |
+
Array.prototype.splice.call(array, index, 1);
|
| 32 |
+
continue;
|
| 33 |
+
}
|
| 34 |
+
if (require_isKey.isKey(index, array)) {
|
| 35 |
+
delete array[require_toKey.toKey(index)];
|
| 36 |
+
continue;
|
| 37 |
+
}
|
| 38 |
+
const path = require_isArray.isArray(index) ? index : require_toPath.toPath(index);
|
| 39 |
+
require_unset.unset(array, path);
|
| 40 |
+
}
|
| 41 |
+
return result;
|
| 42 |
+
}
|
| 43 |
+
//#endregion
|
| 44 |
+
exports.pullAt = pullAt;
|
tools/ui/node_modules/es-toolkit/dist/compat/array/pullAt.mjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { isArray } from "../predicate/isArray.mjs";
|
| 2 |
+
import { toKey } from "../_internal/toKey.mjs";
|
| 3 |
+
import { toPath } from "../util/toPath.mjs";
|
| 4 |
+
import { isIndex } from "../_internal/isIndex.mjs";
|
| 5 |
+
import { flattenDepth } from "./flattenDepth.mjs";
|
| 6 |
+
import { isKey } from "../_internal/isKey.mjs";
|
| 7 |
+
import { at } from "../object/at.mjs";
|
| 8 |
+
import { unset } from "../object/unset.mjs";
|
| 9 |
+
//#region src/compat/array/pullAt.ts
|
| 10 |
+
/**
|
| 11 |
+
* Removes elements from an array at specified indices and returns the removed elements.
|
| 12 |
+
*
|
| 13 |
+
* @template T
|
| 14 |
+
* @param {ArrayLike<T>} array - The array from which elements will be removed.
|
| 15 |
+
* @param {Array<number | readonly number[] | string | readonly string[]>} _indices - An array of indices specifying the positions of elements to remove.
|
| 16 |
+
* @returns {ArrayLike<T>} An array containing the elements that were removed from the original array.
|
| 17 |
+
*
|
| 18 |
+
* @example
|
| 19 |
+
* const numbers = [10, 20, 30, 40, 50];
|
| 20 |
+
* const removed = pullAt(numbers, [1, 3, 4]);
|
| 21 |
+
* console.log(removed); // [20, 40, 50]
|
| 22 |
+
* console.log(numbers); // [10, 30]
|
| 23 |
+
*/
|
| 24 |
+
function pullAt(array, ..._indices) {
|
| 25 |
+
const indices = flattenDepth(_indices, 1);
|
| 26 |
+
if (!array) return Array(indices.length);
|
| 27 |
+
const result = at(array, indices);
|
| 28 |
+
const indicesToPull = indices.map((index) => isIndex(index, array.length) ? Number(index) : index).sort((a, b) => b - a);
|
| 29 |
+
for (const index of new Set(indicesToPull)) {
|
| 30 |
+
if (isIndex(index, array.length)) {
|
| 31 |
+
Array.prototype.splice.call(array, index, 1);
|
| 32 |
+
continue;
|
| 33 |
+
}
|
| 34 |
+
if (isKey(index, array)) {
|
| 35 |
+
delete array[toKey(index)];
|
| 36 |
+
continue;
|
| 37 |
+
}
|
| 38 |
+
unset(array, isArray(index) ? index : toPath(index));
|
| 39 |
+
}
|
| 40 |
+
return result;
|
| 41 |
+
}
|
| 42 |
+
//#endregion
|
| 43 |
+
export { pullAt };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/reduce.d.mts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { MemoListIterator } from "../_internal/MemoListIterator.mjs";
|
| 2 |
+
import { MemoObjectIterator } from "../_internal/MemoObjectIterator.mjs";
|
| 3 |
+
|
| 4 |
+
//#region src/compat/array/reduce.d.ts
|
| 5 |
+
/**
|
| 6 |
+
* Reduces an array to a single value using an iteratee function.
|
| 7 |
+
*
|
| 8 |
+
* @param {T[] | null | undefined} collection - The array to iterate over
|
| 9 |
+
* @param {MemoListIterator<T, U, T[]>} callback - The function invoked per iteration
|
| 10 |
+
* @param {U} accumulator - The initial value
|
| 11 |
+
* @returns {U} Returns the accumulated value
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* const array = [1, 2, 3];
|
| 15 |
+
* reduce(array, (acc, value) => acc + value, 0); // => 6
|
| 16 |
+
*/
|
| 17 |
+
declare function reduce<T, U>(collection: T[] | null | undefined, callback: MemoListIterator<T, U, T[]>, accumulator: U): U;
|
| 18 |
+
/**
|
| 19 |
+
* Reduces an array-like object to a single value using an iteratee function.
|
| 20 |
+
*
|
| 21 |
+
* @param {ArrayLike<T> | null | undefined} collection - The array-like object to iterate over
|
| 22 |
+
* @param {MemoListIterator<T, U, ArrayLike<T>>} callback - The function invoked per iteration
|
| 23 |
+
* @param {U} accumulator - The initial value
|
| 24 |
+
* @returns {U} Returns the accumulated value
|
| 25 |
+
*
|
| 26 |
+
* @example
|
| 27 |
+
* const arrayLike = {0: 1, 1: 2, 2: 3, length: 3};
|
| 28 |
+
* reduce(arrayLike, (acc, value) => acc + value, 0); // => 6
|
| 29 |
+
*/
|
| 30 |
+
declare function reduce<T, U>(collection: ArrayLike<T> | null | undefined, callback: MemoListIterator<T, U, ArrayLike<T>>, accumulator: U): U;
|
| 31 |
+
/**
|
| 32 |
+
* Reduces an object to a single value using an iteratee function.
|
| 33 |
+
*
|
| 34 |
+
* @param {T | null | undefined} collection - The object to iterate over
|
| 35 |
+
* @param {MemoObjectIterator<T[keyof T], U, T>} callback - The function invoked per iteration
|
| 36 |
+
* @param {U} accumulator - The initial value
|
| 37 |
+
* @returns {U} Returns the accumulated value
|
| 38 |
+
*
|
| 39 |
+
* @example
|
| 40 |
+
* const obj = { a: 1, b: 2, c: 3 };
|
| 41 |
+
* reduce(obj, (acc, value) => acc + value, 0); // => 6
|
| 42 |
+
*/
|
| 43 |
+
declare function reduce<T extends object, U>(collection: T | null | undefined, callback: MemoObjectIterator<T[keyof T], U, T>, accumulator: U): U;
|
| 44 |
+
/**
|
| 45 |
+
* Reduces an array to a single value using an iteratee function.
|
| 46 |
+
*
|
| 47 |
+
* @param {T[] | null | undefined} collection - The array to iterate over
|
| 48 |
+
* @param {MemoListIterator<T, T, T[]>} callback - The function invoked per iteration
|
| 49 |
+
* @returns {T | undefined} Returns the accumulated value
|
| 50 |
+
*
|
| 51 |
+
* @example
|
| 52 |
+
* const array = [1, 2, 3];
|
| 53 |
+
* reduce(array, (acc, value) => acc + value); // => 6
|
| 54 |
+
*/
|
| 55 |
+
declare function reduce<T>(collection: T[] | null | undefined, callback: MemoListIterator<T, T, T[]>): T | undefined;
|
| 56 |
+
/**
|
| 57 |
+
* Reduces an array-like object to a single value using an iteratee function.
|
| 58 |
+
*
|
| 59 |
+
* @param {ArrayLike<T> | null | undefined} collection - The array-like object to iterate over
|
| 60 |
+
* @param {MemoListIterator<T, T, ArrayLike<T>>} callback - The function invoked per iteration
|
| 61 |
+
* @returns {T | undefined} Returns the accumulated value
|
| 62 |
+
*
|
| 63 |
+
* @example
|
| 64 |
+
* const arrayLike = {0: 1, 1: 2, 2: 3, length: 3};
|
| 65 |
+
* reduce(arrayLike, (acc, value) => acc + value); // => 6
|
| 66 |
+
*/
|
| 67 |
+
declare function reduce<T>(collection: ArrayLike<T> | null | undefined, callback: MemoListIterator<T, T, ArrayLike<T>>): T | undefined;
|
| 68 |
+
/**
|
| 69 |
+
* Reduces an object to a single value using an iteratee function.
|
| 70 |
+
*
|
| 71 |
+
* @param {T | null | undefined} collection - The object to iterate over
|
| 72 |
+
* @param {MemoObjectIterator<T[keyof T], T[keyof T], T>} callback - The function invoked per iteration
|
| 73 |
+
* @returns {T[keyof T] | undefined} Returns the accumulated value
|
| 74 |
+
*
|
| 75 |
+
* @example
|
| 76 |
+
* const obj = { a: 1, b: 2, c: 3 };
|
| 77 |
+
* reduce(obj, (acc, value) => acc + value); // => 6
|
| 78 |
+
*/
|
| 79 |
+
declare function reduce<T extends object>(collection: T | null | undefined, callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): T[keyof T] | undefined;
|
| 80 |
+
//#endregion
|
| 81 |
+
export { reduce };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/reduce.d.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { MemoListIterator } from "../_internal/MemoListIterator.js";
|
| 2 |
+
import { MemoObjectIterator } from "../_internal/MemoObjectIterator.js";
|
| 3 |
+
|
| 4 |
+
//#region src/compat/array/reduce.d.ts
|
| 5 |
+
/**
|
| 6 |
+
* Reduces an array to a single value using an iteratee function.
|
| 7 |
+
*
|
| 8 |
+
* @param {T[] | null | undefined} collection - The array to iterate over
|
| 9 |
+
* @param {MemoListIterator<T, U, T[]>} callback - The function invoked per iteration
|
| 10 |
+
* @param {U} accumulator - The initial value
|
| 11 |
+
* @returns {U} Returns the accumulated value
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* const array = [1, 2, 3];
|
| 15 |
+
* reduce(array, (acc, value) => acc + value, 0); // => 6
|
| 16 |
+
*/
|
| 17 |
+
declare function reduce<T, U>(collection: T[] | null | undefined, callback: MemoListIterator<T, U, T[]>, accumulator: U): U;
|
| 18 |
+
/**
|
| 19 |
+
* Reduces an array-like object to a single value using an iteratee function.
|
| 20 |
+
*
|
| 21 |
+
* @param {ArrayLike<T> | null | undefined} collection - The array-like object to iterate over
|
| 22 |
+
* @param {MemoListIterator<T, U, ArrayLike<T>>} callback - The function invoked per iteration
|
| 23 |
+
* @param {U} accumulator - The initial value
|
| 24 |
+
* @returns {U} Returns the accumulated value
|
| 25 |
+
*
|
| 26 |
+
* @example
|
| 27 |
+
* const arrayLike = {0: 1, 1: 2, 2: 3, length: 3};
|
| 28 |
+
* reduce(arrayLike, (acc, value) => acc + value, 0); // => 6
|
| 29 |
+
*/
|
| 30 |
+
declare function reduce<T, U>(collection: ArrayLike<T> | null | undefined, callback: MemoListIterator<T, U, ArrayLike<T>>, accumulator: U): U;
|
| 31 |
+
/**
|
| 32 |
+
* Reduces an object to a single value using an iteratee function.
|
| 33 |
+
*
|
| 34 |
+
* @param {T | null | undefined} collection - The object to iterate over
|
| 35 |
+
* @param {MemoObjectIterator<T[keyof T], U, T>} callback - The function invoked per iteration
|
| 36 |
+
* @param {U} accumulator - The initial value
|
| 37 |
+
* @returns {U} Returns the accumulated value
|
| 38 |
+
*
|
| 39 |
+
* @example
|
| 40 |
+
* const obj = { a: 1, b: 2, c: 3 };
|
| 41 |
+
* reduce(obj, (acc, value) => acc + value, 0); // => 6
|
| 42 |
+
*/
|
| 43 |
+
declare function reduce<T extends object, U>(collection: T | null | undefined, callback: MemoObjectIterator<T[keyof T], U, T>, accumulator: U): U;
|
| 44 |
+
/**
|
| 45 |
+
* Reduces an array to a single value using an iteratee function.
|
| 46 |
+
*
|
| 47 |
+
* @param {T[] | null | undefined} collection - The array to iterate over
|
| 48 |
+
* @param {MemoListIterator<T, T, T[]>} callback - The function invoked per iteration
|
| 49 |
+
* @returns {T | undefined} Returns the accumulated value
|
| 50 |
+
*
|
| 51 |
+
* @example
|
| 52 |
+
* const array = [1, 2, 3];
|
| 53 |
+
* reduce(array, (acc, value) => acc + value); // => 6
|
| 54 |
+
*/
|
| 55 |
+
declare function reduce<T>(collection: T[] | null | undefined, callback: MemoListIterator<T, T, T[]>): T | undefined;
|
| 56 |
+
/**
|
| 57 |
+
* Reduces an array-like object to a single value using an iteratee function.
|
| 58 |
+
*
|
| 59 |
+
* @param {ArrayLike<T> | null | undefined} collection - The array-like object to iterate over
|
| 60 |
+
* @param {MemoListIterator<T, T, ArrayLike<T>>} callback - The function invoked per iteration
|
| 61 |
+
* @returns {T | undefined} Returns the accumulated value
|
| 62 |
+
*
|
| 63 |
+
* @example
|
| 64 |
+
* const arrayLike = {0: 1, 1: 2, 2: 3, length: 3};
|
| 65 |
+
* reduce(arrayLike, (acc, value) => acc + value); // => 6
|
| 66 |
+
*/
|
| 67 |
+
declare function reduce<T>(collection: ArrayLike<T> | null | undefined, callback: MemoListIterator<T, T, ArrayLike<T>>): T | undefined;
|
| 68 |
+
/**
|
| 69 |
+
* Reduces an object to a single value using an iteratee function.
|
| 70 |
+
*
|
| 71 |
+
* @param {T | null | undefined} collection - The object to iterate over
|
| 72 |
+
* @param {MemoObjectIterator<T[keyof T], T[keyof T], T>} callback - The function invoked per iteration
|
| 73 |
+
* @returns {T[keyof T] | undefined} Returns the accumulated value
|
| 74 |
+
*
|
| 75 |
+
* @example
|
| 76 |
+
* const obj = { a: 1, b: 2, c: 3 };
|
| 77 |
+
* reduce(obj, (acc, value) => acc + value); // => 6
|
| 78 |
+
*/
|
| 79 |
+
declare function reduce<T extends object>(collection: T | null | undefined, callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): T[keyof T] | undefined;
|
| 80 |
+
//#endregion
|
| 81 |
+
export { reduce };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/reduce.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_identity = require("../../function/identity.js");
|
| 2 |
+
const require_range = require("../../math/range.js");
|
| 3 |
+
const require_isArrayLike = require("../predicate/isArrayLike.js");
|
| 4 |
+
//#region src/compat/array/reduce.ts
|
| 5 |
+
/**
|
| 6 |
+
* Reduces a collection to a single value using an iteratee function.
|
| 7 |
+
*
|
| 8 |
+
* @param {T[] | ArrayLike<T> | Record<string, T> | null | undefined} collection - The collection to iterate over.
|
| 9 |
+
* @param {((accumulator: any, value: any, index: PropertyKey, collection: any) => any) | PropertyKey | object} iteratee - The function invoked per iteration or the key to reduce over.
|
| 10 |
+
* @param {any} initialValue - The initial value.
|
| 11 |
+
* @returns {any} - Returns the accumulated value.
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* // Using a reducer function
|
| 15 |
+
* const array = [1, 2, 3];
|
| 16 |
+
* reduce(array, (acc, value) => acc + value, 0); // => 6
|
| 17 |
+
*
|
| 18 |
+
* @example
|
| 19 |
+
* // Using a reducer function with initialValue
|
| 20 |
+
* const array = [1, 2, 3];
|
| 21 |
+
* reduce(array, (acc, value) => acc + value % 2 === 0, true); // => false
|
| 22 |
+
*
|
| 23 |
+
* @example
|
| 24 |
+
* // Using an object as the collection
|
| 25 |
+
* const obj = { a: 1, b: 2, c: 3 };
|
| 26 |
+
* reduce(obj, (acc, value) => acc + value, 0); // => 6
|
| 27 |
+
*/
|
| 28 |
+
function reduce(collection, iteratee = require_identity.identity, accumulator) {
|
| 29 |
+
if (!collection) return accumulator;
|
| 30 |
+
let keys;
|
| 31 |
+
let startIndex = 0;
|
| 32 |
+
if (require_isArrayLike.isArrayLike(collection)) {
|
| 33 |
+
keys = require_range.range(0, collection.length);
|
| 34 |
+
if (accumulator == null && collection.length > 0) {
|
| 35 |
+
accumulator = collection[0];
|
| 36 |
+
startIndex += 1;
|
| 37 |
+
}
|
| 38 |
+
} else {
|
| 39 |
+
keys = Object.keys(collection);
|
| 40 |
+
if (accumulator == null) {
|
| 41 |
+
accumulator = collection[keys[0]];
|
| 42 |
+
startIndex += 1;
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
for (let i = startIndex; i < keys.length; i++) {
|
| 46 |
+
const key = keys[i];
|
| 47 |
+
const value = collection[key];
|
| 48 |
+
accumulator = iteratee(accumulator, value, key, collection);
|
| 49 |
+
}
|
| 50 |
+
return accumulator;
|
| 51 |
+
}
|
| 52 |
+
//#endregion
|
| 53 |
+
exports.reduce = reduce;
|
tools/ui/node_modules/es-toolkit/dist/compat/array/reduce.mjs
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { identity } from "../../function/identity.mjs";
|
| 2 |
+
import { range } from "../../math/range.mjs";
|
| 3 |
+
import { isArrayLike } from "../predicate/isArrayLike.mjs";
|
| 4 |
+
//#region src/compat/array/reduce.ts
|
| 5 |
+
/**
|
| 6 |
+
* Reduces a collection to a single value using an iteratee function.
|
| 7 |
+
*
|
| 8 |
+
* @param {T[] | ArrayLike<T> | Record<string, T> | null | undefined} collection - The collection to iterate over.
|
| 9 |
+
* @param {((accumulator: any, value: any, index: PropertyKey, collection: any) => any) | PropertyKey | object} iteratee - The function invoked per iteration or the key to reduce over.
|
| 10 |
+
* @param {any} initialValue - The initial value.
|
| 11 |
+
* @returns {any} - Returns the accumulated value.
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* // Using a reducer function
|
| 15 |
+
* const array = [1, 2, 3];
|
| 16 |
+
* reduce(array, (acc, value) => acc + value, 0); // => 6
|
| 17 |
+
*
|
| 18 |
+
* @example
|
| 19 |
+
* // Using a reducer function with initialValue
|
| 20 |
+
* const array = [1, 2, 3];
|
| 21 |
+
* reduce(array, (acc, value) => acc + value % 2 === 0, true); // => false
|
| 22 |
+
*
|
| 23 |
+
* @example
|
| 24 |
+
* // Using an object as the collection
|
| 25 |
+
* const obj = { a: 1, b: 2, c: 3 };
|
| 26 |
+
* reduce(obj, (acc, value) => acc + value, 0); // => 6
|
| 27 |
+
*/
|
| 28 |
+
function reduce(collection, iteratee = identity, accumulator) {
|
| 29 |
+
if (!collection) return accumulator;
|
| 30 |
+
let keys;
|
| 31 |
+
let startIndex = 0;
|
| 32 |
+
if (isArrayLike(collection)) {
|
| 33 |
+
keys = range(0, collection.length);
|
| 34 |
+
if (accumulator == null && collection.length > 0) {
|
| 35 |
+
accumulator = collection[0];
|
| 36 |
+
startIndex += 1;
|
| 37 |
+
}
|
| 38 |
+
} else {
|
| 39 |
+
keys = Object.keys(collection);
|
| 40 |
+
if (accumulator == null) {
|
| 41 |
+
accumulator = collection[keys[0]];
|
| 42 |
+
startIndex += 1;
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
for (let i = startIndex; i < keys.length; i++) {
|
| 46 |
+
const key = keys[i];
|
| 47 |
+
const value = collection[key];
|
| 48 |
+
accumulator = iteratee(accumulator, value, key, collection);
|
| 49 |
+
}
|
| 50 |
+
return accumulator;
|
| 51 |
+
}
|
| 52 |
+
//#endregion
|
| 53 |
+
export { reduce };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/reduceRight.d.mts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { MemoListIterator } from "../_internal/MemoListIterator.mjs";
|
| 2 |
+
import { MemoObjectIterator } from "../_internal/MemoObjectIterator.mjs";
|
| 3 |
+
|
| 4 |
+
//#region src/compat/array/reduceRight.d.ts
|
| 5 |
+
/**
|
| 6 |
+
* Reduces an array to a single value using an iteratee function, starting from the right.
|
| 7 |
+
*
|
| 8 |
+
* The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one.
|
| 9 |
+
* This function takes the result of the previous step and the current element to perform a calculation.
|
| 10 |
+
* After going through all the elements, the function gives you one final result.
|
| 11 |
+
*
|
| 12 |
+
* When the `reduceRight()` function starts, there's no previous result to use.
|
| 13 |
+
* If you provide an initial value, it starts with that.
|
| 14 |
+
* If not, it uses the last element of the array and begins with the second to last element for the calculation.
|
| 15 |
+
*
|
| 16 |
+
* The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one.
|
| 17 |
+
* This function takes the result of the previous step and the current element to perform a calculation.
|
| 18 |
+
* After going through all the elements, the function gives you one final result.
|
| 19 |
+
*
|
| 20 |
+
* When the `reduceRight()` function starts, there's no previous result to use.
|
| 21 |
+
* If you provide an initial value, it starts with that.
|
| 22 |
+
* If not, it uses the last element of the array and begins with the second to last element for the calculation.
|
| 23 |
+
*
|
| 24 |
+
* @template T, U
|
| 25 |
+
* @param {T[] | null | undefined} collection - The array to iterate over.
|
| 26 |
+
* @param {MemoListIterator<T, U, T[]>} callback - The function invoked per iteration.
|
| 27 |
+
* @param {U} accumulator - The initial value.
|
| 28 |
+
* @returns {U} Returns the accumulated value.
|
| 29 |
+
*
|
| 30 |
+
* @example
|
| 31 |
+
* reduceRight([1, 2, 3], (acc, value) => acc + value, 0);
|
| 32 |
+
* // => 6
|
| 33 |
+
*/
|
| 34 |
+
declare function reduceRight<T, U>(collection: T[] | null | undefined, callback: MemoListIterator<T, U, T[]>, accumulator: U): U;
|
| 35 |
+
/**
|
| 36 |
+
* Reduces an array-like collection to a single value using an iteratee function, starting from the right.
|
| 37 |
+
*
|
| 38 |
+
* @template T, U
|
| 39 |
+
* @param {ArrayLike<T> | null | undefined} collection - The array-like collection to iterate over.
|
| 40 |
+
* @param {MemoListIterator<T, U, ArrayLike<T>>} callback - The function invoked per iteration.
|
| 41 |
+
* @param {U} accumulator - The initial value.
|
| 42 |
+
* @returns {U} Returns the accumulated value.
|
| 43 |
+
*
|
| 44 |
+
* @example
|
| 45 |
+
* reduceRight([1, 2, 3], (acc, value) => acc + value, 0);
|
| 46 |
+
* // => 6
|
| 47 |
+
*/
|
| 48 |
+
declare function reduceRight<T, U>(collection: ArrayLike<T> | null | undefined, callback: MemoListIterator<T, U, ArrayLike<T>>, accumulator: U): U;
|
| 49 |
+
/**
|
| 50 |
+
* Reduces an object to a single value using an iteratee function, starting from the right.
|
| 51 |
+
*
|
| 52 |
+
* @template T, U
|
| 53 |
+
* @param {T | null | undefined} collection - The object to iterate over.
|
| 54 |
+
* @param {MemoObjectIterator<T[keyof T], U, T>} callback - The function invoked per iteration.
|
| 55 |
+
* @param {U} accumulator - The initial value.
|
| 56 |
+
* @returns {U} Returns the accumulated value.
|
| 57 |
+
*
|
| 58 |
+
* @example
|
| 59 |
+
* reduceRight({ a: 1, b: 2, c: 3 }, (acc, value) => acc + value, 0);
|
| 60 |
+
* // => 6
|
| 61 |
+
*/
|
| 62 |
+
declare function reduceRight<T extends object, U>(collection: T | null | undefined, callback: MemoObjectIterator<T[keyof T], U, T>, accumulator: U): U;
|
| 63 |
+
/**
|
| 64 |
+
* Reduces an array to a single value using an iteratee function, starting from the right.
|
| 65 |
+
*
|
| 66 |
+
* The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one.
|
| 67 |
+
* This function takes the result of the previous step and the current element to perform a calculation.
|
| 68 |
+
* After going through all the elements, the function gives you one final result.
|
| 69 |
+
*
|
| 70 |
+
* When the `reduceRight()` function starts, there's no previous result to use.
|
| 71 |
+
* If you provide an initial value, it starts with that.
|
| 72 |
+
* If not, it uses the last element of the array and begins with the second to last element for the calculation.
|
| 73 |
+
*
|
| 74 |
+
* The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one.
|
| 75 |
+
* This function takes the result of the previous step and the current element to perform a calculation.
|
| 76 |
+
* After going through all the elements, the function gives you one final result.
|
| 77 |
+
*
|
| 78 |
+
* When the `reduceRight()` function starts, there's no previous result to use.
|
| 79 |
+
* If you provide an initial value, it starts with that.
|
| 80 |
+
* If not, it uses the last element of the array and begins with the second to last element for the calculation.
|
| 81 |
+
*
|
| 82 |
+
* @template T
|
| 83 |
+
* @param {T[] | null | undefined} collection - The array to iterate over.
|
| 84 |
+
* @param {MemoListIterator<T, T, T[]>} callback - The function invoked per iteration.
|
| 85 |
+
* @returns {T | undefined} Returns the accumulated value.
|
| 86 |
+
*
|
| 87 |
+
* @example
|
| 88 |
+
* reduceRight([1, 2, 3], (acc, value) => acc + value);
|
| 89 |
+
* // => 6
|
| 90 |
+
*/
|
| 91 |
+
declare function reduceRight<T>(collection: T[] | null | undefined, callback: MemoListIterator<T, T, T[]>): T | undefined;
|
| 92 |
+
/**
|
| 93 |
+
* Reduces an array-like collection to a single value using an iteratee function, starting from the right.
|
| 94 |
+
*
|
| 95 |
+
* @template T
|
| 96 |
+
* @param {ArrayLike<T> | null | undefined} collection - The array-like collection to iterate over.
|
| 97 |
+
* @param {MemoListIterator<T, T, ArrayLike<T>>} callback - The function invoked per iteration.
|
| 98 |
+
* @returns {T | undefined} Returns the accumulated value.
|
| 99 |
+
*
|
| 100 |
+
* @example
|
| 101 |
+
* reduceRight([1, 2, 3], (acc, value) => acc + value);
|
| 102 |
+
* // => 6
|
| 103 |
+
*/
|
| 104 |
+
declare function reduceRight<T>(collection: ArrayLike<T> | null | undefined, callback: MemoListIterator<T, T, ArrayLike<T>>): T | undefined;
|
| 105 |
+
/**
|
| 106 |
+
* Reduces an object to a single value using an iteratee function, starting from the right.
|
| 107 |
+
*
|
| 108 |
+
* @template T
|
| 109 |
+
* @param {T | null | undefined} collection - The object to iterate over.
|
| 110 |
+
* @param {MemoObjectIterator<T[keyof T], T[keyof T], T>} callback - The function invoked per iteration.
|
| 111 |
+
* @returns {T[keyof T] | undefined} Returns the accumulated value.
|
| 112 |
+
*
|
| 113 |
+
* @example
|
| 114 |
+
* reduceRight({ a: 1, b: 2, c: 3 }, (acc, value) => acc + value);
|
| 115 |
+
* // => 6
|
| 116 |
+
*/
|
| 117 |
+
declare function reduceRight<T extends object>(collection: T | null | undefined, callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): T[keyof T] | undefined;
|
| 118 |
+
//#endregion
|
| 119 |
+
export { reduceRight };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/reduceRight.d.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { MemoListIterator } from "../_internal/MemoListIterator.js";
|
| 2 |
+
import { MemoObjectIterator } from "../_internal/MemoObjectIterator.js";
|
| 3 |
+
|
| 4 |
+
//#region src/compat/array/reduceRight.d.ts
|
| 5 |
+
/**
|
| 6 |
+
* Reduces an array to a single value using an iteratee function, starting from the right.
|
| 7 |
+
*
|
| 8 |
+
* The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one.
|
| 9 |
+
* This function takes the result of the previous step and the current element to perform a calculation.
|
| 10 |
+
* After going through all the elements, the function gives you one final result.
|
| 11 |
+
*
|
| 12 |
+
* When the `reduceRight()` function starts, there's no previous result to use.
|
| 13 |
+
* If you provide an initial value, it starts with that.
|
| 14 |
+
* If not, it uses the last element of the array and begins with the second to last element for the calculation.
|
| 15 |
+
*
|
| 16 |
+
* The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one.
|
| 17 |
+
* This function takes the result of the previous step and the current element to perform a calculation.
|
| 18 |
+
* After going through all the elements, the function gives you one final result.
|
| 19 |
+
*
|
| 20 |
+
* When the `reduceRight()` function starts, there's no previous result to use.
|
| 21 |
+
* If you provide an initial value, it starts with that.
|
| 22 |
+
* If not, it uses the last element of the array and begins with the second to last element for the calculation.
|
| 23 |
+
*
|
| 24 |
+
* @template T, U
|
| 25 |
+
* @param {T[] | null | undefined} collection - The array to iterate over.
|
| 26 |
+
* @param {MemoListIterator<T, U, T[]>} callback - The function invoked per iteration.
|
| 27 |
+
* @param {U} accumulator - The initial value.
|
| 28 |
+
* @returns {U} Returns the accumulated value.
|
| 29 |
+
*
|
| 30 |
+
* @example
|
| 31 |
+
* reduceRight([1, 2, 3], (acc, value) => acc + value, 0);
|
| 32 |
+
* // => 6
|
| 33 |
+
*/
|
| 34 |
+
declare function reduceRight<T, U>(collection: T[] | null | undefined, callback: MemoListIterator<T, U, T[]>, accumulator: U): U;
|
| 35 |
+
/**
|
| 36 |
+
* Reduces an array-like collection to a single value using an iteratee function, starting from the right.
|
| 37 |
+
*
|
| 38 |
+
* @template T, U
|
| 39 |
+
* @param {ArrayLike<T> | null | undefined} collection - The array-like collection to iterate over.
|
| 40 |
+
* @param {MemoListIterator<T, U, ArrayLike<T>>} callback - The function invoked per iteration.
|
| 41 |
+
* @param {U} accumulator - The initial value.
|
| 42 |
+
* @returns {U} Returns the accumulated value.
|
| 43 |
+
*
|
| 44 |
+
* @example
|
| 45 |
+
* reduceRight([1, 2, 3], (acc, value) => acc + value, 0);
|
| 46 |
+
* // => 6
|
| 47 |
+
*/
|
| 48 |
+
declare function reduceRight<T, U>(collection: ArrayLike<T> | null | undefined, callback: MemoListIterator<T, U, ArrayLike<T>>, accumulator: U): U;
|
| 49 |
+
/**
|
| 50 |
+
* Reduces an object to a single value using an iteratee function, starting from the right.
|
| 51 |
+
*
|
| 52 |
+
* @template T, U
|
| 53 |
+
* @param {T | null | undefined} collection - The object to iterate over.
|
| 54 |
+
* @param {MemoObjectIterator<T[keyof T], U, T>} callback - The function invoked per iteration.
|
| 55 |
+
* @param {U} accumulator - The initial value.
|
| 56 |
+
* @returns {U} Returns the accumulated value.
|
| 57 |
+
*
|
| 58 |
+
* @example
|
| 59 |
+
* reduceRight({ a: 1, b: 2, c: 3 }, (acc, value) => acc + value, 0);
|
| 60 |
+
* // => 6
|
| 61 |
+
*/
|
| 62 |
+
declare function reduceRight<T extends object, U>(collection: T | null | undefined, callback: MemoObjectIterator<T[keyof T], U, T>, accumulator: U): U;
|
| 63 |
+
/**
|
| 64 |
+
* Reduces an array to a single value using an iteratee function, starting from the right.
|
| 65 |
+
*
|
| 66 |
+
* The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one.
|
| 67 |
+
* This function takes the result of the previous step and the current element to perform a calculation.
|
| 68 |
+
* After going through all the elements, the function gives you one final result.
|
| 69 |
+
*
|
| 70 |
+
* When the `reduceRight()` function starts, there's no previous result to use.
|
| 71 |
+
* If you provide an initial value, it starts with that.
|
| 72 |
+
* If not, it uses the last element of the array and begins with the second to last element for the calculation.
|
| 73 |
+
*
|
| 74 |
+
* The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one.
|
| 75 |
+
* This function takes the result of the previous step and the current element to perform a calculation.
|
| 76 |
+
* After going through all the elements, the function gives you one final result.
|
| 77 |
+
*
|
| 78 |
+
* When the `reduceRight()` function starts, there's no previous result to use.
|
| 79 |
+
* If you provide an initial value, it starts with that.
|
| 80 |
+
* If not, it uses the last element of the array and begins with the second to last element for the calculation.
|
| 81 |
+
*
|
| 82 |
+
* @template T
|
| 83 |
+
* @param {T[] | null | undefined} collection - The array to iterate over.
|
| 84 |
+
* @param {MemoListIterator<T, T, T[]>} callback - The function invoked per iteration.
|
| 85 |
+
* @returns {T | undefined} Returns the accumulated value.
|
| 86 |
+
*
|
| 87 |
+
* @example
|
| 88 |
+
* reduceRight([1, 2, 3], (acc, value) => acc + value);
|
| 89 |
+
* // => 6
|
| 90 |
+
*/
|
| 91 |
+
declare function reduceRight<T>(collection: T[] | null | undefined, callback: MemoListIterator<T, T, T[]>): T | undefined;
|
| 92 |
+
/**
|
| 93 |
+
* Reduces an array-like collection to a single value using an iteratee function, starting from the right.
|
| 94 |
+
*
|
| 95 |
+
* @template T
|
| 96 |
+
* @param {ArrayLike<T> | null | undefined} collection - The array-like collection to iterate over.
|
| 97 |
+
* @param {MemoListIterator<T, T, ArrayLike<T>>} callback - The function invoked per iteration.
|
| 98 |
+
* @returns {T | undefined} Returns the accumulated value.
|
| 99 |
+
*
|
| 100 |
+
* @example
|
| 101 |
+
* reduceRight([1, 2, 3], (acc, value) => acc + value);
|
| 102 |
+
* // => 6
|
| 103 |
+
*/
|
| 104 |
+
declare function reduceRight<T>(collection: ArrayLike<T> | null | undefined, callback: MemoListIterator<T, T, ArrayLike<T>>): T | undefined;
|
| 105 |
+
/**
|
| 106 |
+
* Reduces an object to a single value using an iteratee function, starting from the right.
|
| 107 |
+
*
|
| 108 |
+
* @template T
|
| 109 |
+
* @param {T | null | undefined} collection - The object to iterate over.
|
| 110 |
+
* @param {MemoObjectIterator<T[keyof T], T[keyof T], T>} callback - The function invoked per iteration.
|
| 111 |
+
* @returns {T[keyof T] | undefined} Returns the accumulated value.
|
| 112 |
+
*
|
| 113 |
+
* @example
|
| 114 |
+
* reduceRight({ a: 1, b: 2, c: 3 }, (acc, value) => acc + value);
|
| 115 |
+
* // => 6
|
| 116 |
+
*/
|
| 117 |
+
declare function reduceRight<T extends object>(collection: T | null | undefined, callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): T[keyof T] | undefined;
|
| 118 |
+
//#endregion
|
| 119 |
+
export { reduceRight };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/reduceRight.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_identity = require("../../function/identity.js");
|
| 2 |
+
const require_range = require("../../math/range.js");
|
| 3 |
+
const require_isArrayLike = require("../predicate/isArrayLike.js");
|
| 4 |
+
//#region src/compat/array/reduceRight.ts
|
| 5 |
+
/**
|
| 6 |
+
* Reduces a collection to a single value using an iteratee function, starting from the right.
|
| 7 |
+
*
|
| 8 |
+
* @param {T[] | ArrayLike<T> | Record<string, T> | null | undefined} collection - The collection to iterate over.
|
| 9 |
+
* @param {((accumulator: any, value: any, index: PropertyKey, collection: any) => any) | PropertyKey | object} iteratee - The function invoked per iteration or the key to reduce over.
|
| 10 |
+
* @param {any} initialValue - The initial value.
|
| 11 |
+
* @returns {any} - Returns the accumulated value.
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* // Using a reducer function
|
| 15 |
+
* const array = [1, 2, 3];
|
| 16 |
+
* reduceRight(array, (acc, value) => acc + value, 0); // => 6
|
| 17 |
+
*
|
| 18 |
+
* @example
|
| 19 |
+
* // Using a reducer function with initialValue
|
| 20 |
+
* const array = [1, 2, 3];
|
| 21 |
+
* reduceRight(array, (acc, value) => acc + value % 2 === 0, true); // => false
|
| 22 |
+
*
|
| 23 |
+
* @example
|
| 24 |
+
* // Using an object as the collection
|
| 25 |
+
* const obj = { a: 1, b: 2, c: 3 };
|
| 26 |
+
* reduceRight(obj, (acc, value) => acc + value, 0); // => 6
|
| 27 |
+
*/
|
| 28 |
+
function reduceRight(collection, iteratee = require_identity.identity, accumulator) {
|
| 29 |
+
if (!collection) return accumulator;
|
| 30 |
+
let keys;
|
| 31 |
+
let startIndex;
|
| 32 |
+
if (require_isArrayLike.isArrayLike(collection)) {
|
| 33 |
+
keys = require_range.range(0, collection.length).reverse();
|
| 34 |
+
if (accumulator == null && collection.length > 0) {
|
| 35 |
+
accumulator = collection[collection.length - 1];
|
| 36 |
+
startIndex = 1;
|
| 37 |
+
} else startIndex = 0;
|
| 38 |
+
} else {
|
| 39 |
+
keys = Object.keys(collection).reverse();
|
| 40 |
+
if (accumulator == null) {
|
| 41 |
+
accumulator = collection[keys[0]];
|
| 42 |
+
startIndex = 1;
|
| 43 |
+
} else startIndex = 0;
|
| 44 |
+
}
|
| 45 |
+
for (let i = startIndex; i < keys.length; i++) {
|
| 46 |
+
const key = keys[i];
|
| 47 |
+
const value = collection[key];
|
| 48 |
+
accumulator = iteratee(accumulator, value, key, collection);
|
| 49 |
+
}
|
| 50 |
+
return accumulator;
|
| 51 |
+
}
|
| 52 |
+
//#endregion
|
| 53 |
+
exports.reduceRight = reduceRight;
|
tools/ui/node_modules/es-toolkit/dist/compat/array/reduceRight.mjs
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { identity } from "../../function/identity.mjs";
|
| 2 |
+
import { range } from "../../math/range.mjs";
|
| 3 |
+
import { isArrayLike } from "../predicate/isArrayLike.mjs";
|
| 4 |
+
//#region src/compat/array/reduceRight.ts
|
| 5 |
+
/**
|
| 6 |
+
* Reduces a collection to a single value using an iteratee function, starting from the right.
|
| 7 |
+
*
|
| 8 |
+
* @param {T[] | ArrayLike<T> | Record<string, T> | null | undefined} collection - The collection to iterate over.
|
| 9 |
+
* @param {((accumulator: any, value: any, index: PropertyKey, collection: any) => any) | PropertyKey | object} iteratee - The function invoked per iteration or the key to reduce over.
|
| 10 |
+
* @param {any} initialValue - The initial value.
|
| 11 |
+
* @returns {any} - Returns the accumulated value.
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* // Using a reducer function
|
| 15 |
+
* const array = [1, 2, 3];
|
| 16 |
+
* reduceRight(array, (acc, value) => acc + value, 0); // => 6
|
| 17 |
+
*
|
| 18 |
+
* @example
|
| 19 |
+
* // Using a reducer function with initialValue
|
| 20 |
+
* const array = [1, 2, 3];
|
| 21 |
+
* reduceRight(array, (acc, value) => acc + value % 2 === 0, true); // => false
|
| 22 |
+
*
|
| 23 |
+
* @example
|
| 24 |
+
* // Using an object as the collection
|
| 25 |
+
* const obj = { a: 1, b: 2, c: 3 };
|
| 26 |
+
* reduceRight(obj, (acc, value) => acc + value, 0); // => 6
|
| 27 |
+
*/
|
| 28 |
+
function reduceRight(collection, iteratee = identity, accumulator) {
|
| 29 |
+
if (!collection) return accumulator;
|
| 30 |
+
let keys;
|
| 31 |
+
let startIndex;
|
| 32 |
+
if (isArrayLike(collection)) {
|
| 33 |
+
keys = range(0, collection.length).reverse();
|
| 34 |
+
if (accumulator == null && collection.length > 0) {
|
| 35 |
+
accumulator = collection[collection.length - 1];
|
| 36 |
+
startIndex = 1;
|
| 37 |
+
} else startIndex = 0;
|
| 38 |
+
} else {
|
| 39 |
+
keys = Object.keys(collection).reverse();
|
| 40 |
+
if (accumulator == null) {
|
| 41 |
+
accumulator = collection[keys[0]];
|
| 42 |
+
startIndex = 1;
|
| 43 |
+
} else startIndex = 0;
|
| 44 |
+
}
|
| 45 |
+
for (let i = startIndex; i < keys.length; i++) {
|
| 46 |
+
const key = keys[i];
|
| 47 |
+
const value = collection[key];
|
| 48 |
+
accumulator = iteratee(accumulator, value, key, collection);
|
| 49 |
+
}
|
| 50 |
+
return accumulator;
|
| 51 |
+
}
|
| 52 |
+
//#endregion
|
| 53 |
+
export { reduceRight };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/reject.d.mts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { StringIterator } from "../_internal/StringIterator.mjs";
|
| 2 |
+
import { ListIterateeCustom } from "../_internal/ListIterateeCustom.mjs";
|
| 3 |
+
import { ObjectIterateeCustom } from "../_internal/ObjectIteratee.mjs";
|
| 4 |
+
|
| 5 |
+
//#region src/compat/array/reject.d.ts
|
| 6 |
+
/**
|
| 7 |
+
* Iterates over the collection and rejects elements based on the given predicate.
|
| 8 |
+
* If a function is provided, it is invoked for each element in the collection.
|
| 9 |
+
*
|
| 10 |
+
* @param {string | null | undefined} collection The string to iterate over
|
| 11 |
+
* @param {StringIterator<boolean>} [predicate] The function invoked per iteration
|
| 12 |
+
* @returns {string[]} Returns a new array of characters that do not satisfy the predicate
|
| 13 |
+
* @example
|
| 14 |
+
* reject('abc', char => char === 'b')
|
| 15 |
+
* // => ['a', 'c']
|
| 16 |
+
*/
|
| 17 |
+
declare function reject(collection: string | null | undefined, predicate?: StringIterator<boolean>): string[];
|
| 18 |
+
/**
|
| 19 |
+
* Iterates over the collection and rejects elements based on the given predicate.
|
| 20 |
+
* If a function is provided, it is invoked for each element in the collection.
|
| 21 |
+
*
|
| 22 |
+
* @template T
|
| 23 |
+
* @param {ArrayLike<T> | null | undefined} collection The array-like to iterate over
|
| 24 |
+
* @param {ListIterateeCustom<T, boolean>} [predicate] The function invoked per iteration
|
| 25 |
+
* @returns {T[]} Returns a new array of elements that do not satisfy the predicate
|
| 26 |
+
* @example
|
| 27 |
+
* reject([1, 2, 3], num => num % 2 === 0)
|
| 28 |
+
* // => [1, 3]
|
| 29 |
+
*
|
| 30 |
+
* reject([{ a: 1 }, { a: 2 }, { b: 1 }], 'a')
|
| 31 |
+
* // => [{ b: 1 }]
|
| 32 |
+
*/
|
| 33 |
+
declare function reject<T>(collection: ArrayLike<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>): T[];
|
| 34 |
+
/**
|
| 35 |
+
* Iterates over the collection and rejects elements based on the given predicate.
|
| 36 |
+
* If a function is provided, it is invoked for each element in the collection.
|
| 37 |
+
*
|
| 38 |
+
* @template T
|
| 39 |
+
* @param {T | null | undefined} collection The object to iterate over
|
| 40 |
+
* @param {ObjectIterateeCustom<T, boolean>} [predicate] The function invoked per iteration
|
| 41 |
+
* @returns {Array<T[keyof T]>} Returns a new array of elements that do not satisfy the predicate
|
| 42 |
+
* @example
|
| 43 |
+
* reject({ a: 1, b: 2, c: 3 }, value => value % 2 === 0)
|
| 44 |
+
* // => [1, 3]
|
| 45 |
+
*
|
| 46 |
+
* reject({ item1: { a: 0, b: true }, item2: { a: 1, b: true }, item3: { a: 2, b: false }}, { b: false })
|
| 47 |
+
* // => [{ a: 0, b: true }, { a: 1, b: true }]
|
| 48 |
+
*/
|
| 49 |
+
declare function reject<T extends object>(collection: T | null | undefined, predicate?: ObjectIterateeCustom<T, boolean>): Array<T[keyof T]>;
|
| 50 |
+
//#endregion
|
| 51 |
+
export { reject };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/reject.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { StringIterator } from "../_internal/StringIterator.js";
|
| 2 |
+
import { ListIterateeCustom } from "../_internal/ListIterateeCustom.js";
|
| 3 |
+
import { ObjectIterateeCustom } from "../_internal/ObjectIteratee.js";
|
| 4 |
+
|
| 5 |
+
//#region src/compat/array/reject.d.ts
|
| 6 |
+
/**
|
| 7 |
+
* Iterates over the collection and rejects elements based on the given predicate.
|
| 8 |
+
* If a function is provided, it is invoked for each element in the collection.
|
| 9 |
+
*
|
| 10 |
+
* @param {string | null | undefined} collection The string to iterate over
|
| 11 |
+
* @param {StringIterator<boolean>} [predicate] The function invoked per iteration
|
| 12 |
+
* @returns {string[]} Returns a new array of characters that do not satisfy the predicate
|
| 13 |
+
* @example
|
| 14 |
+
* reject('abc', char => char === 'b')
|
| 15 |
+
* // => ['a', 'c']
|
| 16 |
+
*/
|
| 17 |
+
declare function reject(collection: string | null | undefined, predicate?: StringIterator<boolean>): string[];
|
| 18 |
+
/**
|
| 19 |
+
* Iterates over the collection and rejects elements based on the given predicate.
|
| 20 |
+
* If a function is provided, it is invoked for each element in the collection.
|
| 21 |
+
*
|
| 22 |
+
* @template T
|
| 23 |
+
* @param {ArrayLike<T> | null | undefined} collection The array-like to iterate over
|
| 24 |
+
* @param {ListIterateeCustom<T, boolean>} [predicate] The function invoked per iteration
|
| 25 |
+
* @returns {T[]} Returns a new array of elements that do not satisfy the predicate
|
| 26 |
+
* @example
|
| 27 |
+
* reject([1, 2, 3], num => num % 2 === 0)
|
| 28 |
+
* // => [1, 3]
|
| 29 |
+
*
|
| 30 |
+
* reject([{ a: 1 }, { a: 2 }, { b: 1 }], 'a')
|
| 31 |
+
* // => [{ b: 1 }]
|
| 32 |
+
*/
|
| 33 |
+
declare function reject<T>(collection: ArrayLike<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>): T[];
|
| 34 |
+
/**
|
| 35 |
+
* Iterates over the collection and rejects elements based on the given predicate.
|
| 36 |
+
* If a function is provided, it is invoked for each element in the collection.
|
| 37 |
+
*
|
| 38 |
+
* @template T
|
| 39 |
+
* @param {T | null | undefined} collection The object to iterate over
|
| 40 |
+
* @param {ObjectIterateeCustom<T, boolean>} [predicate] The function invoked per iteration
|
| 41 |
+
* @returns {Array<T[keyof T]>} Returns a new array of elements that do not satisfy the predicate
|
| 42 |
+
* @example
|
| 43 |
+
* reject({ a: 1, b: 2, c: 3 }, value => value % 2 === 0)
|
| 44 |
+
* // => [1, 3]
|
| 45 |
+
*
|
| 46 |
+
* reject({ item1: { a: 0, b: true }, item2: { a: 1, b: true }, item3: { a: 2, b: false }}, { b: false })
|
| 47 |
+
* // => [{ a: 0, b: true }, { a: 1, b: true }]
|
| 48 |
+
*/
|
| 49 |
+
declare function reject<T extends object>(collection: T | null | undefined, predicate?: ObjectIterateeCustom<T, boolean>): Array<T[keyof T]>;
|
| 50 |
+
//#endregion
|
| 51 |
+
export { reject };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/reject.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_identity = require("../../function/identity.js");
|
| 2 |
+
const require_iteratee = require("../util/iteratee.js");
|
| 3 |
+
const require_filter = require("./filter.js");
|
| 4 |
+
const require_negate = require("../function/negate.js");
|
| 5 |
+
//#region src/compat/array/reject.ts
|
| 6 |
+
/**
|
| 7 |
+
* Iterates over the collection and rejects elements based on the given predicate.
|
| 8 |
+
* If a function is provided, it is invoked for each element in the collection.
|
| 9 |
+
*
|
| 10 |
+
* @template T
|
| 11 |
+
* @param {ArrayLike<T> | Record<any, any> | null | undefined} source - The array or object to iterate over.
|
| 12 |
+
* @param {((item: T, index: number, arr: any) => unknown) | Partial<T> | [keyof T, unknown] | PropertyKey} [predicate=identity] - The function invoked per iteration.
|
| 13 |
+
* @returns {T[]} - Returns a new array of elements that do not satisfy the predicate.
|
| 14 |
+
*
|
| 15 |
+
* @example
|
| 16 |
+
* reject([{ a: 1 }, { a: 2 }, { b: 1 }], 'a');
|
| 17 |
+
* // => [{ b: 1 }]
|
| 18 |
+
*
|
| 19 |
+
* reject([{ a: 1 }, { a: 2 }, { b: 1 }], { b: 1 });
|
| 20 |
+
* // => [{ a: 1 }, { a: 2 }]
|
| 21 |
+
*
|
| 22 |
+
* reject({ item1: { a: 0, b: true }, item2: { a: 1, b: true }, item3: { a: 2, b: false }}, { b: false })
|
| 23 |
+
* // => [{ a: 0, b: true }, { a: 1, b: true }]
|
| 24 |
+
*
|
| 25 |
+
* reject([{ a: 1 }, { a: 2 }, { a: 3 }], ['a', 2]);
|
| 26 |
+
* // => [{ a: 1 }, { a: 3 }]
|
| 27 |
+
*/
|
| 28 |
+
function reject(source, predicate = require_identity.identity) {
|
| 29 |
+
return require_filter.filter(source, require_negate.negate(require_iteratee.iteratee(predicate)));
|
| 30 |
+
}
|
| 31 |
+
//#endregion
|
| 32 |
+
exports.reject = reject;
|
tools/ui/node_modules/es-toolkit/dist/compat/array/reject.mjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { identity } from "../../function/identity.mjs";
|
| 2 |
+
import { iteratee } from "../util/iteratee.mjs";
|
| 3 |
+
import { filter } from "./filter.mjs";
|
| 4 |
+
import { negate } from "../function/negate.mjs";
|
| 5 |
+
//#region src/compat/array/reject.ts
|
| 6 |
+
/**
|
| 7 |
+
* Iterates over the collection and rejects elements based on the given predicate.
|
| 8 |
+
* If a function is provided, it is invoked for each element in the collection.
|
| 9 |
+
*
|
| 10 |
+
* @template T
|
| 11 |
+
* @param {ArrayLike<T> | Record<any, any> | null | undefined} source - The array or object to iterate over.
|
| 12 |
+
* @param {((item: T, index: number, arr: any) => unknown) | Partial<T> | [keyof T, unknown] | PropertyKey} [predicate=identity] - The function invoked per iteration.
|
| 13 |
+
* @returns {T[]} - Returns a new array of elements that do not satisfy the predicate.
|
| 14 |
+
*
|
| 15 |
+
* @example
|
| 16 |
+
* reject([{ a: 1 }, { a: 2 }, { b: 1 }], 'a');
|
| 17 |
+
* // => [{ b: 1 }]
|
| 18 |
+
*
|
| 19 |
+
* reject([{ a: 1 }, { a: 2 }, { b: 1 }], { b: 1 });
|
| 20 |
+
* // => [{ a: 1 }, { a: 2 }]
|
| 21 |
+
*
|
| 22 |
+
* reject({ item1: { a: 0, b: true }, item2: { a: 1, b: true }, item3: { a: 2, b: false }}, { b: false })
|
| 23 |
+
* // => [{ a: 0, b: true }, { a: 1, b: true }]
|
| 24 |
+
*
|
| 25 |
+
* reject([{ a: 1 }, { a: 2 }, { a: 3 }], ['a', 2]);
|
| 26 |
+
* // => [{ a: 1 }, { a: 3 }]
|
| 27 |
+
*/
|
| 28 |
+
function reject(source, predicate = identity) {
|
| 29 |
+
return filter(source, negate(iteratee(predicate)));
|
| 30 |
+
}
|
| 31 |
+
//#endregion
|
| 32 |
+
export { reject };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/remove.d.mts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { ListIteratee } from "../_internal/ListIteratee.mjs";
|
| 2 |
+
import { MutableList } from "../_internal/MutableList.mjs";
|
| 3 |
+
import { RejectReadonly } from "../_internal/RejectReadonly.mjs";
|
| 4 |
+
|
| 5 |
+
//#region src/compat/array/remove.d.ts
|
| 6 |
+
/**
|
| 7 |
+
* Removes all elements from array that predicate returns truthy for and returns an array of the removed elements.
|
| 8 |
+
*
|
| 9 |
+
* @template L
|
| 10 |
+
* @param {RejectReadonly<L>} array - The array to modify.
|
| 11 |
+
* @param {ListIteratee<L[0]>} [predicate] - The function invoked per iteration.
|
| 12 |
+
* @returns {Array<L[0]>} Returns the new array of removed elements.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* const array = [1, 2, 3, 4];
|
| 16 |
+
* const evens = remove(array, n => n % 2 === 0);
|
| 17 |
+
* console.log(array); // => [1, 3]
|
| 18 |
+
* console.log(evens); // => [2, 4]
|
| 19 |
+
*/
|
| 20 |
+
declare function remove<L extends MutableList<any>>(array: RejectReadonly<L>, predicate?: ListIteratee<L[0]>): Array<L[0]>;
|
| 21 |
+
//#endregion
|
| 22 |
+
export { remove };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/remove.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { ListIteratee } from "../_internal/ListIteratee.js";
|
| 2 |
+
import { MutableList } from "../_internal/MutableList.js";
|
| 3 |
+
import { RejectReadonly } from "../_internal/RejectReadonly.js";
|
| 4 |
+
|
| 5 |
+
//#region src/compat/array/remove.d.ts
|
| 6 |
+
/**
|
| 7 |
+
* Removes all elements from array that predicate returns truthy for and returns an array of the removed elements.
|
| 8 |
+
*
|
| 9 |
+
* @template L
|
| 10 |
+
* @param {RejectReadonly<L>} array - The array to modify.
|
| 11 |
+
* @param {ListIteratee<L[0]>} [predicate] - The function invoked per iteration.
|
| 12 |
+
* @returns {Array<L[0]>} Returns the new array of removed elements.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* const array = [1, 2, 3, 4];
|
| 16 |
+
* const evens = remove(array, n => n % 2 === 0);
|
| 17 |
+
* console.log(array); // => [1, 3]
|
| 18 |
+
* console.log(evens); // => [2, 4]
|
| 19 |
+
*/
|
| 20 |
+
declare function remove<L extends MutableList<any>>(array: RejectReadonly<L>, predicate?: ListIteratee<L[0]>): Array<L[0]>;
|
| 21 |
+
//#endregion
|
| 22 |
+
export { remove };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/remove.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_remove = require("../../array/remove.js");
|
| 2 |
+
const require_identity = require("../../function/identity.js");
|
| 3 |
+
const require_iteratee = require("../util/iteratee.js");
|
| 4 |
+
//#region src/compat/array/remove.ts
|
| 5 |
+
/**
|
| 6 |
+
* Removes elements from an array based on various criteria.
|
| 7 |
+
*
|
| 8 |
+
* @param {ArrayLike<T>} arr - The array to iterate over.
|
| 9 |
+
* @param {(value: T, index: number, arr: ArrayLike<T>) => boolean | Partial<T> | [keyof T, unknown] | keyof T} shouldRemoveElement - The function invoked per iteration, a partial object, a property-value pair, or a key to match against each element.
|
| 10 |
+
* @returns {T[]} - Returns the modified array with the specified elements removed.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* // Using a predicate function
|
| 14 |
+
* const numbers = [1, 2, 3, 4, 5];
|
| 15 |
+
* remove(numbers, value => value % 2 === 0); // => [1, 3, 5]
|
| 16 |
+
*
|
| 17 |
+
* @example
|
| 18 |
+
* // Using a partial object
|
| 19 |
+
* const objects = [{ a: 1 }, { a: 2 }, { a: 3 }];
|
| 20 |
+
* remove(objects, { a: 1 }); // => [{ a: 2 }, { a: 3 }]
|
| 21 |
+
*
|
| 22 |
+
* @example
|
| 23 |
+
* // Using a property-value pair
|
| 24 |
+
* const objects = [{ a: 1 }, { a: 2 }, { a: 3 }];
|
| 25 |
+
* remove(objects, ['a', 1]); // => [{ a: 2 }, { a: 3 }]
|
| 26 |
+
*
|
| 27 |
+
* @example
|
| 28 |
+
* // Using a property key
|
| 29 |
+
* const objects = [{ a: 0 }, { a: 1 }];
|
| 30 |
+
* remove(objects, 'a'); // => [{ a: 0 }]
|
| 31 |
+
*/
|
| 32 |
+
function remove(arr, shouldRemoveElement = require_identity.identity) {
|
| 33 |
+
return require_remove.remove(arr, require_iteratee.iteratee(shouldRemoveElement));
|
| 34 |
+
}
|
| 35 |
+
//#endregion
|
| 36 |
+
exports.remove = remove;
|
tools/ui/node_modules/es-toolkit/dist/compat/array/remove.mjs
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { remove as remove$1 } from "../../array/remove.mjs";
|
| 2 |
+
import { identity } from "../../function/identity.mjs";
|
| 3 |
+
import { iteratee } from "../util/iteratee.mjs";
|
| 4 |
+
//#region src/compat/array/remove.ts
|
| 5 |
+
/**
|
| 6 |
+
* Removes elements from an array based on various criteria.
|
| 7 |
+
*
|
| 8 |
+
* @param {ArrayLike<T>} arr - The array to iterate over.
|
| 9 |
+
* @param {(value: T, index: number, arr: ArrayLike<T>) => boolean | Partial<T> | [keyof T, unknown] | keyof T} shouldRemoveElement - The function invoked per iteration, a partial object, a property-value pair, or a key to match against each element.
|
| 10 |
+
* @returns {T[]} - Returns the modified array with the specified elements removed.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* // Using a predicate function
|
| 14 |
+
* const numbers = [1, 2, 3, 4, 5];
|
| 15 |
+
* remove(numbers, value => value % 2 === 0); // => [1, 3, 5]
|
| 16 |
+
*
|
| 17 |
+
* @example
|
| 18 |
+
* // Using a partial object
|
| 19 |
+
* const objects = [{ a: 1 }, { a: 2 }, { a: 3 }];
|
| 20 |
+
* remove(objects, { a: 1 }); // => [{ a: 2 }, { a: 3 }]
|
| 21 |
+
*
|
| 22 |
+
* @example
|
| 23 |
+
* // Using a property-value pair
|
| 24 |
+
* const objects = [{ a: 1 }, { a: 2 }, { a: 3 }];
|
| 25 |
+
* remove(objects, ['a', 1]); // => [{ a: 2 }, { a: 3 }]
|
| 26 |
+
*
|
| 27 |
+
* @example
|
| 28 |
+
* // Using a property key
|
| 29 |
+
* const objects = [{ a: 0 }, { a: 1 }];
|
| 30 |
+
* remove(objects, 'a'); // => [{ a: 0 }]
|
| 31 |
+
*/
|
| 32 |
+
function remove(arr, shouldRemoveElement = identity) {
|
| 33 |
+
return remove$1(arr, iteratee(shouldRemoveElement));
|
| 34 |
+
}
|
| 35 |
+
//#endregion
|
| 36 |
+
export { remove };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/reverse.d.mts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { MutableList } from "../_internal/MutableList.mjs";
|
| 2 |
+
import { RejectReadonly } from "../_internal/RejectReadonly.mjs";
|
| 3 |
+
|
| 4 |
+
//#region src/compat/array/reverse.d.ts
|
| 5 |
+
/**
|
| 6 |
+
* Reverses `array` so that the first element becomes the last, the second element becomes the second to last, and so on.
|
| 7 |
+
*
|
| 8 |
+
* @template L
|
| 9 |
+
* @param {L extends readonly any[] ? never : L} array - The array to reverse.
|
| 10 |
+
* @returns {L} Returns `array`.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* const array = [1, 2, 3];
|
| 14 |
+
* reverse(array);
|
| 15 |
+
* // => [3, 2, 1]
|
| 16 |
+
*/
|
| 17 |
+
declare function reverse<L extends MutableList<any>>(array: RejectReadonly<L>): L;
|
| 18 |
+
//#endregion
|
| 19 |
+
export { reverse };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/reverse.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { MutableList } from "../_internal/MutableList.js";
|
| 2 |
+
import { RejectReadonly } from "../_internal/RejectReadonly.js";
|
| 3 |
+
|
| 4 |
+
//#region src/compat/array/reverse.d.ts
|
| 5 |
+
/**
|
| 6 |
+
* Reverses `array` so that the first element becomes the last, the second element becomes the second to last, and so on.
|
| 7 |
+
*
|
| 8 |
+
* @template L
|
| 9 |
+
* @param {L extends readonly any[] ? never : L} array - The array to reverse.
|
| 10 |
+
* @returns {L} Returns `array`.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* const array = [1, 2, 3];
|
| 14 |
+
* reverse(array);
|
| 15 |
+
* // => [3, 2, 1]
|
| 16 |
+
*/
|
| 17 |
+
declare function reverse<L extends MutableList<any>>(array: RejectReadonly<L>): L;
|
| 18 |
+
//#endregion
|
| 19 |
+
export { reverse };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/reverse.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/reverse.ts
|
| 2 |
+
/**
|
| 3 |
+
* Reverses the elements of an array in place.
|
| 4 |
+
*
|
| 5 |
+
* This function takes an array and reverses its elements in place, modifying the original array.
|
| 6 |
+
* If the input is `null` or `undefined`, it returns the input as is.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the array.
|
| 9 |
+
* @param {T[] | null | undefined} array - The array to reverse. If `null` or `undefined`, the input is returned as is.
|
| 10 |
+
* @returns {T[] | null | undefined} The reversed array, or `null`/`undefined` if the input was `null`/`undefined`.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* const array = [1, 2, 3, 4, 5];
|
| 14 |
+
* const reversedArray = reverse(array);
|
| 15 |
+
* // reversedArray is [5, 4, 3, 2, 1], and array is also modified to [5, 4, 3, 2, 1].
|
| 16 |
+
*
|
| 17 |
+
* const emptyArray = reverse([]);
|
| 18 |
+
* // emptyArray is [].
|
| 19 |
+
*
|
| 20 |
+
* const nullArray = reverse(null);
|
| 21 |
+
* // nullArray is null.
|
| 22 |
+
*/
|
| 23 |
+
function reverse(array) {
|
| 24 |
+
if (array == null) return array;
|
| 25 |
+
return array.reverse();
|
| 26 |
+
}
|
| 27 |
+
//#endregion
|
| 28 |
+
exports.reverse = reverse;
|
tools/ui/node_modules/es-toolkit/dist/compat/array/reverse.mjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/reverse.ts
|
| 2 |
+
/**
|
| 3 |
+
* Reverses the elements of an array in place.
|
| 4 |
+
*
|
| 5 |
+
* This function takes an array and reverses its elements in place, modifying the original array.
|
| 6 |
+
* If the input is `null` or `undefined`, it returns the input as is.
|
| 7 |
+
*
|
| 8 |
+
* @template T - The type of elements in the array.
|
| 9 |
+
* @param {T[] | null | undefined} array - The array to reverse. If `null` or `undefined`, the input is returned as is.
|
| 10 |
+
* @returns {T[] | null | undefined} The reversed array, or `null`/`undefined` if the input was `null`/`undefined`.
|
| 11 |
+
*
|
| 12 |
+
* @example
|
| 13 |
+
* const array = [1, 2, 3, 4, 5];
|
| 14 |
+
* const reversedArray = reverse(array);
|
| 15 |
+
* // reversedArray is [5, 4, 3, 2, 1], and array is also modified to [5, 4, 3, 2, 1].
|
| 16 |
+
*
|
| 17 |
+
* const emptyArray = reverse([]);
|
| 18 |
+
* // emptyArray is [].
|
| 19 |
+
*
|
| 20 |
+
* const nullArray = reverse(null);
|
| 21 |
+
* // nullArray is null.
|
| 22 |
+
*/
|
| 23 |
+
function reverse(array) {
|
| 24 |
+
if (array == null) return array;
|
| 25 |
+
return array.reverse();
|
| 26 |
+
}
|
| 27 |
+
//#endregion
|
| 28 |
+
export { reverse };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/sample.d.mts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/sample.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Gets a random element from collection.
|
| 4 |
+
*
|
| 5 |
+
* @template T
|
| 6 |
+
* @param {readonly [T, ...T[]]} collection - The collection to sample.
|
| 7 |
+
* @returns {T} Returns the random element.
|
| 8 |
+
*
|
| 9 |
+
* @example
|
| 10 |
+
* sample([1, 2, 3, 4]);
|
| 11 |
+
* // => 2
|
| 12 |
+
*/
|
| 13 |
+
declare function sample<T>(collection: readonly [T, ...T[]]): T;
|
| 14 |
+
/**
|
| 15 |
+
* Gets a random element from collection.
|
| 16 |
+
*
|
| 17 |
+
* @template T
|
| 18 |
+
* @param {Record<string, T> | Record<number, T> | null | undefined} collection - The collection to sample.
|
| 19 |
+
* @returns {T | undefined} Returns the random element.
|
| 20 |
+
*
|
| 21 |
+
* @example
|
| 22 |
+
* sample({ 'a': 1, 'b': 2, 'c': 3 });
|
| 23 |
+
* // => 2
|
| 24 |
+
*/
|
| 25 |
+
declare function sample<T>(collection: Record<string, T> | Record<number, T> | null | undefined): T | undefined;
|
| 26 |
+
/**
|
| 27 |
+
* Gets a random element from collection.
|
| 28 |
+
*
|
| 29 |
+
* @template T
|
| 30 |
+
* @param {T | null | undefined} collection - The collection to sample.
|
| 31 |
+
* @returns {T[keyof T] | undefined} Returns the random element.
|
| 32 |
+
*
|
| 33 |
+
* @example
|
| 34 |
+
* sample({ 'a': 1, 'b': 2, 'c': 3 });
|
| 35 |
+
* // => 2
|
| 36 |
+
*/
|
| 37 |
+
declare function sample<T extends object>(collection: T | null | undefined): T[keyof T] | undefined;
|
| 38 |
+
//#endregion
|
| 39 |
+
export { sample };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/sample.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/sample.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Gets a random element from collection.
|
| 4 |
+
*
|
| 5 |
+
* @template T
|
| 6 |
+
* @param {readonly [T, ...T[]]} collection - The collection to sample.
|
| 7 |
+
* @returns {T} Returns the random element.
|
| 8 |
+
*
|
| 9 |
+
* @example
|
| 10 |
+
* sample([1, 2, 3, 4]);
|
| 11 |
+
* // => 2
|
| 12 |
+
*/
|
| 13 |
+
declare function sample<T>(collection: readonly [T, ...T[]]): T;
|
| 14 |
+
/**
|
| 15 |
+
* Gets a random element from collection.
|
| 16 |
+
*
|
| 17 |
+
* @template T
|
| 18 |
+
* @param {Record<string, T> | Record<number, T> | null | undefined} collection - The collection to sample.
|
| 19 |
+
* @returns {T | undefined} Returns the random element.
|
| 20 |
+
*
|
| 21 |
+
* @example
|
| 22 |
+
* sample({ 'a': 1, 'b': 2, 'c': 3 });
|
| 23 |
+
* // => 2
|
| 24 |
+
*/
|
| 25 |
+
declare function sample<T>(collection: Record<string, T> | Record<number, T> | null | undefined): T | undefined;
|
| 26 |
+
/**
|
| 27 |
+
* Gets a random element from collection.
|
| 28 |
+
*
|
| 29 |
+
* @template T
|
| 30 |
+
* @param {T | null | undefined} collection - The collection to sample.
|
| 31 |
+
* @returns {T[keyof T] | undefined} Returns the random element.
|
| 32 |
+
*
|
| 33 |
+
* @example
|
| 34 |
+
* sample({ 'a': 1, 'b': 2, 'c': 3 });
|
| 35 |
+
* // => 2
|
| 36 |
+
*/
|
| 37 |
+
declare function sample<T extends object>(collection: T | null | undefined): T[keyof T] | undefined;
|
| 38 |
+
//#endregion
|
| 39 |
+
export { sample };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/sample.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_sample = require("../../array/sample.js");
|
| 2 |
+
const require_toArray = require("../_internal/toArray.js");
|
| 3 |
+
const require_isArrayLike = require("../predicate/isArrayLike.js");
|
| 4 |
+
//#region src/compat/array/sample.ts
|
| 5 |
+
/**
|
| 6 |
+
* The implementation for the overloaded sample function.
|
| 7 |
+
*
|
| 8 |
+
* This function takes an array, string, or object and returns a single element selected randomly.
|
| 9 |
+
* If the input is empty, or if it's null or undefined, the function returns `undefined`.
|
| 10 |
+
*
|
| 11 |
+
* @template T - The type of elements in the collection.
|
| 12 |
+
* @param {ArrayLike<T> | Record<string, T>} collection - The collection to sample from.
|
| 13 |
+
* @returns {T | string | undefined} A random element from the collection, or `undefined` if the collection is empty or invalid.
|
| 14 |
+
*/
|
| 15 |
+
function sample(collection) {
|
| 16 |
+
if (collection == null) return;
|
| 17 |
+
if (require_isArrayLike.isArrayLike(collection)) return require_sample.sample(require_toArray.toArray(collection));
|
| 18 |
+
return require_sample.sample(Object.values(collection));
|
| 19 |
+
}
|
| 20 |
+
//#endregion
|
| 21 |
+
exports.sample = sample;
|
tools/ui/node_modules/es-toolkit/dist/compat/array/sample.mjs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { sample as sample$1 } from "../../array/sample.mjs";
|
| 2 |
+
import { toArray } from "../_internal/toArray.mjs";
|
| 3 |
+
import { isArrayLike } from "../predicate/isArrayLike.mjs";
|
| 4 |
+
//#region src/compat/array/sample.ts
|
| 5 |
+
/**
|
| 6 |
+
* The implementation for the overloaded sample function.
|
| 7 |
+
*
|
| 8 |
+
* This function takes an array, string, or object and returns a single element selected randomly.
|
| 9 |
+
* If the input is empty, or if it's null or undefined, the function returns `undefined`.
|
| 10 |
+
*
|
| 11 |
+
* @template T - The type of elements in the collection.
|
| 12 |
+
* @param {ArrayLike<T> | Record<string, T>} collection - The collection to sample from.
|
| 13 |
+
* @returns {T | string | undefined} A random element from the collection, or `undefined` if the collection is empty or invalid.
|
| 14 |
+
*/
|
| 15 |
+
function sample(collection) {
|
| 16 |
+
if (collection == null) return;
|
| 17 |
+
if (isArrayLike(collection)) return sample$1(toArray(collection));
|
| 18 |
+
return sample$1(Object.values(collection));
|
| 19 |
+
}
|
| 20 |
+
//#endregion
|
| 21 |
+
export { sample };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/sampleSize.d.mts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/sampleSize.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Returns a sample element array of a specified size from a collection.
|
| 4 |
+
*
|
| 5 |
+
* @template T
|
| 6 |
+
* @param {Record<string, T> | Record<number, T> | null | undefined} collection - The collection to sample from.
|
| 7 |
+
* @param {number} [n] - The size of sample.
|
| 8 |
+
* @returns {T[]} A new array with sample size applied.
|
| 9 |
+
*
|
| 10 |
+
* @example
|
| 11 |
+
* sampleSize([1, 2, 3], 2);
|
| 12 |
+
* // => [2, 3] (example, actual result will vary)
|
| 13 |
+
*/
|
| 14 |
+
declare function sampleSize<T>(collection: Record<string, T> | Record<number, T> | null | undefined, n?: number): T[];
|
| 15 |
+
/**
|
| 16 |
+
* Returns a sample element array of a specified size from an object.
|
| 17 |
+
*
|
| 18 |
+
* @template T
|
| 19 |
+
* @param {T | null | undefined} collection - The object to sample from.
|
| 20 |
+
* @param {number} [n] - The size of sample.
|
| 21 |
+
* @returns {Array<T[keyof T]>} A new array with sample size applied.
|
| 22 |
+
*
|
| 23 |
+
* @example
|
| 24 |
+
* sampleSize({ a: 1, b: 2, c: 3 }, 2);
|
| 25 |
+
* // => [2, 3] (example, actual result will vary)
|
| 26 |
+
*/
|
| 27 |
+
declare function sampleSize<T extends object>(collection: T | null | undefined, n?: number): Array<T[keyof T]>;
|
| 28 |
+
//#endregion
|
| 29 |
+
export { sampleSize };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/sampleSize.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/array/sampleSize.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Returns a sample element array of a specified size from a collection.
|
| 4 |
+
*
|
| 5 |
+
* @template T
|
| 6 |
+
* @param {Record<string, T> | Record<number, T> | null | undefined} collection - The collection to sample from.
|
| 7 |
+
* @param {number} [n] - The size of sample.
|
| 8 |
+
* @returns {T[]} A new array with sample size applied.
|
| 9 |
+
*
|
| 10 |
+
* @example
|
| 11 |
+
* sampleSize([1, 2, 3], 2);
|
| 12 |
+
* // => [2, 3] (example, actual result will vary)
|
| 13 |
+
*/
|
| 14 |
+
declare function sampleSize<T>(collection: Record<string, T> | Record<number, T> | null | undefined, n?: number): T[];
|
| 15 |
+
/**
|
| 16 |
+
* Returns a sample element array of a specified size from an object.
|
| 17 |
+
*
|
| 18 |
+
* @template T
|
| 19 |
+
* @param {T | null | undefined} collection - The object to sample from.
|
| 20 |
+
* @param {number} [n] - The size of sample.
|
| 21 |
+
* @returns {Array<T[keyof T]>} A new array with sample size applied.
|
| 22 |
+
*
|
| 23 |
+
* @example
|
| 24 |
+
* sampleSize({ a: 1, b: 2, c: 3 }, 2);
|
| 25 |
+
* // => [2, 3] (example, actual result will vary)
|
| 26 |
+
*/
|
| 27 |
+
declare function sampleSize<T extends object>(collection: T | null | undefined, n?: number): Array<T[keyof T]>;
|
| 28 |
+
//#endregion
|
| 29 |
+
export { sampleSize };
|
tools/ui/node_modules/es-toolkit/dist/compat/array/sampleSize.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_sampleSize = require("../../array/sampleSize.js");
|
| 2 |
+
const require_toInteger = require("../util/toInteger.js");
|
| 3 |
+
const require_isIterateeCall = require("../_internal/isIterateeCall.js");
|
| 4 |
+
const require_clamp = require("../math/clamp.js");
|
| 5 |
+
const require_toArray = require("../util/toArray.js");
|
| 6 |
+
//#region src/compat/array/sampleSize.ts
|
| 7 |
+
/**
|
| 8 |
+
* Returns a sample element array of a specified `size`.
|
| 9 |
+
*
|
| 10 |
+
* This function takes an array and a number, and returns an array containing the sampled elements using Floyd's algorithm.
|
| 11 |
+
*
|
| 12 |
+
* {@link https://www.nowherenearithaca.com/2013/05/robert-floyds-tiny-and-beautiful.html Floyd's algorithm}
|
| 13 |
+
*
|
| 14 |
+
* @template T - The type of elements in the array.
|
| 15 |
+
* @param {Record<string, T> | Record<number, T> | T | null | undefined} collection - The array to sample from.
|
| 16 |
+
* @param {number} size - The size of sample.
|
| 17 |
+
* @returns {Array<T[keyof T]> | T[]} A new array with sample size applied.
|
| 18 |
+
*
|
| 19 |
+
* @example
|
| 20 |
+
* const result = sampleSize([1, 2, 3], 2)
|
| 21 |
+
* // result will be an array containing two of the elements from the collection.
|
| 22 |
+
* // [1, 2] or [1, 3] or [2, 3]
|
| 23 |
+
*/
|
| 24 |
+
function sampleSize(collection, size, guard) {
|
| 25 |
+
const arrayCollection = require_toArray.toArray(collection);
|
| 26 |
+
if (guard ? require_isIterateeCall.isIterateeCall(collection, size, guard) : size === void 0) size = 1;
|
| 27 |
+
else size = require_clamp.clamp(require_toInteger.toInteger(size), 0, arrayCollection.length);
|
| 28 |
+
return require_sampleSize.sampleSize(arrayCollection, size);
|
| 29 |
+
}
|
| 30 |
+
//#endregion
|
| 31 |
+
exports.sampleSize = sampleSize;
|