Upload folder using huggingface_hub (part 35)
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/util/toSafeInteger.d.ts +21 -0
- tools/ui/node_modules/es-toolkit/dist/compat/util/toSafeInteger.js +27 -0
- tools/ui/node_modules/es-toolkit/dist/compat/util/toSafeInteger.mjs +27 -0
- tools/ui/node_modules/es-toolkit/dist/compat/util/toString.d.mts +20 -0
- tools/ui/node_modules/es-toolkit/dist/compat/util/toString.d.ts +20 -0
- tools/ui/node_modules/es-toolkit/dist/compat/util/toString.js +27 -0
- tools/ui/node_modules/es-toolkit/dist/compat/util/toString.mjs +27 -0
- tools/ui/node_modules/es-toolkit/dist/compat/util/uniqueId.d.mts +26 -0
- tools/ui/node_modules/es-toolkit/dist/compat/util/uniqueId.d.ts +26 -0
- tools/ui/node_modules/es-toolkit/dist/compat/util/uniqueId.js +30 -0
- tools/ui/node_modules/es-toolkit/dist/compat/util/uniqueId.mjs +30 -0
- tools/ui/node_modules/es-toolkit/dist/error/AbortError.d.mts +12 -0
- tools/ui/node_modules/es-toolkit/dist/error/AbortError.d.ts +12 -0
- tools/ui/node_modules/es-toolkit/dist/error/AbortError.js +13 -0
- tools/ui/node_modules/es-toolkit/dist/error/AbortError.mjs +13 -0
- tools/ui/node_modules/es-toolkit/dist/error/TimeoutError.d.mts +12 -0
- tools/ui/node_modules/es-toolkit/dist/error/TimeoutError.d.ts +12 -0
- tools/ui/node_modules/es-toolkit/dist/error/TimeoutError.js +13 -0
- tools/ui/node_modules/es-toolkit/dist/error/TimeoutError.mjs +13 -0
- tools/ui/node_modules/es-toolkit/dist/error/index.d.mts +3 -0
- tools/ui/node_modules/es-toolkit/dist/error/index.d.ts +3 -0
- tools/ui/node_modules/es-toolkit/dist/error/index.js +5 -0
- tools/ui/node_modules/es-toolkit/dist/error/index.mjs +3 -0
- tools/ui/node_modules/es-toolkit/dist/function/after.d.mts +32 -0
- tools/ui/node_modules/es-toolkit/dist/function/after.d.ts +32 -0
- tools/ui/node_modules/es-toolkit/dist/function/after.js +38 -0
- tools/ui/node_modules/es-toolkit/dist/function/after.mjs +38 -0
- tools/ui/node_modules/es-toolkit/dist/function/ary.d.mts +22 -0
- tools/ui/node_modules/es-toolkit/dist/function/ary.d.ts +22 -0
- tools/ui/node_modules/es-toolkit/dist/function/ary.js +26 -0
- tools/ui/node_modules/es-toolkit/dist/function/ary.mjs +26 -0
- tools/ui/node_modules/es-toolkit/dist/function/asyncNoop.d.mts +13 -0
- tools/ui/node_modules/es-toolkit/dist/function/asyncNoop.d.ts +13 -0
- tools/ui/node_modules/es-toolkit/dist/function/asyncNoop.js +13 -0
- tools/ui/node_modules/es-toolkit/dist/function/asyncNoop.mjs +13 -0
- tools/ui/node_modules/es-toolkit/dist/function/before.d.mts +32 -0
- tools/ui/node_modules/es-toolkit/dist/function/before.d.ts +32 -0
- tools/ui/node_modules/es-toolkit/dist/function/before.js +38 -0
- tools/ui/node_modules/es-toolkit/dist/function/before.mjs +38 -0
- tools/ui/node_modules/es-toolkit/dist/function/curry.d.mts +127 -0
- tools/ui/node_modules/es-toolkit/dist/function/curry.d.ts +127 -0
- tools/ui/node_modules/es-toolkit/dist/function/curry.js +41 -0
- tools/ui/node_modules/es-toolkit/dist/function/curry.mjs +41 -0
- tools/ui/node_modules/es-toolkit/dist/function/curryRight.d.mts +141 -0
- tools/ui/node_modules/es-toolkit/dist/function/curryRight.d.ts +141 -0
- tools/ui/node_modules/es-toolkit/dist/function/curryRight.js +43 -0
- tools/ui/node_modules/es-toolkit/dist/function/curryRight.mjs +43 -0
- tools/ui/node_modules/es-toolkit/dist/function/debounce.d.mts +78 -0
- tools/ui/node_modules/es-toolkit/dist/function/debounce.d.ts +78 -0
- tools/ui/node_modules/es-toolkit/dist/function/debounce.js +90 -0
tools/ui/node_modules/es-toolkit/dist/compat/util/toSafeInteger.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/util/toSafeInteger.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Converts `value` to a safe integer.
|
| 4 |
+
*
|
| 5 |
+
* A safe integer can be compared and represented correctly.
|
| 6 |
+
*
|
| 7 |
+
* @param {any} value - The value to convert.
|
| 8 |
+
* @returns {number} Returns the value converted to a safe integer.
|
| 9 |
+
*
|
| 10 |
+
* @example
|
| 11 |
+
* toSafeInteger(3.2); // => 3
|
| 12 |
+
* toSafeInteger(Number.MAX_VALUE); // => 9007199254740991
|
| 13 |
+
* toSafeInteger(Infinity); // => 9007199254740991
|
| 14 |
+
* toSafeInteger('3.2'); // => 3
|
| 15 |
+
* toSafeInteger(NaN); // => 0
|
| 16 |
+
* toSafeInteger(null); // => 0
|
| 17 |
+
* toSafeInteger(-Infinity); // => -9007199254740991
|
| 18 |
+
*/
|
| 19 |
+
declare function toSafeInteger(value: any): number;
|
| 20 |
+
//#endregion
|
| 21 |
+
export { toSafeInteger };
|
tools/ui/node_modules/es-toolkit/dist/compat/util/toSafeInteger.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_toInteger = require("./toInteger.js");
|
| 2 |
+
const require_clamp = require("../math/clamp.js");
|
| 3 |
+
const require_MAX_SAFE_INTEGER = require("../_internal/MAX_SAFE_INTEGER.js");
|
| 4 |
+
//#region src/compat/util/toSafeInteger.ts
|
| 5 |
+
/**
|
| 6 |
+
* Converts `value` to a safe integer.
|
| 7 |
+
*
|
| 8 |
+
* A safe integer can be compared and represented correctly.
|
| 9 |
+
*
|
| 10 |
+
* @param {any} value - The value to convert.
|
| 11 |
+
* @returns {number} Returns the value converted to a safe integer.
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* toSafeInteger(3.2); // => 3
|
| 15 |
+
* toSafeInteger(Number.MAX_VALUE); // => 9007199254740991
|
| 16 |
+
* toSafeInteger(Infinity); // => 9007199254740991
|
| 17 |
+
* toSafeInteger('3.2'); // => 3
|
| 18 |
+
* toSafeInteger(NaN); // => 0
|
| 19 |
+
* toSafeInteger(null); // => 0
|
| 20 |
+
* toSafeInteger(-Infinity); // => -9007199254740991
|
| 21 |
+
*/
|
| 22 |
+
function toSafeInteger(value) {
|
| 23 |
+
if (value == null) return 0;
|
| 24 |
+
return require_clamp.clamp(require_toInteger.toInteger(value), -require_MAX_SAFE_INTEGER.MAX_SAFE_INTEGER, require_MAX_SAFE_INTEGER.MAX_SAFE_INTEGER);
|
| 25 |
+
}
|
| 26 |
+
//#endregion
|
| 27 |
+
exports.toSafeInteger = toSafeInteger;
|
tools/ui/node_modules/es-toolkit/dist/compat/util/toSafeInteger.mjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { toInteger } from "./toInteger.mjs";
|
| 2 |
+
import { clamp } from "../math/clamp.mjs";
|
| 3 |
+
import { MAX_SAFE_INTEGER } from "../_internal/MAX_SAFE_INTEGER.mjs";
|
| 4 |
+
//#region src/compat/util/toSafeInteger.ts
|
| 5 |
+
/**
|
| 6 |
+
* Converts `value` to a safe integer.
|
| 7 |
+
*
|
| 8 |
+
* A safe integer can be compared and represented correctly.
|
| 9 |
+
*
|
| 10 |
+
* @param {any} value - The value to convert.
|
| 11 |
+
* @returns {number} Returns the value converted to a safe integer.
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* toSafeInteger(3.2); // => 3
|
| 15 |
+
* toSafeInteger(Number.MAX_VALUE); // => 9007199254740991
|
| 16 |
+
* toSafeInteger(Infinity); // => 9007199254740991
|
| 17 |
+
* toSafeInteger('3.2'); // => 3
|
| 18 |
+
* toSafeInteger(NaN); // => 0
|
| 19 |
+
* toSafeInteger(null); // => 0
|
| 20 |
+
* toSafeInteger(-Infinity); // => -9007199254740991
|
| 21 |
+
*/
|
| 22 |
+
function toSafeInteger(value) {
|
| 23 |
+
if (value == null) return 0;
|
| 24 |
+
return clamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
|
| 25 |
+
}
|
| 26 |
+
//#endregion
|
| 27 |
+
export { toSafeInteger };
|
tools/ui/node_modules/es-toolkit/dist/compat/util/toString.d.mts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/util/toString.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Converts `value` to a string.
|
| 4 |
+
*
|
| 5 |
+
* An empty string is returned for `null` and `undefined` values.
|
| 6 |
+
* The sign of `-0` is preserved.
|
| 7 |
+
*
|
| 8 |
+
* @param {any} value - The value to convert.
|
| 9 |
+
* @returns {string} Returns the converted string.
|
| 10 |
+
*
|
| 11 |
+
* @example
|
| 12 |
+
* toString(null) // returns ''
|
| 13 |
+
* toString(undefined) // returns ''
|
| 14 |
+
* toString(-0) // returns '-0'
|
| 15 |
+
* toString([1, 2, -0]) // returns '1,2,-0'
|
| 16 |
+
* toString([Symbol('a'), Symbol('b')]) // returns 'Symbol(a),Symbol(b)'
|
| 17 |
+
*/
|
| 18 |
+
declare function toString(value: any): string;
|
| 19 |
+
//#endregion
|
| 20 |
+
export { toString };
|
tools/ui/node_modules/es-toolkit/dist/compat/util/toString.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/util/toString.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Converts `value` to a string.
|
| 4 |
+
*
|
| 5 |
+
* An empty string is returned for `null` and `undefined` values.
|
| 6 |
+
* The sign of `-0` is preserved.
|
| 7 |
+
*
|
| 8 |
+
* @param {any} value - The value to convert.
|
| 9 |
+
* @returns {string} Returns the converted string.
|
| 10 |
+
*
|
| 11 |
+
* @example
|
| 12 |
+
* toString(null) // returns ''
|
| 13 |
+
* toString(undefined) // returns ''
|
| 14 |
+
* toString(-0) // returns '-0'
|
| 15 |
+
* toString([1, 2, -0]) // returns '1,2,-0'
|
| 16 |
+
* toString([Symbol('a'), Symbol('b')]) // returns 'Symbol(a),Symbol(b)'
|
| 17 |
+
*/
|
| 18 |
+
declare function toString(value: any): string;
|
| 19 |
+
//#endregion
|
| 20 |
+
export { toString };
|
tools/ui/node_modules/es-toolkit/dist/compat/util/toString.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/util/toString.ts
|
| 2 |
+
/**
|
| 3 |
+
* Converts `value` to a string.
|
| 4 |
+
*
|
| 5 |
+
* An empty string is returned for `null` and `undefined` values.
|
| 6 |
+
* The sign of `-0` is preserved.
|
| 7 |
+
*
|
| 8 |
+
* @param {any} value - The value to convert.
|
| 9 |
+
* @returns {string} Returns the converted string.
|
| 10 |
+
*
|
| 11 |
+
* @example
|
| 12 |
+
* toString(null) // returns ''
|
| 13 |
+
* toString(undefined) // returns ''
|
| 14 |
+
* toString(-0) // returns '-0'
|
| 15 |
+
* toString([1, 2, -0]) // returns '1,2,-0'
|
| 16 |
+
* toString([Symbol('a'), Symbol('b')]) // returns 'Symbol(a),Symbol(b)'
|
| 17 |
+
*/
|
| 18 |
+
function toString(value) {
|
| 19 |
+
if (value == null) return "";
|
| 20 |
+
if (typeof value === "string") return value;
|
| 21 |
+
if (Array.isArray(value)) return value.map(toString).join(",");
|
| 22 |
+
const result = String(value);
|
| 23 |
+
if (result === "0" && Object.is(Number(value), -0)) return "-0";
|
| 24 |
+
return result;
|
| 25 |
+
}
|
| 26 |
+
//#endregion
|
| 27 |
+
exports.toString = toString;
|
tools/ui/node_modules/es-toolkit/dist/compat/util/toString.mjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/util/toString.ts
|
| 2 |
+
/**
|
| 3 |
+
* Converts `value` to a string.
|
| 4 |
+
*
|
| 5 |
+
* An empty string is returned for `null` and `undefined` values.
|
| 6 |
+
* The sign of `-0` is preserved.
|
| 7 |
+
*
|
| 8 |
+
* @param {any} value - The value to convert.
|
| 9 |
+
* @returns {string} Returns the converted string.
|
| 10 |
+
*
|
| 11 |
+
* @example
|
| 12 |
+
* toString(null) // returns ''
|
| 13 |
+
* toString(undefined) // returns ''
|
| 14 |
+
* toString(-0) // returns '-0'
|
| 15 |
+
* toString([1, 2, -0]) // returns '1,2,-0'
|
| 16 |
+
* toString([Symbol('a'), Symbol('b')]) // returns 'Symbol(a),Symbol(b)'
|
| 17 |
+
*/
|
| 18 |
+
function toString(value) {
|
| 19 |
+
if (value == null) return "";
|
| 20 |
+
if (typeof value === "string") return value;
|
| 21 |
+
if (Array.isArray(value)) return value.map(toString).join(",");
|
| 22 |
+
const result = String(value);
|
| 23 |
+
if (result === "0" && Object.is(Number(value), -0)) return "-0";
|
| 24 |
+
return result;
|
| 25 |
+
}
|
| 26 |
+
//#endregion
|
| 27 |
+
export { toString };
|
tools/ui/node_modules/es-toolkit/dist/compat/util/uniqueId.d.mts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/util/uniqueId.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Generates a unique identifier, optionally prefixed with a given string.
|
| 4 |
+
*
|
| 5 |
+
* @param {string} [prefix] - An optional string to prefix the unique identifier.
|
| 6 |
+
* If not provided or not a string, only the unique
|
| 7 |
+
* numeric identifier is returned.
|
| 8 |
+
* @returns {string} A string containing the unique identifier, with the optional
|
| 9 |
+
* prefix if provided.
|
| 10 |
+
*
|
| 11 |
+
* @example
|
| 12 |
+
* // Generate a unique ID with a prefix
|
| 13 |
+
* uniqueId('user_'); // => 'user_1'
|
| 14 |
+
*
|
| 15 |
+
* @example
|
| 16 |
+
* // Generate a unique ID without a prefix
|
| 17 |
+
* uniqueId(); // => '2'
|
| 18 |
+
*
|
| 19 |
+
* @example
|
| 20 |
+
* // Subsequent calls increment the internal counter
|
| 21 |
+
* uniqueId('item_'); // => 'item_3'
|
| 22 |
+
* uniqueId(); // => '4'
|
| 23 |
+
*/
|
| 24 |
+
declare function uniqueId(prefix?: string): string;
|
| 25 |
+
//#endregion
|
| 26 |
+
export { uniqueId };
|
tools/ui/node_modules/es-toolkit/dist/compat/util/uniqueId.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/util/uniqueId.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Generates a unique identifier, optionally prefixed with a given string.
|
| 4 |
+
*
|
| 5 |
+
* @param {string} [prefix] - An optional string to prefix the unique identifier.
|
| 6 |
+
* If not provided or not a string, only the unique
|
| 7 |
+
* numeric identifier is returned.
|
| 8 |
+
* @returns {string} A string containing the unique identifier, with the optional
|
| 9 |
+
* prefix if provided.
|
| 10 |
+
*
|
| 11 |
+
* @example
|
| 12 |
+
* // Generate a unique ID with a prefix
|
| 13 |
+
* uniqueId('user_'); // => 'user_1'
|
| 14 |
+
*
|
| 15 |
+
* @example
|
| 16 |
+
* // Generate a unique ID without a prefix
|
| 17 |
+
* uniqueId(); // => '2'
|
| 18 |
+
*
|
| 19 |
+
* @example
|
| 20 |
+
* // Subsequent calls increment the internal counter
|
| 21 |
+
* uniqueId('item_'); // => 'item_3'
|
| 22 |
+
* uniqueId(); // => '4'
|
| 23 |
+
*/
|
| 24 |
+
declare function uniqueId(prefix?: string): string;
|
| 25 |
+
//#endregion
|
| 26 |
+
export { uniqueId };
|
tools/ui/node_modules/es-toolkit/dist/compat/util/uniqueId.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/util/uniqueId.ts
|
| 2 |
+
/** Counter used to generate unique numeric identifiers. */
|
| 3 |
+
let idCounter = 0;
|
| 4 |
+
/**
|
| 5 |
+
* Generates a unique identifier, optionally prefixed with a given string.
|
| 6 |
+
*
|
| 7 |
+
* @param {string} [prefix] - An optional string to prefix the unique identifier.
|
| 8 |
+
* If not provided or not a string, only the unique
|
| 9 |
+
* numeric identifier is returned.
|
| 10 |
+
* @returns {string} A string containing the unique identifier, with the optional
|
| 11 |
+
* prefix if provided.
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* // Generate a unique ID with a prefix
|
| 15 |
+
* uniqueId('user_'); // => 'user_1'
|
| 16 |
+
*
|
| 17 |
+
* @example
|
| 18 |
+
* // Generate a unique ID without a prefix
|
| 19 |
+
* uniqueId(); // => '2'
|
| 20 |
+
*
|
| 21 |
+
* @example
|
| 22 |
+
* // Subsequent calls increment the internal counter
|
| 23 |
+
* uniqueId('item_'); // => 'item_3'
|
| 24 |
+
* uniqueId(); // => '4'
|
| 25 |
+
*/
|
| 26 |
+
function uniqueId(prefix = "") {
|
| 27 |
+
return `${prefix}${++idCounter}`;
|
| 28 |
+
}
|
| 29 |
+
//#endregion
|
| 30 |
+
exports.uniqueId = uniqueId;
|
tools/ui/node_modules/es-toolkit/dist/compat/util/uniqueId.mjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/compat/util/uniqueId.ts
|
| 2 |
+
/** Counter used to generate unique numeric identifiers. */
|
| 3 |
+
let idCounter = 0;
|
| 4 |
+
/**
|
| 5 |
+
* Generates a unique identifier, optionally prefixed with a given string.
|
| 6 |
+
*
|
| 7 |
+
* @param {string} [prefix] - An optional string to prefix the unique identifier.
|
| 8 |
+
* If not provided or not a string, only the unique
|
| 9 |
+
* numeric identifier is returned.
|
| 10 |
+
* @returns {string} A string containing the unique identifier, with the optional
|
| 11 |
+
* prefix if provided.
|
| 12 |
+
*
|
| 13 |
+
* @example
|
| 14 |
+
* // Generate a unique ID with a prefix
|
| 15 |
+
* uniqueId('user_'); // => 'user_1'
|
| 16 |
+
*
|
| 17 |
+
* @example
|
| 18 |
+
* // Generate a unique ID without a prefix
|
| 19 |
+
* uniqueId(); // => '2'
|
| 20 |
+
*
|
| 21 |
+
* @example
|
| 22 |
+
* // Subsequent calls increment the internal counter
|
| 23 |
+
* uniqueId('item_'); // => 'item_3'
|
| 24 |
+
* uniqueId(); // => '4'
|
| 25 |
+
*/
|
| 26 |
+
function uniqueId(prefix = "") {
|
| 27 |
+
return `${prefix}${++idCounter}`;
|
| 28 |
+
}
|
| 29 |
+
//#endregion
|
| 30 |
+
export { uniqueId };
|
tools/ui/node_modules/es-toolkit/dist/error/AbortError.d.mts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { DOMException } from "../_internal/DOMException.mjs";
|
| 2 |
+
|
| 3 |
+
//#region src/error/AbortError.d.ts
|
| 4 |
+
/**
|
| 5 |
+
* An error class representing an aborted operation.
|
| 6 |
+
* @augments DOMException
|
| 7 |
+
*/
|
| 8 |
+
declare class AbortError extends DOMException {
|
| 9 |
+
constructor(message?: string);
|
| 10 |
+
}
|
| 11 |
+
//#endregion
|
| 12 |
+
export { AbortError };
|
tools/ui/node_modules/es-toolkit/dist/error/AbortError.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { DOMException } from "../_internal/DOMException.js";
|
| 2 |
+
|
| 3 |
+
//#region src/error/AbortError.d.ts
|
| 4 |
+
/**
|
| 5 |
+
* An error class representing an aborted operation.
|
| 6 |
+
* @augments DOMException
|
| 7 |
+
*/
|
| 8 |
+
declare class AbortError extends DOMException {
|
| 9 |
+
constructor(message?: string);
|
| 10 |
+
}
|
| 11 |
+
//#endregion
|
| 12 |
+
export { AbortError };
|
tools/ui/node_modules/es-toolkit/dist/error/AbortError.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_DOMException = require("../_internal/DOMException.js");
|
| 2 |
+
//#region src/error/AbortError.ts
|
| 3 |
+
/**
|
| 4 |
+
* An error class representing an aborted operation.
|
| 5 |
+
* @augments DOMException
|
| 6 |
+
*/
|
| 7 |
+
var AbortError = class extends require_DOMException.DOMException {
|
| 8 |
+
constructor(message = "The operation was aborted") {
|
| 9 |
+
super(message);
|
| 10 |
+
}
|
| 11 |
+
};
|
| 12 |
+
//#endregion
|
| 13 |
+
exports.AbortError = AbortError;
|
tools/ui/node_modules/es-toolkit/dist/error/AbortError.mjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { DOMException } from "../_internal/DOMException.mjs";
|
| 2 |
+
//#region src/error/AbortError.ts
|
| 3 |
+
/**
|
| 4 |
+
* An error class representing an aborted operation.
|
| 5 |
+
* @augments DOMException
|
| 6 |
+
*/
|
| 7 |
+
var AbortError = class extends DOMException {
|
| 8 |
+
constructor(message = "The operation was aborted") {
|
| 9 |
+
super(message);
|
| 10 |
+
}
|
| 11 |
+
};
|
| 12 |
+
//#endregion
|
| 13 |
+
export { AbortError };
|
tools/ui/node_modules/es-toolkit/dist/error/TimeoutError.d.mts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { DOMException } from "../_internal/DOMException.mjs";
|
| 2 |
+
|
| 3 |
+
//#region src/error/TimeoutError.d.ts
|
| 4 |
+
/**
|
| 5 |
+
* An error class representing a timeout operation.
|
| 6 |
+
* @augments DOMException
|
| 7 |
+
*/
|
| 8 |
+
declare class TimeoutError extends DOMException {
|
| 9 |
+
constructor(message?: string);
|
| 10 |
+
}
|
| 11 |
+
//#endregion
|
| 12 |
+
export { TimeoutError };
|
tools/ui/node_modules/es-toolkit/dist/error/TimeoutError.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { DOMException } from "../_internal/DOMException.js";
|
| 2 |
+
|
| 3 |
+
//#region src/error/TimeoutError.d.ts
|
| 4 |
+
/**
|
| 5 |
+
* An error class representing a timeout operation.
|
| 6 |
+
* @augments DOMException
|
| 7 |
+
*/
|
| 8 |
+
declare class TimeoutError extends DOMException {
|
| 9 |
+
constructor(message?: string);
|
| 10 |
+
}
|
| 11 |
+
//#endregion
|
| 12 |
+
export { TimeoutError };
|
tools/ui/node_modules/es-toolkit/dist/error/TimeoutError.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const require_DOMException = require("../_internal/DOMException.js");
|
| 2 |
+
//#region src/error/TimeoutError.ts
|
| 3 |
+
/**
|
| 4 |
+
* An error class representing a timeout operation.
|
| 5 |
+
* @augments DOMException
|
| 6 |
+
*/
|
| 7 |
+
var TimeoutError = class extends require_DOMException.DOMException {
|
| 8 |
+
constructor(message = "The operation was timed out") {
|
| 9 |
+
super(message);
|
| 10 |
+
}
|
| 11 |
+
};
|
| 12 |
+
//#endregion
|
| 13 |
+
exports.TimeoutError = TimeoutError;
|
tools/ui/node_modules/es-toolkit/dist/error/TimeoutError.mjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { DOMException } from "../_internal/DOMException.mjs";
|
| 2 |
+
//#region src/error/TimeoutError.ts
|
| 3 |
+
/**
|
| 4 |
+
* An error class representing a timeout operation.
|
| 5 |
+
* @augments DOMException
|
| 6 |
+
*/
|
| 7 |
+
var TimeoutError = class extends DOMException {
|
| 8 |
+
constructor(message = "The operation was timed out") {
|
| 9 |
+
super(message);
|
| 10 |
+
}
|
| 11 |
+
};
|
| 12 |
+
//#endregion
|
| 13 |
+
export { TimeoutError };
|
tools/ui/node_modules/es-toolkit/dist/error/index.d.mts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { AbortError } from "./AbortError.mjs";
|
| 2 |
+
import { TimeoutError } from "./TimeoutError.mjs";
|
| 3 |
+
export { AbortError, TimeoutError };
|
tools/ui/node_modules/es-toolkit/dist/error/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { AbortError } from "./AbortError.js";
|
| 2 |
+
import { TimeoutError } from "./TimeoutError.js";
|
| 3 |
+
export { AbortError, TimeoutError };
|
tools/ui/node_modules/es-toolkit/dist/error/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
| 2 |
+
const require_AbortError = require("./AbortError.js");
|
| 3 |
+
const require_TimeoutError = require("./TimeoutError.js");
|
| 4 |
+
exports.AbortError = require_AbortError.AbortError;
|
| 5 |
+
exports.TimeoutError = require_TimeoutError.TimeoutError;
|
tools/ui/node_modules/es-toolkit/dist/error/index.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { AbortError } from "./AbortError.mjs";
|
| 2 |
+
import { TimeoutError } from "./TimeoutError.mjs";
|
| 3 |
+
export { AbortError, TimeoutError };
|
tools/ui/node_modules/es-toolkit/dist/function/after.d.mts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/after.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that only executes starting from the `n`-th call.
|
| 4 |
+
* The provided function will be invoked starting from the `n`-th call.
|
| 5 |
+
*
|
| 6 |
+
* This is particularly useful for scenarios involving events or asynchronous operations
|
| 7 |
+
* where an action should occur only after a certain number of invocations.
|
| 8 |
+
*
|
| 9 |
+
* @template F - The type of the function to be invoked.
|
| 10 |
+
* @param {number} n - The number of calls required for `func` to execute.
|
| 11 |
+
* @param {F} func - The function to be invoked.
|
| 12 |
+
* @returns {(...args: Parameters<F>) => ReturnType<F> | undefined} - A new function that:
|
| 13 |
+
* - Tracks the number of calls.
|
| 14 |
+
* - Invokes `func` starting from the `n`-th call.
|
| 15 |
+
* - Returns `undefined` if fewer than `n` calls have been made.
|
| 16 |
+
* @throws {Error} - Throws an error if `n` is negative.
|
| 17 |
+
* @example
|
| 18 |
+
*
|
| 19 |
+
* const afterFn = after(3, () => {
|
| 20 |
+
* console.log("called")
|
| 21 |
+
* });
|
| 22 |
+
*
|
| 23 |
+
* // Will not log anything.
|
| 24 |
+
* afterFn()
|
| 25 |
+
* // Will not log anything.
|
| 26 |
+
* afterFn()
|
| 27 |
+
* // Will log 'called'.
|
| 28 |
+
* afterFn()
|
| 29 |
+
*/
|
| 30 |
+
declare function after<F extends (...args: any[]) => any>(n: number, func: F): (...args: Parameters<F>) => ReturnType<F> | undefined;
|
| 31 |
+
//#endregion
|
| 32 |
+
export { after };
|
tools/ui/node_modules/es-toolkit/dist/function/after.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/after.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that only executes starting from the `n`-th call.
|
| 4 |
+
* The provided function will be invoked starting from the `n`-th call.
|
| 5 |
+
*
|
| 6 |
+
* This is particularly useful for scenarios involving events or asynchronous operations
|
| 7 |
+
* where an action should occur only after a certain number of invocations.
|
| 8 |
+
*
|
| 9 |
+
* @template F - The type of the function to be invoked.
|
| 10 |
+
* @param {number} n - The number of calls required for `func` to execute.
|
| 11 |
+
* @param {F} func - The function to be invoked.
|
| 12 |
+
* @returns {(...args: Parameters<F>) => ReturnType<F> | undefined} - A new function that:
|
| 13 |
+
* - Tracks the number of calls.
|
| 14 |
+
* - Invokes `func` starting from the `n`-th call.
|
| 15 |
+
* - Returns `undefined` if fewer than `n` calls have been made.
|
| 16 |
+
* @throws {Error} - Throws an error if `n` is negative.
|
| 17 |
+
* @example
|
| 18 |
+
*
|
| 19 |
+
* const afterFn = after(3, () => {
|
| 20 |
+
* console.log("called")
|
| 21 |
+
* });
|
| 22 |
+
*
|
| 23 |
+
* // Will not log anything.
|
| 24 |
+
* afterFn()
|
| 25 |
+
* // Will not log anything.
|
| 26 |
+
* afterFn()
|
| 27 |
+
* // Will log 'called'.
|
| 28 |
+
* afterFn()
|
| 29 |
+
*/
|
| 30 |
+
declare function after<F extends (...args: any[]) => any>(n: number, func: F): (...args: Parameters<F>) => ReturnType<F> | undefined;
|
| 31 |
+
//#endregion
|
| 32 |
+
export { after };
|
tools/ui/node_modules/es-toolkit/dist/function/after.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/after.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that only executes starting from the `n`-th call.
|
| 4 |
+
* The provided function will be invoked starting from the `n`-th call.
|
| 5 |
+
*
|
| 6 |
+
* This is particularly useful for scenarios involving events or asynchronous operations
|
| 7 |
+
* where an action should occur only after a certain number of invocations.
|
| 8 |
+
*
|
| 9 |
+
* @template F - The type of the function to be invoked.
|
| 10 |
+
* @param {number} n - The number of calls required for `func` to execute.
|
| 11 |
+
* @param {F} func - The function to be invoked.
|
| 12 |
+
* @returns {(...args: Parameters<F>) => ReturnType<F> | undefined} - A new function that:
|
| 13 |
+
* - Tracks the number of calls.
|
| 14 |
+
* - Invokes `func` starting from the `n`-th call.
|
| 15 |
+
* - Returns `undefined` if fewer than `n` calls have been made.
|
| 16 |
+
* @throws {Error} - Throws an error if `n` is negative.
|
| 17 |
+
* @example
|
| 18 |
+
*
|
| 19 |
+
* const afterFn = after(3, () => {
|
| 20 |
+
* console.log("called")
|
| 21 |
+
* });
|
| 22 |
+
*
|
| 23 |
+
* // Will not log anything.
|
| 24 |
+
* afterFn()
|
| 25 |
+
* // Will not log anything.
|
| 26 |
+
* afterFn()
|
| 27 |
+
* // Will log 'called'.
|
| 28 |
+
* afterFn()
|
| 29 |
+
*/
|
| 30 |
+
function after(n, func) {
|
| 31 |
+
if (!Number.isInteger(n) || n < 0) throw new Error(`n must be a non-negative integer.`);
|
| 32 |
+
let counter = 0;
|
| 33 |
+
return (...args) => {
|
| 34 |
+
if (++counter >= n) return func(...args);
|
| 35 |
+
};
|
| 36 |
+
}
|
| 37 |
+
//#endregion
|
| 38 |
+
exports.after = after;
|
tools/ui/node_modules/es-toolkit/dist/function/after.mjs
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/after.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that only executes starting from the `n`-th call.
|
| 4 |
+
* The provided function will be invoked starting from the `n`-th call.
|
| 5 |
+
*
|
| 6 |
+
* This is particularly useful for scenarios involving events or asynchronous operations
|
| 7 |
+
* where an action should occur only after a certain number of invocations.
|
| 8 |
+
*
|
| 9 |
+
* @template F - The type of the function to be invoked.
|
| 10 |
+
* @param {number} n - The number of calls required for `func` to execute.
|
| 11 |
+
* @param {F} func - The function to be invoked.
|
| 12 |
+
* @returns {(...args: Parameters<F>) => ReturnType<F> | undefined} - A new function that:
|
| 13 |
+
* - Tracks the number of calls.
|
| 14 |
+
* - Invokes `func` starting from the `n`-th call.
|
| 15 |
+
* - Returns `undefined` if fewer than `n` calls have been made.
|
| 16 |
+
* @throws {Error} - Throws an error if `n` is negative.
|
| 17 |
+
* @example
|
| 18 |
+
*
|
| 19 |
+
* const afterFn = after(3, () => {
|
| 20 |
+
* console.log("called")
|
| 21 |
+
* });
|
| 22 |
+
*
|
| 23 |
+
* // Will not log anything.
|
| 24 |
+
* afterFn()
|
| 25 |
+
* // Will not log anything.
|
| 26 |
+
* afterFn()
|
| 27 |
+
* // Will log 'called'.
|
| 28 |
+
* afterFn()
|
| 29 |
+
*/
|
| 30 |
+
function after(n, func) {
|
| 31 |
+
if (!Number.isInteger(n) || n < 0) throw new Error(`n must be a non-negative integer.`);
|
| 32 |
+
let counter = 0;
|
| 33 |
+
return (...args) => {
|
| 34 |
+
if (++counter >= n) return func(...args);
|
| 35 |
+
};
|
| 36 |
+
}
|
| 37 |
+
//#endregion
|
| 38 |
+
export { after };
|
tools/ui/node_modules/es-toolkit/dist/function/ary.d.mts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/ary.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that invokes func, with up to n arguments, ignoring any additional arguments.
|
| 4 |
+
*
|
| 5 |
+
* @template F - The type of the function.
|
| 6 |
+
* @param {F} func - The function to cap arguments for.
|
| 7 |
+
* @param {number} n - The arity cap.
|
| 8 |
+
* @returns {(...args: any[]) => ReturnType<F>} Returns the new capped function.
|
| 9 |
+
*
|
| 10 |
+
* @example
|
| 11 |
+
* function fn(a: number, b: number, c: number) {
|
| 12 |
+
* return Array.from(arguments);
|
| 13 |
+
* }
|
| 14 |
+
*
|
| 15 |
+
* ary(fn, 0)(1, 2, 3) // []
|
| 16 |
+
* ary(fn, 1)(1, 2, 3) // [1]
|
| 17 |
+
* ary(fn, 2)(1, 2, 3) // [1, 2]
|
| 18 |
+
* ary(fn, 3)(1, 2, 3) // [1, 2, 3]
|
| 19 |
+
*/
|
| 20 |
+
declare function ary<F extends (...args: any[]) => any>(func: F, n: number): (...args: any[]) => ReturnType<F>;
|
| 21 |
+
//#endregion
|
| 22 |
+
export { ary };
|
tools/ui/node_modules/es-toolkit/dist/function/ary.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/ary.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that invokes func, with up to n arguments, ignoring any additional arguments.
|
| 4 |
+
*
|
| 5 |
+
* @template F - The type of the function.
|
| 6 |
+
* @param {F} func - The function to cap arguments for.
|
| 7 |
+
* @param {number} n - The arity cap.
|
| 8 |
+
* @returns {(...args: any[]) => ReturnType<F>} Returns the new capped function.
|
| 9 |
+
*
|
| 10 |
+
* @example
|
| 11 |
+
* function fn(a: number, b: number, c: number) {
|
| 12 |
+
* return Array.from(arguments);
|
| 13 |
+
* }
|
| 14 |
+
*
|
| 15 |
+
* ary(fn, 0)(1, 2, 3) // []
|
| 16 |
+
* ary(fn, 1)(1, 2, 3) // [1]
|
| 17 |
+
* ary(fn, 2)(1, 2, 3) // [1, 2]
|
| 18 |
+
* ary(fn, 3)(1, 2, 3) // [1, 2, 3]
|
| 19 |
+
*/
|
| 20 |
+
declare function ary<F extends (...args: any[]) => any>(func: F, n: number): (...args: any[]) => ReturnType<F>;
|
| 21 |
+
//#endregion
|
| 22 |
+
export { ary };
|
tools/ui/node_modules/es-toolkit/dist/function/ary.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/ary.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that invokes func, with up to n arguments, ignoring any additional arguments.
|
| 4 |
+
*
|
| 5 |
+
* @template F - The type of the function.
|
| 6 |
+
* @param {F} func - The function to cap arguments for.
|
| 7 |
+
* @param {number} n - The arity cap.
|
| 8 |
+
* @returns {(...args: any[]) => ReturnType<F>} Returns the new capped function.
|
| 9 |
+
*
|
| 10 |
+
* @example
|
| 11 |
+
* function fn(a: number, b: number, c: number) {
|
| 12 |
+
* return Array.from(arguments);
|
| 13 |
+
* }
|
| 14 |
+
*
|
| 15 |
+
* ary(fn, 0)(1, 2, 3) // []
|
| 16 |
+
* ary(fn, 1)(1, 2, 3) // [1]
|
| 17 |
+
* ary(fn, 2)(1, 2, 3) // [1, 2]
|
| 18 |
+
* ary(fn, 3)(1, 2, 3) // [1, 2, 3]
|
| 19 |
+
*/
|
| 20 |
+
function ary(func, n) {
|
| 21 |
+
return function(...args) {
|
| 22 |
+
return func.apply(this, args.slice(0, n));
|
| 23 |
+
};
|
| 24 |
+
}
|
| 25 |
+
//#endregion
|
| 26 |
+
exports.ary = ary;
|
tools/ui/node_modules/es-toolkit/dist/function/ary.mjs
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/ary.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that invokes func, with up to n arguments, ignoring any additional arguments.
|
| 4 |
+
*
|
| 5 |
+
* @template F - The type of the function.
|
| 6 |
+
* @param {F} func - The function to cap arguments for.
|
| 7 |
+
* @param {number} n - The arity cap.
|
| 8 |
+
* @returns {(...args: any[]) => ReturnType<F>} Returns the new capped function.
|
| 9 |
+
*
|
| 10 |
+
* @example
|
| 11 |
+
* function fn(a: number, b: number, c: number) {
|
| 12 |
+
* return Array.from(arguments);
|
| 13 |
+
* }
|
| 14 |
+
*
|
| 15 |
+
* ary(fn, 0)(1, 2, 3) // []
|
| 16 |
+
* ary(fn, 1)(1, 2, 3) // [1]
|
| 17 |
+
* ary(fn, 2)(1, 2, 3) // [1, 2]
|
| 18 |
+
* ary(fn, 3)(1, 2, 3) // [1, 2, 3]
|
| 19 |
+
*/
|
| 20 |
+
function ary(func, n) {
|
| 21 |
+
return function(...args) {
|
| 22 |
+
return func.apply(this, args.slice(0, n));
|
| 23 |
+
};
|
| 24 |
+
}
|
| 25 |
+
//#endregion
|
| 26 |
+
export { ary };
|
tools/ui/node_modules/es-toolkit/dist/function/asyncNoop.d.mts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/asyncNoop.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* An asynchronous no-operation function that does nothing.
|
| 4 |
+
* This can be used as a placeholder or default function.
|
| 5 |
+
*
|
| 6 |
+
* @example
|
| 7 |
+
* asyncNoop(); // Does nothing
|
| 8 |
+
*
|
| 9 |
+
* @returns {Promise<void>} This function returns a Promise that resolves to undefined.
|
| 10 |
+
*/
|
| 11 |
+
declare function asyncNoop(): Promise<void>;
|
| 12 |
+
//#endregion
|
| 13 |
+
export { asyncNoop };
|
tools/ui/node_modules/es-toolkit/dist/function/asyncNoop.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/asyncNoop.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* An asynchronous no-operation function that does nothing.
|
| 4 |
+
* This can be used as a placeholder or default function.
|
| 5 |
+
*
|
| 6 |
+
* @example
|
| 7 |
+
* asyncNoop(); // Does nothing
|
| 8 |
+
*
|
| 9 |
+
* @returns {Promise<void>} This function returns a Promise that resolves to undefined.
|
| 10 |
+
*/
|
| 11 |
+
declare function asyncNoop(): Promise<void>;
|
| 12 |
+
//#endregion
|
| 13 |
+
export { asyncNoop };
|
tools/ui/node_modules/es-toolkit/dist/function/asyncNoop.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/asyncNoop.ts
|
| 2 |
+
/**
|
| 3 |
+
* An asynchronous no-operation function that does nothing.
|
| 4 |
+
* This can be used as a placeholder or default function.
|
| 5 |
+
*
|
| 6 |
+
* @example
|
| 7 |
+
* asyncNoop(); // Does nothing
|
| 8 |
+
*
|
| 9 |
+
* @returns {Promise<void>} This function returns a Promise that resolves to undefined.
|
| 10 |
+
*/
|
| 11 |
+
async function asyncNoop() {}
|
| 12 |
+
//#endregion
|
| 13 |
+
exports.asyncNoop = asyncNoop;
|
tools/ui/node_modules/es-toolkit/dist/function/asyncNoop.mjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/asyncNoop.ts
|
| 2 |
+
/**
|
| 3 |
+
* An asynchronous no-operation function that does nothing.
|
| 4 |
+
* This can be used as a placeholder or default function.
|
| 5 |
+
*
|
| 6 |
+
* @example
|
| 7 |
+
* asyncNoop(); // Does nothing
|
| 8 |
+
*
|
| 9 |
+
* @returns {Promise<void>} This function returns a Promise that resolves to undefined.
|
| 10 |
+
*/
|
| 11 |
+
async function asyncNoop() {}
|
| 12 |
+
//#endregion
|
| 13 |
+
export { asyncNoop };
|
tools/ui/node_modules/es-toolkit/dist/function/before.d.mts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/before.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that limits the number of times the given function (`func`) can be called.
|
| 4 |
+
*
|
| 5 |
+
* @template F - The type of the function to be invoked.
|
| 6 |
+
* @param {number} n - The number of times the returned function is allowed to call `func` before stopping.
|
| 7 |
+
* - If `n` is 0, `func` will never be called.
|
| 8 |
+
* - If `n` is a positive integer, `func` will be called up to `n-1` times.
|
| 9 |
+
* @param {F} func - The function to be called with the limit applied.
|
| 10 |
+
* @returns {(...args: Parameters<F>) => ReturnType<F> | undefined} - A new function that:
|
| 11 |
+
* - Tracks the number of calls.
|
| 12 |
+
* - Invokes `func` until the `n-1`-th call.
|
| 13 |
+
* - Returns `undefined` if the number of calls reaches or exceeds `n`, stopping further calls.
|
| 14 |
+
* @throws {Error} - Throw an error if `n` is negative.
|
| 15 |
+
* @example
|
| 16 |
+
*
|
| 17 |
+
* const beforeFn = before(3, () => {
|
| 18 |
+
* console.log("called");
|
| 19 |
+
* })
|
| 20 |
+
*
|
| 21 |
+
* // Will log 'called'.
|
| 22 |
+
* beforeFn();
|
| 23 |
+
*
|
| 24 |
+
* // Will log 'called'.
|
| 25 |
+
* beforeFn();
|
| 26 |
+
*
|
| 27 |
+
* // Will not log anything.
|
| 28 |
+
* beforeFn();
|
| 29 |
+
*/
|
| 30 |
+
declare function before<F extends (...args: any[]) => any>(n: number, func: F): (...args: Parameters<F>) => ReturnType<F> | undefined;
|
| 31 |
+
//#endregion
|
| 32 |
+
export { before };
|
tools/ui/node_modules/es-toolkit/dist/function/before.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/before.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that limits the number of times the given function (`func`) can be called.
|
| 4 |
+
*
|
| 5 |
+
* @template F - The type of the function to be invoked.
|
| 6 |
+
* @param {number} n - The number of times the returned function is allowed to call `func` before stopping.
|
| 7 |
+
* - If `n` is 0, `func` will never be called.
|
| 8 |
+
* - If `n` is a positive integer, `func` will be called up to `n-1` times.
|
| 9 |
+
* @param {F} func - The function to be called with the limit applied.
|
| 10 |
+
* @returns {(...args: Parameters<F>) => ReturnType<F> | undefined} - A new function that:
|
| 11 |
+
* - Tracks the number of calls.
|
| 12 |
+
* - Invokes `func` until the `n-1`-th call.
|
| 13 |
+
* - Returns `undefined` if the number of calls reaches or exceeds `n`, stopping further calls.
|
| 14 |
+
* @throws {Error} - Throw an error if `n` is negative.
|
| 15 |
+
* @example
|
| 16 |
+
*
|
| 17 |
+
* const beforeFn = before(3, () => {
|
| 18 |
+
* console.log("called");
|
| 19 |
+
* })
|
| 20 |
+
*
|
| 21 |
+
* // Will log 'called'.
|
| 22 |
+
* beforeFn();
|
| 23 |
+
*
|
| 24 |
+
* // Will log 'called'.
|
| 25 |
+
* beforeFn();
|
| 26 |
+
*
|
| 27 |
+
* // Will not log anything.
|
| 28 |
+
* beforeFn();
|
| 29 |
+
*/
|
| 30 |
+
declare function before<F extends (...args: any[]) => any>(n: number, func: F): (...args: Parameters<F>) => ReturnType<F> | undefined;
|
| 31 |
+
//#endregion
|
| 32 |
+
export { before };
|
tools/ui/node_modules/es-toolkit/dist/function/before.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/before.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that limits the number of times the given function (`func`) can be called.
|
| 4 |
+
*
|
| 5 |
+
* @template F - The type of the function to be invoked.
|
| 6 |
+
* @param {number} n - The number of times the returned function is allowed to call `func` before stopping.
|
| 7 |
+
* - If `n` is 0, `func` will never be called.
|
| 8 |
+
* - If `n` is a positive integer, `func` will be called up to `n-1` times.
|
| 9 |
+
* @param {F} func - The function to be called with the limit applied.
|
| 10 |
+
* @returns {(...args: Parameters<F>) => ReturnType<F> | undefined} - A new function that:
|
| 11 |
+
* - Tracks the number of calls.
|
| 12 |
+
* - Invokes `func` until the `n-1`-th call.
|
| 13 |
+
* - Returns `undefined` if the number of calls reaches or exceeds `n`, stopping further calls.
|
| 14 |
+
* @throws {Error} - Throw an error if `n` is negative.
|
| 15 |
+
* @example
|
| 16 |
+
*
|
| 17 |
+
* const beforeFn = before(3, () => {
|
| 18 |
+
* console.log("called");
|
| 19 |
+
* })
|
| 20 |
+
*
|
| 21 |
+
* // Will log 'called'.
|
| 22 |
+
* beforeFn();
|
| 23 |
+
*
|
| 24 |
+
* // Will log 'called'.
|
| 25 |
+
* beforeFn();
|
| 26 |
+
*
|
| 27 |
+
* // Will not log anything.
|
| 28 |
+
* beforeFn();
|
| 29 |
+
*/
|
| 30 |
+
function before(n, func) {
|
| 31 |
+
if (!Number.isInteger(n) || n < 0) throw new Error("n must be a non-negative integer.");
|
| 32 |
+
let counter = 0;
|
| 33 |
+
return (...args) => {
|
| 34 |
+
if (++counter < n) return func(...args);
|
| 35 |
+
};
|
| 36 |
+
}
|
| 37 |
+
//#endregion
|
| 38 |
+
exports.before = before;
|
tools/ui/node_modules/es-toolkit/dist/function/before.mjs
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/before.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a function that limits the number of times the given function (`func`) can be called.
|
| 4 |
+
*
|
| 5 |
+
* @template F - The type of the function to be invoked.
|
| 6 |
+
* @param {number} n - The number of times the returned function is allowed to call `func` before stopping.
|
| 7 |
+
* - If `n` is 0, `func` will never be called.
|
| 8 |
+
* - If `n` is a positive integer, `func` will be called up to `n-1` times.
|
| 9 |
+
* @param {F} func - The function to be called with the limit applied.
|
| 10 |
+
* @returns {(...args: Parameters<F>) => ReturnType<F> | undefined} - A new function that:
|
| 11 |
+
* - Tracks the number of calls.
|
| 12 |
+
* - Invokes `func` until the `n-1`-th call.
|
| 13 |
+
* - Returns `undefined` if the number of calls reaches or exceeds `n`, stopping further calls.
|
| 14 |
+
* @throws {Error} - Throw an error if `n` is negative.
|
| 15 |
+
* @example
|
| 16 |
+
*
|
| 17 |
+
* const beforeFn = before(3, () => {
|
| 18 |
+
* console.log("called");
|
| 19 |
+
* })
|
| 20 |
+
*
|
| 21 |
+
* // Will log 'called'.
|
| 22 |
+
* beforeFn();
|
| 23 |
+
*
|
| 24 |
+
* // Will log 'called'.
|
| 25 |
+
* beforeFn();
|
| 26 |
+
*
|
| 27 |
+
* // Will not log anything.
|
| 28 |
+
* beforeFn();
|
| 29 |
+
*/
|
| 30 |
+
function before(n, func) {
|
| 31 |
+
if (!Number.isInteger(n) || n < 0) throw new Error("n must be a non-negative integer.");
|
| 32 |
+
let counter = 0;
|
| 33 |
+
return (...args) => {
|
| 34 |
+
if (++counter < n) return func(...args);
|
| 35 |
+
};
|
| 36 |
+
}
|
| 37 |
+
//#endregion
|
| 38 |
+
export { before };
|
tools/ui/node_modules/es-toolkit/dist/function/curry.d.mts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/curry.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 4 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 5 |
+
*
|
| 6 |
+
* @param {() => R} func - The function to curry.
|
| 7 |
+
* @returns {() => R} A curried function.
|
| 8 |
+
*
|
| 9 |
+
* @example
|
| 10 |
+
* function noArgFunc() {
|
| 11 |
+
* return 42;
|
| 12 |
+
* }
|
| 13 |
+
* const curriedNoArgFunc = curry(noArgFunc);
|
| 14 |
+
* console.log(curriedNoArgFunc()); // 42
|
| 15 |
+
*/
|
| 16 |
+
declare function curry<R>(func: () => R): () => R;
|
| 17 |
+
/**
|
| 18 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 19 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 20 |
+
*
|
| 21 |
+
* @param {(p: P) => R} func - The function to curry.
|
| 22 |
+
* @returns {(p: P) => R} A curried function.
|
| 23 |
+
*
|
| 24 |
+
* @example
|
| 25 |
+
* function oneArgFunc(a: number) {
|
| 26 |
+
* return a * 2;
|
| 27 |
+
* }
|
| 28 |
+
* const curriedOneArgFunc = curry(oneArgFunc);
|
| 29 |
+
* console.log(curriedOneArgFunc(5)); // 10
|
| 30 |
+
*/
|
| 31 |
+
declare function curry<P, R>(func: (p: P) => R): (p: P) => R;
|
| 32 |
+
/**
|
| 33 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 34 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 35 |
+
*
|
| 36 |
+
* @param {(p1: P1, p2: P2) => R} func - The function to curry.
|
| 37 |
+
* @returns {(p1: P1) => (p2: P2) => R} A curried function.
|
| 38 |
+
*
|
| 39 |
+
* @example
|
| 40 |
+
* function twoArgFunc(a: number, b: number) {
|
| 41 |
+
* return a + b;
|
| 42 |
+
* }
|
| 43 |
+
* const curriedTwoArgFunc = curry(twoArgFunc);
|
| 44 |
+
* const add5 = curriedTwoArgFunc(5);
|
| 45 |
+
* console.log(add5(10)); // 15
|
| 46 |
+
*/
|
| 47 |
+
declare function curry<P1, P2, R>(func: (p1: P1, p2: P2) => R): (p1: P1) => (p2: P2) => R;
|
| 48 |
+
/**
|
| 49 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 50 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 51 |
+
*
|
| 52 |
+
* @param {(p1: P1, p2: P2, p3: P3) => R} func - The function to curry.
|
| 53 |
+
* @returns {(p1: P1) => (p2: P2) => (p3: P3) => R} A curried function.
|
| 54 |
+
*
|
| 55 |
+
* @example
|
| 56 |
+
* function threeArgFunc(a: number, b: number, c: number) {
|
| 57 |
+
* return a + b + c;
|
| 58 |
+
* }
|
| 59 |
+
* const curriedThreeArgFunc = curry(threeArgFunc);
|
| 60 |
+
* const add1 = curriedThreeArgFunc(1);
|
| 61 |
+
* const add3 = add1(2);
|
| 62 |
+
* console.log(add3(3)); // 6
|
| 63 |
+
*/
|
| 64 |
+
declare function curry<P1, P2, P3, R>(func: (p1: P1, p2: P2, p3: P3) => R): (p1: P1) => (p2: P2) => (p3: P3) => R;
|
| 65 |
+
/**
|
| 66 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 67 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 68 |
+
*
|
| 69 |
+
* @param {(p1: P1, p2: P2, p3: P3, p4: P4) => R} func - The function to curry.
|
| 70 |
+
* @returns {(p1: P1) => (p2: P2) => (p3: P3) => (p4: P4) => R} A curried function.
|
| 71 |
+
*
|
| 72 |
+
* @example
|
| 73 |
+
* function fourArgFunc(a: number, b: number, c: number, d: number) {
|
| 74 |
+
* return a + b + c + d;
|
| 75 |
+
* }
|
| 76 |
+
* const curriedFourArgFunc = curry(fourArgFunc);
|
| 77 |
+
* const add1 = curriedFourArgFunc(1);
|
| 78 |
+
* const add3 = add1(2);
|
| 79 |
+
* const add6 = add3(3);
|
| 80 |
+
* console.log(add6(4)); // 10
|
| 81 |
+
*/
|
| 82 |
+
declare function curry<P1, P2, P3, P4, R>(func: (p1: P1, p2: P2, p3: P3, p4: P4) => R): (p1: P1) => (p2: P2) => (p3: P3) => (p4: P4) => R;
|
| 83 |
+
/**
|
| 84 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 85 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 86 |
+
*
|
| 87 |
+
* @param {(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R} func - The function to curry.
|
| 88 |
+
* @returns {(p1: P1) => (p2: P2) => (p3: P3) => (p4: P4) => (p5: P5) => R} A curried function.
|
| 89 |
+
*
|
| 90 |
+
* @example
|
| 91 |
+
* function fiveArgFunc(a: number, b: number, c: number, d: number, e: number) {
|
| 92 |
+
* return a + b + c + d + e;
|
| 93 |
+
* }
|
| 94 |
+
* const curriedFiveArgFunc = curry(fiveArgFunc);
|
| 95 |
+
* const add1 = curriedFiveArgFunc(1);
|
| 96 |
+
* const add3 = add1(2);
|
| 97 |
+
* const add6 = add3(3);
|
| 98 |
+
* const add10 = add6(4);
|
| 99 |
+
* console.log(add10(5)); // 15
|
| 100 |
+
*/
|
| 101 |
+
declare function curry<P1, P2, P3, P4, P5, R>(func: (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R): (p1: P1) => (p2: P2) => (p3: P3) => (p4: P4) => (p5: P5) => R;
|
| 102 |
+
/**
|
| 103 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 104 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 105 |
+
*
|
| 106 |
+
* @param {(...args: any[]) => any} func - The function to curry.
|
| 107 |
+
* @returns {(...args: any[]) => any} A curried function that can be called with a single argument at a time.
|
| 108 |
+
*
|
| 109 |
+
* @example
|
| 110 |
+
* function sum(a: number, b: number, c: number) {
|
| 111 |
+
* return a + b + c;
|
| 112 |
+
* }
|
| 113 |
+
*
|
| 114 |
+
* const curriedSum = curry(sum);
|
| 115 |
+
*
|
| 116 |
+
* // The parameter `a` should be given the value `10`.
|
| 117 |
+
* const add10 = curriedSum(10);
|
| 118 |
+
*
|
| 119 |
+
* // The parameter `b` should be given the value `15`.
|
| 120 |
+
* const add25 = add10(15);
|
| 121 |
+
*
|
| 122 |
+
* // The parameter `c` should be given the value `5`. The function 'sum' has received all its arguments and will now return a value.
|
| 123 |
+
* const result = add25(5);
|
| 124 |
+
*/
|
| 125 |
+
declare function curry(func: (...args: any[]) => any): (...args: any[]) => any;
|
| 126 |
+
//#endregion
|
| 127 |
+
export { curry };
|
tools/ui/node_modules/es-toolkit/dist/function/curry.d.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/curry.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 4 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 5 |
+
*
|
| 6 |
+
* @param {() => R} func - The function to curry.
|
| 7 |
+
* @returns {() => R} A curried function.
|
| 8 |
+
*
|
| 9 |
+
* @example
|
| 10 |
+
* function noArgFunc() {
|
| 11 |
+
* return 42;
|
| 12 |
+
* }
|
| 13 |
+
* const curriedNoArgFunc = curry(noArgFunc);
|
| 14 |
+
* console.log(curriedNoArgFunc()); // 42
|
| 15 |
+
*/
|
| 16 |
+
declare function curry<R>(func: () => R): () => R;
|
| 17 |
+
/**
|
| 18 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 19 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 20 |
+
*
|
| 21 |
+
* @param {(p: P) => R} func - The function to curry.
|
| 22 |
+
* @returns {(p: P) => R} A curried function.
|
| 23 |
+
*
|
| 24 |
+
* @example
|
| 25 |
+
* function oneArgFunc(a: number) {
|
| 26 |
+
* return a * 2;
|
| 27 |
+
* }
|
| 28 |
+
* const curriedOneArgFunc = curry(oneArgFunc);
|
| 29 |
+
* console.log(curriedOneArgFunc(5)); // 10
|
| 30 |
+
*/
|
| 31 |
+
declare function curry<P, R>(func: (p: P) => R): (p: P) => R;
|
| 32 |
+
/**
|
| 33 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 34 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 35 |
+
*
|
| 36 |
+
* @param {(p1: P1, p2: P2) => R} func - The function to curry.
|
| 37 |
+
* @returns {(p1: P1) => (p2: P2) => R} A curried function.
|
| 38 |
+
*
|
| 39 |
+
* @example
|
| 40 |
+
* function twoArgFunc(a: number, b: number) {
|
| 41 |
+
* return a + b;
|
| 42 |
+
* }
|
| 43 |
+
* const curriedTwoArgFunc = curry(twoArgFunc);
|
| 44 |
+
* const add5 = curriedTwoArgFunc(5);
|
| 45 |
+
* console.log(add5(10)); // 15
|
| 46 |
+
*/
|
| 47 |
+
declare function curry<P1, P2, R>(func: (p1: P1, p2: P2) => R): (p1: P1) => (p2: P2) => R;
|
| 48 |
+
/**
|
| 49 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 50 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 51 |
+
*
|
| 52 |
+
* @param {(p1: P1, p2: P2, p3: P3) => R} func - The function to curry.
|
| 53 |
+
* @returns {(p1: P1) => (p2: P2) => (p3: P3) => R} A curried function.
|
| 54 |
+
*
|
| 55 |
+
* @example
|
| 56 |
+
* function threeArgFunc(a: number, b: number, c: number) {
|
| 57 |
+
* return a + b + c;
|
| 58 |
+
* }
|
| 59 |
+
* const curriedThreeArgFunc = curry(threeArgFunc);
|
| 60 |
+
* const add1 = curriedThreeArgFunc(1);
|
| 61 |
+
* const add3 = add1(2);
|
| 62 |
+
* console.log(add3(3)); // 6
|
| 63 |
+
*/
|
| 64 |
+
declare function curry<P1, P2, P3, R>(func: (p1: P1, p2: P2, p3: P3) => R): (p1: P1) => (p2: P2) => (p3: P3) => R;
|
| 65 |
+
/**
|
| 66 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 67 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 68 |
+
*
|
| 69 |
+
* @param {(p1: P1, p2: P2, p3: P3, p4: P4) => R} func - The function to curry.
|
| 70 |
+
* @returns {(p1: P1) => (p2: P2) => (p3: P3) => (p4: P4) => R} A curried function.
|
| 71 |
+
*
|
| 72 |
+
* @example
|
| 73 |
+
* function fourArgFunc(a: number, b: number, c: number, d: number) {
|
| 74 |
+
* return a + b + c + d;
|
| 75 |
+
* }
|
| 76 |
+
* const curriedFourArgFunc = curry(fourArgFunc);
|
| 77 |
+
* const add1 = curriedFourArgFunc(1);
|
| 78 |
+
* const add3 = add1(2);
|
| 79 |
+
* const add6 = add3(3);
|
| 80 |
+
* console.log(add6(4)); // 10
|
| 81 |
+
*/
|
| 82 |
+
declare function curry<P1, P2, P3, P4, R>(func: (p1: P1, p2: P2, p3: P3, p4: P4) => R): (p1: P1) => (p2: P2) => (p3: P3) => (p4: P4) => R;
|
| 83 |
+
/**
|
| 84 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 85 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 86 |
+
*
|
| 87 |
+
* @param {(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R} func - The function to curry.
|
| 88 |
+
* @returns {(p1: P1) => (p2: P2) => (p3: P3) => (p4: P4) => (p5: P5) => R} A curried function.
|
| 89 |
+
*
|
| 90 |
+
* @example
|
| 91 |
+
* function fiveArgFunc(a: number, b: number, c: number, d: number, e: number) {
|
| 92 |
+
* return a + b + c + d + e;
|
| 93 |
+
* }
|
| 94 |
+
* const curriedFiveArgFunc = curry(fiveArgFunc);
|
| 95 |
+
* const add1 = curriedFiveArgFunc(1);
|
| 96 |
+
* const add3 = add1(2);
|
| 97 |
+
* const add6 = add3(3);
|
| 98 |
+
* const add10 = add6(4);
|
| 99 |
+
* console.log(add10(5)); // 15
|
| 100 |
+
*/
|
| 101 |
+
declare function curry<P1, P2, P3, P4, P5, R>(func: (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R): (p1: P1) => (p2: P2) => (p3: P3) => (p4: P4) => (p5: P5) => R;
|
| 102 |
+
/**
|
| 103 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 104 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 105 |
+
*
|
| 106 |
+
* @param {(...args: any[]) => any} func - The function to curry.
|
| 107 |
+
* @returns {(...args: any[]) => any} A curried function that can be called with a single argument at a time.
|
| 108 |
+
*
|
| 109 |
+
* @example
|
| 110 |
+
* function sum(a: number, b: number, c: number) {
|
| 111 |
+
* return a + b + c;
|
| 112 |
+
* }
|
| 113 |
+
*
|
| 114 |
+
* const curriedSum = curry(sum);
|
| 115 |
+
*
|
| 116 |
+
* // The parameter `a` should be given the value `10`.
|
| 117 |
+
* const add10 = curriedSum(10);
|
| 118 |
+
*
|
| 119 |
+
* // The parameter `b` should be given the value `15`.
|
| 120 |
+
* const add25 = add10(15);
|
| 121 |
+
*
|
| 122 |
+
* // The parameter `c` should be given the value `5`. The function 'sum' has received all its arguments and will now return a value.
|
| 123 |
+
* const result = add25(5);
|
| 124 |
+
*/
|
| 125 |
+
declare function curry(func: (...args: any[]) => any): (...args: any[]) => any;
|
| 126 |
+
//#endregion
|
| 127 |
+
export { curry };
|
tools/ui/node_modules/es-toolkit/dist/function/curry.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/curry.ts
|
| 2 |
+
/**
|
| 3 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 4 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 5 |
+
*
|
| 6 |
+
* @param {(...args: any[]) => any} func - The function to curry.
|
| 7 |
+
* @returns {(...args: any[]) => any} A curried function that can be called with a single argument at a time.
|
| 8 |
+
*
|
| 9 |
+
* @example
|
| 10 |
+
* function sum(a: number, b: number, c: number) {
|
| 11 |
+
* return a + b + c;
|
| 12 |
+
* }
|
| 13 |
+
*
|
| 14 |
+
* const curriedSum = curry(sum);
|
| 15 |
+
*
|
| 16 |
+
* // The parameter `a` should be given the value `10`.
|
| 17 |
+
* const add10 = curriedSum(10);
|
| 18 |
+
*
|
| 19 |
+
* // The parameter `b` should be given the value `15`.
|
| 20 |
+
* const add25 = add10(15);
|
| 21 |
+
*
|
| 22 |
+
* // The parameter `c` should be given the value `5`. The function 'sum' has received all its arguments and will now return a value.
|
| 23 |
+
* const result = add25(5);
|
| 24 |
+
*/
|
| 25 |
+
function curry(func) {
|
| 26 |
+
if (func.length === 0 || func.length === 1) return func;
|
| 27 |
+
return function(arg) {
|
| 28 |
+
return makeCurry(func, func.length, [arg]);
|
| 29 |
+
};
|
| 30 |
+
}
|
| 31 |
+
function makeCurry(origin, argsLength, args) {
|
| 32 |
+
if (args.length === argsLength) return origin(...args);
|
| 33 |
+
else {
|
| 34 |
+
const next = function(arg) {
|
| 35 |
+
return makeCurry(origin, argsLength, [...args, arg]);
|
| 36 |
+
};
|
| 37 |
+
return next;
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
//#endregion
|
| 41 |
+
exports.curry = curry;
|
tools/ui/node_modules/es-toolkit/dist/function/curry.mjs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/curry.ts
|
| 2 |
+
/**
|
| 3 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 4 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 5 |
+
*
|
| 6 |
+
* @param {(...args: any[]) => any} func - The function to curry.
|
| 7 |
+
* @returns {(...args: any[]) => any} A curried function that can be called with a single argument at a time.
|
| 8 |
+
*
|
| 9 |
+
* @example
|
| 10 |
+
* function sum(a: number, b: number, c: number) {
|
| 11 |
+
* return a + b + c;
|
| 12 |
+
* }
|
| 13 |
+
*
|
| 14 |
+
* const curriedSum = curry(sum);
|
| 15 |
+
*
|
| 16 |
+
* // The parameter `a` should be given the value `10`.
|
| 17 |
+
* const add10 = curriedSum(10);
|
| 18 |
+
*
|
| 19 |
+
* // The parameter `b` should be given the value `15`.
|
| 20 |
+
* const add25 = add10(15);
|
| 21 |
+
*
|
| 22 |
+
* // The parameter `c` should be given the value `5`. The function 'sum' has received all its arguments and will now return a value.
|
| 23 |
+
* const result = add25(5);
|
| 24 |
+
*/
|
| 25 |
+
function curry(func) {
|
| 26 |
+
if (func.length === 0 || func.length === 1) return func;
|
| 27 |
+
return function(arg) {
|
| 28 |
+
return makeCurry(func, func.length, [arg]);
|
| 29 |
+
};
|
| 30 |
+
}
|
| 31 |
+
function makeCurry(origin, argsLength, args) {
|
| 32 |
+
if (args.length === argsLength) return origin(...args);
|
| 33 |
+
else {
|
| 34 |
+
const next = function(arg) {
|
| 35 |
+
return makeCurry(origin, argsLength, [...args, arg]);
|
| 36 |
+
};
|
| 37 |
+
return next;
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
//#endregion
|
| 41 |
+
export { curry };
|
tools/ui/node_modules/es-toolkit/dist/function/curryRight.d.mts
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/curryRight.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 4 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 5 |
+
*
|
| 6 |
+
* Unlike `curry`, this function curries the function from right to left.
|
| 7 |
+
*
|
| 8 |
+
* @param {() => R} func - The function to curry.
|
| 9 |
+
* @returns {() => R} A curried function.
|
| 10 |
+
*
|
| 11 |
+
* @example
|
| 12 |
+
* function noArgFunc() {
|
| 13 |
+
* return 42;
|
| 14 |
+
* }
|
| 15 |
+
* const curriedNoArgFunc = curryRight(noArgFunc);
|
| 16 |
+
* console.log(curriedNoArgFunc()); // 42
|
| 17 |
+
*/
|
| 18 |
+
declare function curryRight<R>(func: () => R): () => R;
|
| 19 |
+
/**
|
| 20 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 21 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 22 |
+
*
|
| 23 |
+
* Unlike `curry`, this function curries the function from right to left.
|
| 24 |
+
*
|
| 25 |
+
* @param {(p: P) => R} func - The function to curry.
|
| 26 |
+
* @returns {(p: P) => R} A curried function.
|
| 27 |
+
*
|
| 28 |
+
* @example
|
| 29 |
+
* function oneArgFunc(a: number) {
|
| 30 |
+
* return a * 2;
|
| 31 |
+
* }
|
| 32 |
+
* const curriedOneArgFunc = curryRight(oneArgFunc);
|
| 33 |
+
* console.log(curriedOneArgFunc(5)); // 10
|
| 34 |
+
*/
|
| 35 |
+
declare function curryRight<P, R>(func: (p: P) => R): (p: P) => R;
|
| 36 |
+
/**
|
| 37 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 38 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 39 |
+
*
|
| 40 |
+
* Unlike `curry`, this function curries the function from right to left.
|
| 41 |
+
*
|
| 42 |
+
* @param {(p1: P1, p2: P2) => R} func - The function to curry.
|
| 43 |
+
* @returns {(p2: P2) => (p1: P1) => R} A curried function.
|
| 44 |
+
*
|
| 45 |
+
* @example
|
| 46 |
+
* function twoArgFunc(a: number, b: number) {
|
| 47 |
+
* return [a, b];
|
| 48 |
+
* }
|
| 49 |
+
* const curriedTwoArgFunc = curryRight(twoArgFunc);
|
| 50 |
+
* const func = curriedTwoArgFunc(1);
|
| 51 |
+
* console.log(func(2)); // [2, 1]
|
| 52 |
+
*/
|
| 53 |
+
declare function curryRight<P1, P2, R>(func: (p1: P1, p2: P2) => R): (p2: P2) => (p1: P1) => R;
|
| 54 |
+
/**
|
| 55 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 56 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 57 |
+
*
|
| 58 |
+
* Unlike `curry`, this function curries the function from right to left.
|
| 59 |
+
*
|
| 60 |
+
* @param {(p1: P1, p2: P2, p3: P3) => R} func - The function to curry.
|
| 61 |
+
* @returns {(p3: P3) => (p2: P2) => (p1: P1) => R} A curried function.
|
| 62 |
+
*
|
| 63 |
+
* @example
|
| 64 |
+
* function threeArgFunc(a: number, b: number, c: number) {
|
| 65 |
+
* return [a, b, c];
|
| 66 |
+
* }
|
| 67 |
+
* const curriedThreeArgFunc = curryRight(threeArgFunc);
|
| 68 |
+
* const func = curriedThreeArgFunc(1);
|
| 69 |
+
* const func2 = func(2);
|
| 70 |
+
* console.log(func2(3)); // [3, 2, 1]
|
| 71 |
+
*/
|
| 72 |
+
declare function curryRight<P1, P2, P3, R>(func: (p1: P1, p2: P2, p3: P3) => R): (p3: P3) => (p2: P2) => (p1: P1) => R;
|
| 73 |
+
/**
|
| 74 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 75 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 76 |
+
*
|
| 77 |
+
* Unlike `curry`, this function curries the function from right to left.
|
| 78 |
+
*
|
| 79 |
+
* @param {(p1: P1, p2: P2, p3: P3, p4: P4) => R} func - The function to curry.
|
| 80 |
+
* @returns {(p4: P4) => (p3: P3) => (p2: P2) => (p1: P1) => R} A curried function.
|
| 81 |
+
*
|
| 82 |
+
* @example
|
| 83 |
+
* function fourArgFunc(a: number, b: number, c: number, d: number) {
|
| 84 |
+
* return [a, b, c, d];
|
| 85 |
+
* }
|
| 86 |
+
* const curriedFourArgFunc = curryRight(fourArgFunc);
|
| 87 |
+
* const func = curriedFourArgFunc(1);
|
| 88 |
+
* const func2 = func(2);
|
| 89 |
+
* const func3 = func2(3);
|
| 90 |
+
* console.log(func3(4)); // [4, 3, 2, 1]
|
| 91 |
+
*/
|
| 92 |
+
declare function curryRight<P1, P2, P3, P4, R>(func: (p1: P1, p2: P2, p3: P3, p4: P4) => R): (p4: P4) => (p3: P3) => (p2: P2) => (p1: P1) => R;
|
| 93 |
+
/**
|
| 94 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 95 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 96 |
+
*
|
| 97 |
+
* Unlike `curry`, this function curries the function from right to left.
|
| 98 |
+
*
|
| 99 |
+
* @param {(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R} func - The function to curry.
|
| 100 |
+
* @returns {(p5: P5) => (p4: P4) => (p3: P3) => (p2: P2) => (p1: P1) => R} A curried function.
|
| 101 |
+
*
|
| 102 |
+
* @example
|
| 103 |
+
* function fiveArgFunc(a: number, b: number, c: number, d: number, e: number) {
|
| 104 |
+
* return [a, b, c, d, e];
|
| 105 |
+
* }
|
| 106 |
+
* const curriedFiveArgFunc = curryRight(fiveArgFunc);
|
| 107 |
+
* const func = curriedFiveArgFunc(1);
|
| 108 |
+
* const func2 = func(2);
|
| 109 |
+
* const func3 = func2(3);
|
| 110 |
+
* const func4 = func3(4);
|
| 111 |
+
* console.log(func4(5)); // [5, 4, 3, 2, 1]
|
| 112 |
+
*/
|
| 113 |
+
declare function curryRight<P1, P2, P3, P4, P5, R>(func: (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R): (p5: P5) => (p4: P4) => (p3: P3) => (p2: P2) => (p1: P1) => R;
|
| 114 |
+
/**
|
| 115 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 116 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 117 |
+
*
|
| 118 |
+
* Unlike `curry`, this function curries the function from right to left.
|
| 119 |
+
*
|
| 120 |
+
* @param {(...args: any[]) => any} func - The function to curry.
|
| 121 |
+
* @returns {(...args: any[]) => any} A curried function.
|
| 122 |
+
*
|
| 123 |
+
* @example
|
| 124 |
+
* function sum(a: number, b: number, c: number) {
|
| 125 |
+
* return a + b + c;
|
| 126 |
+
* }
|
| 127 |
+
*
|
| 128 |
+
* const curriedSum = curryRight(sum);
|
| 129 |
+
*
|
| 130 |
+
* // The parameter `c` should be given the value `10`.
|
| 131 |
+
* const add10 = curriedSum(10);
|
| 132 |
+
*
|
| 133 |
+
* // The parameter `b` should be given the value `15`.
|
| 134 |
+
* const add25 = add10(15);
|
| 135 |
+
*
|
| 136 |
+
* // The parameter `a` should be given the value `5`. The function 'sum' has received all its arguments and will now return a value.
|
| 137 |
+
* const result = add25(5); // 30
|
| 138 |
+
*/
|
| 139 |
+
declare function curryRight(func: (...args: any[]) => any): (...args: any[]) => any;
|
| 140 |
+
//#endregion
|
| 141 |
+
export { curryRight };
|
tools/ui/node_modules/es-toolkit/dist/function/curryRight.d.ts
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/curryRight.d.ts
|
| 2 |
+
/**
|
| 3 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 4 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 5 |
+
*
|
| 6 |
+
* Unlike `curry`, this function curries the function from right to left.
|
| 7 |
+
*
|
| 8 |
+
* @param {() => R} func - The function to curry.
|
| 9 |
+
* @returns {() => R} A curried function.
|
| 10 |
+
*
|
| 11 |
+
* @example
|
| 12 |
+
* function noArgFunc() {
|
| 13 |
+
* return 42;
|
| 14 |
+
* }
|
| 15 |
+
* const curriedNoArgFunc = curryRight(noArgFunc);
|
| 16 |
+
* console.log(curriedNoArgFunc()); // 42
|
| 17 |
+
*/
|
| 18 |
+
declare function curryRight<R>(func: () => R): () => R;
|
| 19 |
+
/**
|
| 20 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 21 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 22 |
+
*
|
| 23 |
+
* Unlike `curry`, this function curries the function from right to left.
|
| 24 |
+
*
|
| 25 |
+
* @param {(p: P) => R} func - The function to curry.
|
| 26 |
+
* @returns {(p: P) => R} A curried function.
|
| 27 |
+
*
|
| 28 |
+
* @example
|
| 29 |
+
* function oneArgFunc(a: number) {
|
| 30 |
+
* return a * 2;
|
| 31 |
+
* }
|
| 32 |
+
* const curriedOneArgFunc = curryRight(oneArgFunc);
|
| 33 |
+
* console.log(curriedOneArgFunc(5)); // 10
|
| 34 |
+
*/
|
| 35 |
+
declare function curryRight<P, R>(func: (p: P) => R): (p: P) => R;
|
| 36 |
+
/**
|
| 37 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 38 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 39 |
+
*
|
| 40 |
+
* Unlike `curry`, this function curries the function from right to left.
|
| 41 |
+
*
|
| 42 |
+
* @param {(p1: P1, p2: P2) => R} func - The function to curry.
|
| 43 |
+
* @returns {(p2: P2) => (p1: P1) => R} A curried function.
|
| 44 |
+
*
|
| 45 |
+
* @example
|
| 46 |
+
* function twoArgFunc(a: number, b: number) {
|
| 47 |
+
* return [a, b];
|
| 48 |
+
* }
|
| 49 |
+
* const curriedTwoArgFunc = curryRight(twoArgFunc);
|
| 50 |
+
* const func = curriedTwoArgFunc(1);
|
| 51 |
+
* console.log(func(2)); // [2, 1]
|
| 52 |
+
*/
|
| 53 |
+
declare function curryRight<P1, P2, R>(func: (p1: P1, p2: P2) => R): (p2: P2) => (p1: P1) => R;
|
| 54 |
+
/**
|
| 55 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 56 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 57 |
+
*
|
| 58 |
+
* Unlike `curry`, this function curries the function from right to left.
|
| 59 |
+
*
|
| 60 |
+
* @param {(p1: P1, p2: P2, p3: P3) => R} func - The function to curry.
|
| 61 |
+
* @returns {(p3: P3) => (p2: P2) => (p1: P1) => R} A curried function.
|
| 62 |
+
*
|
| 63 |
+
* @example
|
| 64 |
+
* function threeArgFunc(a: number, b: number, c: number) {
|
| 65 |
+
* return [a, b, c];
|
| 66 |
+
* }
|
| 67 |
+
* const curriedThreeArgFunc = curryRight(threeArgFunc);
|
| 68 |
+
* const func = curriedThreeArgFunc(1);
|
| 69 |
+
* const func2 = func(2);
|
| 70 |
+
* console.log(func2(3)); // [3, 2, 1]
|
| 71 |
+
*/
|
| 72 |
+
declare function curryRight<P1, P2, P3, R>(func: (p1: P1, p2: P2, p3: P3) => R): (p3: P3) => (p2: P2) => (p1: P1) => R;
|
| 73 |
+
/**
|
| 74 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 75 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 76 |
+
*
|
| 77 |
+
* Unlike `curry`, this function curries the function from right to left.
|
| 78 |
+
*
|
| 79 |
+
* @param {(p1: P1, p2: P2, p3: P3, p4: P4) => R} func - The function to curry.
|
| 80 |
+
* @returns {(p4: P4) => (p3: P3) => (p2: P2) => (p1: P1) => R} A curried function.
|
| 81 |
+
*
|
| 82 |
+
* @example
|
| 83 |
+
* function fourArgFunc(a: number, b: number, c: number, d: number) {
|
| 84 |
+
* return [a, b, c, d];
|
| 85 |
+
* }
|
| 86 |
+
* const curriedFourArgFunc = curryRight(fourArgFunc);
|
| 87 |
+
* const func = curriedFourArgFunc(1);
|
| 88 |
+
* const func2 = func(2);
|
| 89 |
+
* const func3 = func2(3);
|
| 90 |
+
* console.log(func3(4)); // [4, 3, 2, 1]
|
| 91 |
+
*/
|
| 92 |
+
declare function curryRight<P1, P2, P3, P4, R>(func: (p1: P1, p2: P2, p3: P3, p4: P4) => R): (p4: P4) => (p3: P3) => (p2: P2) => (p1: P1) => R;
|
| 93 |
+
/**
|
| 94 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 95 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 96 |
+
*
|
| 97 |
+
* Unlike `curry`, this function curries the function from right to left.
|
| 98 |
+
*
|
| 99 |
+
* @param {(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R} func - The function to curry.
|
| 100 |
+
* @returns {(p5: P5) => (p4: P4) => (p3: P3) => (p2: P2) => (p1: P1) => R} A curried function.
|
| 101 |
+
*
|
| 102 |
+
* @example
|
| 103 |
+
* function fiveArgFunc(a: number, b: number, c: number, d: number, e: number) {
|
| 104 |
+
* return [a, b, c, d, e];
|
| 105 |
+
* }
|
| 106 |
+
* const curriedFiveArgFunc = curryRight(fiveArgFunc);
|
| 107 |
+
* const func = curriedFiveArgFunc(1);
|
| 108 |
+
* const func2 = func(2);
|
| 109 |
+
* const func3 = func2(3);
|
| 110 |
+
* const func4 = func3(4);
|
| 111 |
+
* console.log(func4(5)); // [5, 4, 3, 2, 1]
|
| 112 |
+
*/
|
| 113 |
+
declare function curryRight<P1, P2, P3, P4, P5, R>(func: (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R): (p5: P5) => (p4: P4) => (p3: P3) => (p2: P2) => (p1: P1) => R;
|
| 114 |
+
/**
|
| 115 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 116 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 117 |
+
*
|
| 118 |
+
* Unlike `curry`, this function curries the function from right to left.
|
| 119 |
+
*
|
| 120 |
+
* @param {(...args: any[]) => any} func - The function to curry.
|
| 121 |
+
* @returns {(...args: any[]) => any} A curried function.
|
| 122 |
+
*
|
| 123 |
+
* @example
|
| 124 |
+
* function sum(a: number, b: number, c: number) {
|
| 125 |
+
* return a + b + c;
|
| 126 |
+
* }
|
| 127 |
+
*
|
| 128 |
+
* const curriedSum = curryRight(sum);
|
| 129 |
+
*
|
| 130 |
+
* // The parameter `c` should be given the value `10`.
|
| 131 |
+
* const add10 = curriedSum(10);
|
| 132 |
+
*
|
| 133 |
+
* // The parameter `b` should be given the value `15`.
|
| 134 |
+
* const add25 = add10(15);
|
| 135 |
+
*
|
| 136 |
+
* // The parameter `a` should be given the value `5`. The function 'sum' has received all its arguments and will now return a value.
|
| 137 |
+
* const result = add25(5); // 30
|
| 138 |
+
*/
|
| 139 |
+
declare function curryRight(func: (...args: any[]) => any): (...args: any[]) => any;
|
| 140 |
+
//#endregion
|
| 141 |
+
export { curryRight };
|
tools/ui/node_modules/es-toolkit/dist/function/curryRight.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/curryRight.ts
|
| 2 |
+
/**
|
| 3 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 4 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 5 |
+
*
|
| 6 |
+
* Unlike `curry`, this function curries the function from right to left.
|
| 7 |
+
*
|
| 8 |
+
* @param {(...args: any[]) => any} func - The function to curry.
|
| 9 |
+
* @returns {(...args: any[]) => any} A curried function.
|
| 10 |
+
*
|
| 11 |
+
* @example
|
| 12 |
+
* function sum(a: number, b: number, c: number) {
|
| 13 |
+
* return a + b + c;
|
| 14 |
+
* }
|
| 15 |
+
*
|
| 16 |
+
* const curriedSum = curryRight(sum);
|
| 17 |
+
*
|
| 18 |
+
* // The parameter `c` should be given the value `10`.
|
| 19 |
+
* const add10 = curriedSum(10);
|
| 20 |
+
*
|
| 21 |
+
* // The parameter `b` should be given the value `15`.
|
| 22 |
+
* const add25 = add10(15);
|
| 23 |
+
*
|
| 24 |
+
* // The parameter `a` should be given the value `5`. The function 'sum' has received all its arguments and will now return a value.
|
| 25 |
+
* const result = add25(5); // 30
|
| 26 |
+
*/
|
| 27 |
+
function curryRight(func) {
|
| 28 |
+
if (func.length === 0 || func.length === 1) return func;
|
| 29 |
+
return function(arg) {
|
| 30 |
+
return makeCurryRight(func, func.length, [arg]);
|
| 31 |
+
};
|
| 32 |
+
}
|
| 33 |
+
function makeCurryRight(origin, argsLength, args) {
|
| 34 |
+
if (args.length === argsLength) return origin(...args);
|
| 35 |
+
else {
|
| 36 |
+
const next = function(arg) {
|
| 37 |
+
return makeCurryRight(origin, argsLength, [arg, ...args]);
|
| 38 |
+
};
|
| 39 |
+
return next;
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
//#endregion
|
| 43 |
+
exports.curryRight = curryRight;
|
tools/ui/node_modules/es-toolkit/dist/function/curryRight.mjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/curryRight.ts
|
| 2 |
+
/**
|
| 3 |
+
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
|
| 4 |
+
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
|
| 5 |
+
*
|
| 6 |
+
* Unlike `curry`, this function curries the function from right to left.
|
| 7 |
+
*
|
| 8 |
+
* @param {(...args: any[]) => any} func - The function to curry.
|
| 9 |
+
* @returns {(...args: any[]) => any} A curried function.
|
| 10 |
+
*
|
| 11 |
+
* @example
|
| 12 |
+
* function sum(a: number, b: number, c: number) {
|
| 13 |
+
* return a + b + c;
|
| 14 |
+
* }
|
| 15 |
+
*
|
| 16 |
+
* const curriedSum = curryRight(sum);
|
| 17 |
+
*
|
| 18 |
+
* // The parameter `c` should be given the value `10`.
|
| 19 |
+
* const add10 = curriedSum(10);
|
| 20 |
+
*
|
| 21 |
+
* // The parameter `b` should be given the value `15`.
|
| 22 |
+
* const add25 = add10(15);
|
| 23 |
+
*
|
| 24 |
+
* // The parameter `a` should be given the value `5`. The function 'sum' has received all its arguments and will now return a value.
|
| 25 |
+
* const result = add25(5); // 30
|
| 26 |
+
*/
|
| 27 |
+
function curryRight(func) {
|
| 28 |
+
if (func.length === 0 || func.length === 1) return func;
|
| 29 |
+
return function(arg) {
|
| 30 |
+
return makeCurryRight(func, func.length, [arg]);
|
| 31 |
+
};
|
| 32 |
+
}
|
| 33 |
+
function makeCurryRight(origin, argsLength, args) {
|
| 34 |
+
if (args.length === argsLength) return origin(...args);
|
| 35 |
+
else {
|
| 36 |
+
const next = function(arg) {
|
| 37 |
+
return makeCurryRight(origin, argsLength, [arg, ...args]);
|
| 38 |
+
};
|
| 39 |
+
return next;
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
//#endregion
|
| 43 |
+
export { curryRight };
|
tools/ui/node_modules/es-toolkit/dist/function/debounce.d.mts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/debounce.d.ts
|
| 2 |
+
interface DebounceOptions {
|
| 3 |
+
/**
|
| 4 |
+
* An optional AbortSignal to cancel the debounced function.
|
| 5 |
+
*/
|
| 6 |
+
signal?: AbortSignal;
|
| 7 |
+
/**
|
| 8 |
+
* An optional array specifying whether the function should be invoked on the leading edge, trailing edge, or both.
|
| 9 |
+
* If `edges` includes "leading", the function will be invoked at the start of the delay period.
|
| 10 |
+
* If `edges` includes "trailing", the function will be invoked at the end of the delay period.
|
| 11 |
+
* If both "leading" and "trailing" are included, the function will be invoked at both the start and end of the delay period.
|
| 12 |
+
* @default ["trailing"]
|
| 13 |
+
*/
|
| 14 |
+
edges?: Array<'leading' | 'trailing'>;
|
| 15 |
+
}
|
| 16 |
+
interface DebouncedFunction<F extends (...args: any[]) => void> {
|
| 17 |
+
(...args: Parameters<F>): void;
|
| 18 |
+
/**
|
| 19 |
+
* Schedules the execution of the debounced function after the specified debounce delay.
|
| 20 |
+
* This method resets any existing timer, ensuring that the function is only invoked
|
| 21 |
+
* after the delay has elapsed since the last call to the debounced function.
|
| 22 |
+
* It is typically called internally whenever the debounced function is invoked.
|
| 23 |
+
*
|
| 24 |
+
* @returns {void}
|
| 25 |
+
*/
|
| 26 |
+
schedule: () => void;
|
| 27 |
+
/**
|
| 28 |
+
* Cancels any pending execution of the debounced function.
|
| 29 |
+
* This method clears the active timer and resets any stored context or arguments.
|
| 30 |
+
*/
|
| 31 |
+
cancel: () => void;
|
| 32 |
+
/**
|
| 33 |
+
* Immediately invokes the debounced function if there is a pending execution.
|
| 34 |
+
* This method executes the function right away if there is a pending execution.
|
| 35 |
+
*/
|
| 36 |
+
flush: () => void;
|
| 37 |
+
}
|
| 38 |
+
/**
|
| 39 |
+
* Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds
|
| 40 |
+
* have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`
|
| 41 |
+
* method to cancel any pending execution.
|
| 42 |
+
*
|
| 43 |
+
* @template F - The type of function.
|
| 44 |
+
* @param {F} func - The function to debounce.
|
| 45 |
+
* @param {number} debounceMs - The number of milliseconds to delay.
|
| 46 |
+
* @param {DebounceOptions} options - The options object
|
| 47 |
+
* @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function.
|
| 48 |
+
* @returns A new debounced function with a `cancel` method.
|
| 49 |
+
*
|
| 50 |
+
* @example
|
| 51 |
+
* const debouncedFunction = debounce(() => {
|
| 52 |
+
* console.log('Function executed');
|
| 53 |
+
* }, 1000);
|
| 54 |
+
*
|
| 55 |
+
* // Will log 'Function executed' after 1 second if not called again in that time
|
| 56 |
+
* debouncedFunction();
|
| 57 |
+
*
|
| 58 |
+
* // Will not log anything as the previous call is canceled
|
| 59 |
+
* debouncedFunction.cancel();
|
| 60 |
+
*
|
| 61 |
+
* // With AbortSignal
|
| 62 |
+
* const controller = new AbortController();
|
| 63 |
+
* const signal = controller.signal;
|
| 64 |
+
* const debouncedWithSignal = debounce(() => {
|
| 65 |
+
* console.log('Function executed');
|
| 66 |
+
* }, 1000, { signal });
|
| 67 |
+
*
|
| 68 |
+
* debouncedWithSignal();
|
| 69 |
+
*
|
| 70 |
+
* // Will cancel the debounced function call
|
| 71 |
+
* controller.abort();
|
| 72 |
+
*/
|
| 73 |
+
declare function debounce<F extends (...args: any[]) => void>(func: F, debounceMs: number, {
|
| 74 |
+
signal,
|
| 75 |
+
edges
|
| 76 |
+
}?: DebounceOptions): DebouncedFunction<F>;
|
| 77 |
+
//#endregion
|
| 78 |
+
export { DebounceOptions, DebouncedFunction, debounce };
|
tools/ui/node_modules/es-toolkit/dist/function/debounce.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/debounce.d.ts
|
| 2 |
+
interface DebounceOptions {
|
| 3 |
+
/**
|
| 4 |
+
* An optional AbortSignal to cancel the debounced function.
|
| 5 |
+
*/
|
| 6 |
+
signal?: AbortSignal;
|
| 7 |
+
/**
|
| 8 |
+
* An optional array specifying whether the function should be invoked on the leading edge, trailing edge, or both.
|
| 9 |
+
* If `edges` includes "leading", the function will be invoked at the start of the delay period.
|
| 10 |
+
* If `edges` includes "trailing", the function will be invoked at the end of the delay period.
|
| 11 |
+
* If both "leading" and "trailing" are included, the function will be invoked at both the start and end of the delay period.
|
| 12 |
+
* @default ["trailing"]
|
| 13 |
+
*/
|
| 14 |
+
edges?: Array<'leading' | 'trailing'>;
|
| 15 |
+
}
|
| 16 |
+
interface DebouncedFunction<F extends (...args: any[]) => void> {
|
| 17 |
+
(...args: Parameters<F>): void;
|
| 18 |
+
/**
|
| 19 |
+
* Schedules the execution of the debounced function after the specified debounce delay.
|
| 20 |
+
* This method resets any existing timer, ensuring that the function is only invoked
|
| 21 |
+
* after the delay has elapsed since the last call to the debounced function.
|
| 22 |
+
* It is typically called internally whenever the debounced function is invoked.
|
| 23 |
+
*
|
| 24 |
+
* @returns {void}
|
| 25 |
+
*/
|
| 26 |
+
schedule: () => void;
|
| 27 |
+
/**
|
| 28 |
+
* Cancels any pending execution of the debounced function.
|
| 29 |
+
* This method clears the active timer and resets any stored context or arguments.
|
| 30 |
+
*/
|
| 31 |
+
cancel: () => void;
|
| 32 |
+
/**
|
| 33 |
+
* Immediately invokes the debounced function if there is a pending execution.
|
| 34 |
+
* This method executes the function right away if there is a pending execution.
|
| 35 |
+
*/
|
| 36 |
+
flush: () => void;
|
| 37 |
+
}
|
| 38 |
+
/**
|
| 39 |
+
* Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds
|
| 40 |
+
* have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`
|
| 41 |
+
* method to cancel any pending execution.
|
| 42 |
+
*
|
| 43 |
+
* @template F - The type of function.
|
| 44 |
+
* @param {F} func - The function to debounce.
|
| 45 |
+
* @param {number} debounceMs - The number of milliseconds to delay.
|
| 46 |
+
* @param {DebounceOptions} options - The options object
|
| 47 |
+
* @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function.
|
| 48 |
+
* @returns A new debounced function with a `cancel` method.
|
| 49 |
+
*
|
| 50 |
+
* @example
|
| 51 |
+
* const debouncedFunction = debounce(() => {
|
| 52 |
+
* console.log('Function executed');
|
| 53 |
+
* }, 1000);
|
| 54 |
+
*
|
| 55 |
+
* // Will log 'Function executed' after 1 second if not called again in that time
|
| 56 |
+
* debouncedFunction();
|
| 57 |
+
*
|
| 58 |
+
* // Will not log anything as the previous call is canceled
|
| 59 |
+
* debouncedFunction.cancel();
|
| 60 |
+
*
|
| 61 |
+
* // With AbortSignal
|
| 62 |
+
* const controller = new AbortController();
|
| 63 |
+
* const signal = controller.signal;
|
| 64 |
+
* const debouncedWithSignal = debounce(() => {
|
| 65 |
+
* console.log('Function executed');
|
| 66 |
+
* }, 1000, { signal });
|
| 67 |
+
*
|
| 68 |
+
* debouncedWithSignal();
|
| 69 |
+
*
|
| 70 |
+
* // Will cancel the debounced function call
|
| 71 |
+
* controller.abort();
|
| 72 |
+
*/
|
| 73 |
+
declare function debounce<F extends (...args: any[]) => void>(func: F, debounceMs: number, {
|
| 74 |
+
signal,
|
| 75 |
+
edges
|
| 76 |
+
}?: DebounceOptions): DebouncedFunction<F>;
|
| 77 |
+
//#endregion
|
| 78 |
+
export { DebounceOptions, DebouncedFunction, debounce };
|
tools/ui/node_modules/es-toolkit/dist/function/debounce.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/function/debounce.ts
|
| 2 |
+
/**
|
| 3 |
+
* Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds
|
| 4 |
+
* have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`
|
| 5 |
+
* method to cancel any pending execution.
|
| 6 |
+
*
|
| 7 |
+
* @template F - The type of function.
|
| 8 |
+
* @param {F} func - The function to debounce.
|
| 9 |
+
* @param {number} debounceMs - The number of milliseconds to delay.
|
| 10 |
+
* @param {DebounceOptions} options - The options object
|
| 11 |
+
* @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function.
|
| 12 |
+
* @returns A new debounced function with a `cancel` method.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* const debouncedFunction = debounce(() => {
|
| 16 |
+
* console.log('Function executed');
|
| 17 |
+
* }, 1000);
|
| 18 |
+
*
|
| 19 |
+
* // Will log 'Function executed' after 1 second if not called again in that time
|
| 20 |
+
* debouncedFunction();
|
| 21 |
+
*
|
| 22 |
+
* // Will not log anything as the previous call is canceled
|
| 23 |
+
* debouncedFunction.cancel();
|
| 24 |
+
*
|
| 25 |
+
* // With AbortSignal
|
| 26 |
+
* const controller = new AbortController();
|
| 27 |
+
* const signal = controller.signal;
|
| 28 |
+
* const debouncedWithSignal = debounce(() => {
|
| 29 |
+
* console.log('Function executed');
|
| 30 |
+
* }, 1000, { signal });
|
| 31 |
+
*
|
| 32 |
+
* debouncedWithSignal();
|
| 33 |
+
*
|
| 34 |
+
* // Will cancel the debounced function call
|
| 35 |
+
* controller.abort();
|
| 36 |
+
*/
|
| 37 |
+
function debounce(func, debounceMs, { signal, edges } = {}) {
|
| 38 |
+
let pendingThis = void 0;
|
| 39 |
+
let pendingArgs = null;
|
| 40 |
+
const leading = edges != null && edges.includes("leading");
|
| 41 |
+
const trailing = edges == null || edges.includes("trailing");
|
| 42 |
+
const invoke = () => {
|
| 43 |
+
if (pendingArgs !== null) {
|
| 44 |
+
func.apply(pendingThis, pendingArgs);
|
| 45 |
+
pendingThis = void 0;
|
| 46 |
+
pendingArgs = null;
|
| 47 |
+
}
|
| 48 |
+
};
|
| 49 |
+
const onTimerEnd = () => {
|
| 50 |
+
if (trailing) invoke();
|
| 51 |
+
cancel();
|
| 52 |
+
};
|
| 53 |
+
let timeoutId = null;
|
| 54 |
+
const schedule = () => {
|
| 55 |
+
if (timeoutId != null) clearTimeout(timeoutId);
|
| 56 |
+
timeoutId = setTimeout(() => {
|
| 57 |
+
timeoutId = null;
|
| 58 |
+
onTimerEnd();
|
| 59 |
+
}, debounceMs);
|
| 60 |
+
};
|
| 61 |
+
const cancelTimer = () => {
|
| 62 |
+
if (timeoutId !== null) {
|
| 63 |
+
clearTimeout(timeoutId);
|
| 64 |
+
timeoutId = null;
|
| 65 |
+
}
|
| 66 |
+
};
|
| 67 |
+
const cancel = () => {
|
| 68 |
+
cancelTimer();
|
| 69 |
+
pendingThis = void 0;
|
| 70 |
+
pendingArgs = null;
|
| 71 |
+
};
|
| 72 |
+
const flush = () => {
|
| 73 |
+
invoke();
|
| 74 |
+
};
|
| 75 |
+
const debounced = function(...args) {
|
| 76 |
+
if (signal?.aborted) return;
|
| 77 |
+
pendingThis = this;
|
| 78 |
+
pendingArgs = args;
|
| 79 |
+
const isFirstCall = timeoutId == null;
|
| 80 |
+
schedule();
|
| 81 |
+
if (leading && isFirstCall) invoke();
|
| 82 |
+
};
|
| 83 |
+
debounced.schedule = schedule;
|
| 84 |
+
debounced.cancel = cancel;
|
| 85 |
+
debounced.flush = flush;
|
| 86 |
+
signal?.addEventListener("abort", cancel, { once: true });
|
| 87 |
+
return debounced;
|
| 88 |
+
}
|
| 89 |
+
//#endregion
|
| 90 |
+
exports.debounce = debounce;
|