Project Init

This commit is contained in:
Muluhabt
2026-05-29 15:23:46 +03:00
commit 2fbc557aac
67387 changed files with 6063341 additions and 0 deletions

19
node_modules/es-toolkit/dist/compat/math/add.d.mts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
//#region src/compat/math/add.d.ts
/**
* Adds two numbers while safely handling `NaN` values.
*
* This function takes two numbers and returns their sum. If either of the numbers is `NaN`,
* the function returns `NaN`.
*
* @param {number} value - The first number to add.
* @param {number} other - The second number to add.
* @returns {number} The sum of the two numbers, or `NaN` if any input is `NaN`.
*
* @example
* const result1 = add(2, 3); // result1 will be 5
* const result2 = add(5, NaN); // result2 will be NaN
* const result3 = add(NaN, 10); // result3 will be NaN
*/
declare function add(value: number, other: number): number;
//#endregion
export { add };

19
node_modules/es-toolkit/dist/compat/math/add.d.ts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
//#region src/compat/math/add.d.ts
/**
* Adds two numbers while safely handling `NaN` values.
*
* This function takes two numbers and returns their sum. If either of the numbers is `NaN`,
* the function returns `NaN`.
*
* @param {number} value - The first number to add.
* @param {number} other - The second number to add.
* @returns {number} The sum of the two numbers, or `NaN` if any input is `NaN`.
*
* @example
* const result1 = add(2, 3); // result1 will be 5
* const result2 = add(5, NaN); // result2 will be NaN
* const result3 = add(NaN, 10); // result3 will be NaN
*/
declare function add(value: number, other: number): number;
//#endregion
export { add };

32
node_modules/es-toolkit/dist/compat/math/add.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
const require_toNumber = require("../util/toNumber.js");
const require_toString = require("../util/toString.js");
//#region src/compat/math/add.ts
/**
* Adds two numbers while safely handling `NaN` values.
*
* This function takes two numbers and returns their sum. If either of the numbers is `NaN`,
* the function returns `NaN`.
*
* @param {number} value - The first number to add.
* @param {number} other - The second number to add.
* @returns {number} The sum of the two numbers, or `NaN` if any input is `NaN`.
*
* @example
* const result1 = add(2, 3); // result1 will be 5
* const result2 = add(5, NaN); // result2 will be NaN
* const result3 = add(NaN, 10); // result3 will be NaN
*/
function add(value, other) {
if (value === void 0 && other === void 0) return 0;
if (value === void 0 || other === void 0) return value ?? other;
if (typeof value === "string" || typeof other === "string") {
value = require_toString.toString(value);
other = require_toString.toString(other);
} else {
value = require_toNumber.toNumber(value);
other = require_toNumber.toNumber(other);
}
return value + other;
}
//#endregion
exports.add = add;

32
node_modules/es-toolkit/dist/compat/math/add.mjs generated vendored Normal file
View File

@@ -0,0 +1,32 @@
import { toNumber } from "../util/toNumber.mjs";
import { toString } from "../util/toString.mjs";
//#region src/compat/math/add.ts
/**
* Adds two numbers while safely handling `NaN` values.
*
* This function takes two numbers and returns their sum. If either of the numbers is `NaN`,
* the function returns `NaN`.
*
* @param {number} value - The first number to add.
* @param {number} other - The second number to add.
* @returns {number} The sum of the two numbers, or `NaN` if any input is `NaN`.
*
* @example
* const result1 = add(2, 3); // result1 will be 5
* const result2 = add(5, NaN); // result2 will be NaN
* const result3 = add(NaN, 10); // result3 will be NaN
*/
function add(value, other) {
if (value === void 0 && other === void 0) return 0;
if (value === void 0 || other === void 0) return value ?? other;
if (typeof value === "string" || typeof other === "string") {
value = toString(value);
other = toString(other);
} else {
value = toNumber(value);
other = toNumber(other);
}
return value + other;
}
//#endregion
export { add };

16
node_modules/es-toolkit/dist/compat/math/ceil.d.mts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
//#region src/compat/math/ceil.d.ts
/**
* Computes number rounded up to precision.
*
* @param {number | string} number The number to round up.
* @param {number | string} precision The precision to round up to.
* @returns {number} Returns the rounded up number.
*
* @example
* ceil(4.006); // => 5
* ceil(6.004, 2); // => 6.01
* ceil(6040, -2); // => 6100
*/
declare function ceil(number: number, precision?: number): number;
//#endregion
export { ceil };

16
node_modules/es-toolkit/dist/compat/math/ceil.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
//#region src/compat/math/ceil.d.ts
/**
* Computes number rounded up to precision.
*
* @param {number | string} number The number to round up.
* @param {number | string} precision The precision to round up to.
* @returns {number} Returns the rounded up number.
*
* @example
* ceil(4.006); // => 5
* ceil(6.004, 2); // => 6.01
* ceil(6040, -2); // => 6100
*/
declare function ceil(number: number, precision?: number): number;
//#endregion
export { ceil };

19
node_modules/es-toolkit/dist/compat/math/ceil.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
const require_decimalAdjust = require("../_internal/decimalAdjust.js");
//#region src/compat/math/ceil.ts
/**
* Computes number rounded up to precision.
*
* @param {number | string} number The number to round up.
* @param {number | string} precision The precision to round up to.
* @returns {number} Returns the rounded up number.
*
* @example
* ceil(4.006); // => 5
* ceil(6.004, 2); // => 6.01
* ceil(6040, -2); // => 6100
*/
function ceil(number, precision = 0) {
return require_decimalAdjust.decimalAdjust("ceil", number, precision);
}
//#endregion
exports.ceil = ceil;

19
node_modules/es-toolkit/dist/compat/math/ceil.mjs generated vendored Normal file
View File

@@ -0,0 +1,19 @@
import { decimalAdjust } from "../_internal/decimalAdjust.mjs";
//#region src/compat/math/ceil.ts
/**
* Computes number rounded up to precision.
*
* @param {number | string} number The number to round up.
* @param {number | string} precision The precision to round up to.
* @returns {number} Returns the rounded up number.
*
* @example
* ceil(4.006); // => 5
* ceil(6.004, 2); // => 6.01
* ceil(6040, -2); // => 6100
*/
function ceil(number, precision = 0) {
return decimalAdjust("ceil", number, precision);
}
//#endregion
export { ceil };

27
node_modules/es-toolkit/dist/compat/math/clamp.d.mts generated vendored Normal file
View File

@@ -0,0 +1,27 @@
//#region src/compat/math/clamp.d.ts
/**
* Clamps a number within the specified bounds.
*
* @param {number} number The number to clamp
* @param {number} lower The lower bound
* @param {number} upper The upper bound
* @returns {number} Returns the clamped number
* @example
* clamp(3, 2, 4) // => 3
* clamp(0, 5, 10) // => 5
* clamp(15, 5, 10) // => 10
*/
declare function clamp(number: number, lower: number, upper: number): number;
/**
* Clamps a number to an upper bound.
*
* @param {number} number The number to clamp
* @param {number} upper The upper bound
* @returns {number} Returns the clamped number
* @example
* clamp(5, 3) // => 3
* clamp(2, 3) // => 2
*/
declare function clamp(number: number, upper: number): number;
//#endregion
export { clamp };

27
node_modules/es-toolkit/dist/compat/math/clamp.d.ts generated vendored Normal file
View File

@@ -0,0 +1,27 @@
//#region src/compat/math/clamp.d.ts
/**
* Clamps a number within the specified bounds.
*
* @param {number} number The number to clamp
* @param {number} lower The lower bound
* @param {number} upper The upper bound
* @returns {number} Returns the clamped number
* @example
* clamp(3, 2, 4) // => 3
* clamp(0, 5, 10) // => 5
* clamp(15, 5, 10) // => 10
*/
declare function clamp(number: number, lower: number, upper: number): number;
/**
* Clamps a number to an upper bound.
*
* @param {number} number The number to clamp
* @param {number} upper The upper bound
* @returns {number} Returns the clamped number
* @example
* clamp(5, 3) // => 3
* clamp(2, 3) // => 2
*/
declare function clamp(number: number, upper: number): number;
//#endregion
export { clamp };

36
node_modules/es-toolkit/dist/compat/math/clamp.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
const require_toNumber = require("../util/toNumber.js");
//#region src/compat/math/clamp.ts
/**
* Clamps a number within the specified bounds.
*
* This function takes a number and one or two bounds, and returns the number clamped within the specified bounds.
* If only one bound is provided, it returns the minimum of the value and the bound.
*
* @param {number} value - The number to clamp.
* @param {number} bound1 - The minimum bound to clamp the number, or the maximum bound if bound2 is not provided.
* @param {number} [bound2] - The maximum bound to clamp the number. If not provided, the function will only consider bound1 as the upper limit.
* @returns {number} The clamped number within the specified bounds.
*
* @example
* const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5
* const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15
* const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5
* const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15
*/
function clamp(value, bound1, bound2) {
if (bound2 === void 0) {
bound2 = bound1;
bound1 = void 0;
}
if (bound2 !== void 0) {
bound2 = require_toNumber.toNumber(bound2);
value = Math.min(value, Number.isNaN(bound2) ? 0 : bound2);
}
if (bound1 !== void 0) {
bound1 = require_toNumber.toNumber(bound1);
value = Math.max(value, Number.isNaN(bound1) ? 0 : bound1);
}
return value;
}
//#endregion
exports.clamp = clamp;

36
node_modules/es-toolkit/dist/compat/math/clamp.mjs generated vendored Normal file
View File

@@ -0,0 +1,36 @@
import { toNumber } from "../util/toNumber.mjs";
//#region src/compat/math/clamp.ts
/**
* Clamps a number within the specified bounds.
*
* This function takes a number and one or two bounds, and returns the number clamped within the specified bounds.
* If only one bound is provided, it returns the minimum of the value and the bound.
*
* @param {number} value - The number to clamp.
* @param {number} bound1 - The minimum bound to clamp the number, or the maximum bound if bound2 is not provided.
* @param {number} [bound2] - The maximum bound to clamp the number. If not provided, the function will only consider bound1 as the upper limit.
* @returns {number} The clamped number within the specified bounds.
*
* @example
* const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5
* const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15
* const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5
* const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15
*/
function clamp(value, bound1, bound2) {
if (bound2 === void 0) {
bound2 = bound1;
bound1 = void 0;
}
if (bound2 !== void 0) {
bound2 = toNumber(bound2);
value = Math.min(value, Number.isNaN(bound2) ? 0 : bound2);
}
if (bound1 !== void 0) {
bound1 = toNumber(bound1);
value = Math.max(value, Number.isNaN(bound1) ? 0 : bound1);
}
return value;
}
//#endregion
export { clamp };

19
node_modules/es-toolkit/dist/compat/math/divide.d.mts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
//#region src/compat/math/divide.d.ts
/**
* Divide two numbers.
*
* If either of the numbers is `NaN`, the function returns `NaN`.
*
* @param {number} value The first number in a division.
* @param {number} other The second number in a division.
* @returns {number} The quotient of value and other.
*
* @example
* divide(6, 3); // => 2
* divide(2, NaN); // => NaN
* divide(NaN, 3); // => NaN
* divide(NaN, NaN); // => NaN
*/
declare function divide(value: number, other: number): number;
//#endregion
export { divide };

19
node_modules/es-toolkit/dist/compat/math/divide.d.ts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
//#region src/compat/math/divide.d.ts
/**
* Divide two numbers.
*
* If either of the numbers is `NaN`, the function returns `NaN`.
*
* @param {number} value The first number in a division.
* @param {number} other The second number in a division.
* @returns {number} The quotient of value and other.
*
* @example
* divide(6, 3); // => 2
* divide(2, NaN); // => NaN
* divide(NaN, 3); // => NaN
* divide(NaN, NaN); // => NaN
*/
declare function divide(value: number, other: number): number;
//#endregion
export { divide };

32
node_modules/es-toolkit/dist/compat/math/divide.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
const require_toNumber = require("../util/toNumber.js");
const require_toString = require("../util/toString.js");
//#region src/compat/math/divide.ts
/**
* Divide two numbers.
*
* If either of the numbers is `NaN`, the function returns `NaN`.
*
* @param {number} value The first number in a division.
* @param {number} other The second number in a division.
* @returns {number} The quotient of value and other.
*
* @example
* divide(6, 3); // => 2
* divide(2, NaN); // => NaN
* divide(NaN, 3); // => NaN
* divide(NaN, NaN); // => NaN
*/
function divide(value, other) {
if (value === void 0 && other === void 0) return 1;
if (value === void 0 || other === void 0) return value ?? other;
if (typeof value === "string" || typeof other === "string") {
value = require_toString.toString(value);
other = require_toString.toString(other);
} else {
value = require_toNumber.toNumber(value);
other = require_toNumber.toNumber(other);
}
return value / other;
}
//#endregion
exports.divide = divide;

32
node_modules/es-toolkit/dist/compat/math/divide.mjs generated vendored Normal file
View File

@@ -0,0 +1,32 @@
import { toNumber } from "../util/toNumber.mjs";
import { toString } from "../util/toString.mjs";
//#region src/compat/math/divide.ts
/**
* Divide two numbers.
*
* If either of the numbers is `NaN`, the function returns `NaN`.
*
* @param {number} value The first number in a division.
* @param {number} other The second number in a division.
* @returns {number} The quotient of value and other.
*
* @example
* divide(6, 3); // => 2
* divide(2, NaN); // => NaN
* divide(NaN, 3); // => NaN
* divide(NaN, NaN); // => NaN
*/
function divide(value, other) {
if (value === void 0 && other === void 0) return 1;
if (value === void 0 || other === void 0) return value ?? other;
if (typeof value === "string" || typeof other === "string") {
value = toString(value);
other = toString(other);
} else {
value = toNumber(value);
other = toNumber(other);
}
return value / other;
}
//#endregion
export { divide };

16
node_modules/es-toolkit/dist/compat/math/floor.d.mts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
//#region src/compat/math/floor.d.ts
/**
* Computes number rounded down to precision.
*
* @param {number | string} number The number to round down.
* @param {number | string} precision The precision to round down to.
* @returns {number} Returns the rounded down number.
*
* @example
* floor(4.006); // => 4
* floor(0.046, 2); // => 0.04
* floor(4060, -2); // => 4000
*/
declare function floor(number: number, precision?: number): number;
//#endregion
export { floor };

16
node_modules/es-toolkit/dist/compat/math/floor.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
//#region src/compat/math/floor.d.ts
/**
* Computes number rounded down to precision.
*
* @param {number | string} number The number to round down.
* @param {number | string} precision The precision to round down to.
* @returns {number} Returns the rounded down number.
*
* @example
* floor(4.006); // => 4
* floor(0.046, 2); // => 0.04
* floor(4060, -2); // => 4000
*/
declare function floor(number: number, precision?: number): number;
//#endregion
export { floor };

19
node_modules/es-toolkit/dist/compat/math/floor.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
const require_decimalAdjust = require("../_internal/decimalAdjust.js");
//#region src/compat/math/floor.ts
/**
* Computes number rounded down to precision.
*
* @param {number | string} number The number to round down.
* @param {number | string} precision The precision to round down to.
* @returns {number} Returns the rounded down number.
*
* @example
* floor(4.006); // => 4
* floor(0.046, 2); // => 0.04
* floor(4060, -2); // => 4000
*/
function floor(number, precision = 0) {
return require_decimalAdjust.decimalAdjust("floor", number, precision);
}
//#endregion
exports.floor = floor;

19
node_modules/es-toolkit/dist/compat/math/floor.mjs generated vendored Normal file
View File

@@ -0,0 +1,19 @@
import { decimalAdjust } from "../_internal/decimalAdjust.mjs";
//#region src/compat/math/floor.ts
/**
* Computes number rounded down to precision.
*
* @param {number | string} number The number to round down.
* @param {number | string} precision The precision to round down to.
* @returns {number} Returns the rounded down number.
*
* @example
* floor(4.006); // => 4
* floor(0.046, 2); // => 0.04
* floor(4060, -2); // => 4000
*/
function floor(number, precision = 0) {
return decimalAdjust("floor", number, precision);
}
//#endregion
export { floor };

18
node_modules/es-toolkit/dist/compat/math/inRange.d.mts generated vendored Normal file
View File

@@ -0,0 +1,18 @@
//#region src/compat/math/inRange.d.ts
/**
* Checks if the value is within a specified range.
*
* @param {number} value The value to check.
* @param {number} minimum The lower bound of the range (inclusive).
* @param {number} maximum The upper bound of the range (exclusive).
* @returns {boolean} `true` if the value is within the specified range, otherwise `false`.
* @throws {Error} Throws an error if the `minimum` is greater or equal than the `maximum`.
*
* @example
* const result1 = inRange(3, 5); // result1 will be true.
* const result2 = inRange(1, 2, 5); // result2 will be false.
* const result3 = inRange(1, 5, 2); // If the minimum is greater or equal than the maximum, an error is thrown.
*/
declare function inRange(value: number, minimum: number, maximum?: number): boolean;
//#endregion
export { inRange };

18
node_modules/es-toolkit/dist/compat/math/inRange.d.ts generated vendored Normal file
View File

@@ -0,0 +1,18 @@
//#region src/compat/math/inRange.d.ts
/**
* Checks if the value is within a specified range.
*
* @param {number} value The value to check.
* @param {number} minimum The lower bound of the range (inclusive).
* @param {number} maximum The upper bound of the range (exclusive).
* @returns {boolean} `true` if the value is within the specified range, otherwise `false`.
* @throws {Error} Throws an error if the `minimum` is greater or equal than the `maximum`.
*
* @example
* const result1 = inRange(3, 5); // result1 will be true.
* const result2 = inRange(1, 2, 5); // result2 will be false.
* const result3 = inRange(1, 5, 2); // If the minimum is greater or equal than the maximum, an error is thrown.
*/
declare function inRange(value: number, minimum: number, maximum?: number): boolean;
//#endregion
export { inRange };

28
node_modules/es-toolkit/dist/compat/math/inRange.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
const require_inRange = require("../../math/inRange.js");
//#region src/compat/math/inRange.ts
/**
* Checks if the value is within a specified range.
*
* @param {number} value The value to check.
* @param {number} minimum The lower bound of the range (inclusive).
* @param {number} maximum The upper bound of the range (exclusive).
* @returns {boolean} `true` if the value is within the specified range, otherwise `false`.
* @throws {Error} Throws an error if the `minimum` is greater or equal than the `maximum`.
*
* @example
* const result1 = inRange(3, 5); // result1 will be true.
* const result2 = inRange(1, 2, 5); // result2 will be false.
* const result3 = inRange(1, 5, 2); // If the minimum is greater or equal than the maximum, an error is thrown.
*/
function inRange(value, minimum, maximum) {
if (!minimum) minimum = 0;
if (maximum != null && !maximum) maximum = 0;
if (minimum != null && typeof minimum !== "number") minimum = Number(minimum);
if (maximum == null && minimum === 0) return false;
if (maximum != null && typeof maximum !== "number") maximum = Number(maximum);
if (maximum != null && minimum > maximum) [minimum, maximum] = [maximum, minimum];
if (minimum === maximum) return false;
return require_inRange.inRange(value, minimum, maximum);
}
//#endregion
exports.inRange = inRange;

28
node_modules/es-toolkit/dist/compat/math/inRange.mjs generated vendored Normal file
View File

@@ -0,0 +1,28 @@
import { inRange as inRange$1 } from "../../math/inRange.mjs";
//#region src/compat/math/inRange.ts
/**
* Checks if the value is within a specified range.
*
* @param {number} value The value to check.
* @param {number} minimum The lower bound of the range (inclusive).
* @param {number} maximum The upper bound of the range (exclusive).
* @returns {boolean} `true` if the value is within the specified range, otherwise `false`.
* @throws {Error} Throws an error if the `minimum` is greater or equal than the `maximum`.
*
* @example
* const result1 = inRange(3, 5); // result1 will be true.
* const result2 = inRange(1, 2, 5); // result2 will be false.
* const result3 = inRange(1, 5, 2); // If the minimum is greater or equal than the maximum, an error is thrown.
*/
function inRange(value, minimum, maximum) {
if (!minimum) minimum = 0;
if (maximum != null && !maximum) maximum = 0;
if (minimum != null && typeof minimum !== "number") minimum = Number(minimum);
if (maximum == null && minimum === 0) return false;
if (maximum != null && typeof maximum !== "number") maximum = Number(maximum);
if (maximum != null && minimum > maximum) [minimum, maximum] = [maximum, minimum];
if (minimum === maximum) return false;
return inRange$1(value, minimum, maximum);
}
//#endregion
export { inRange };

11
node_modules/es-toolkit/dist/compat/math/max.d.mts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
//#region src/compat/math/max.d.ts
/**
* Finds the element in an array that has the maximum value.
*
* @template T - The type of elements in the array.
* @param {ArrayLike<T> | null | undefined} [items] - The array of elements to search. Defaults to an empty array.
* @returns {T | undefined} - The element with the maximum value, or undefined if the array is empty.
*/
declare function max<T>(items: ArrayLike<T> | null | undefined): T | undefined;
//#endregion
export { max };

11
node_modules/es-toolkit/dist/compat/math/max.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
//#region src/compat/math/max.d.ts
/**
* Finds the element in an array that has the maximum value.
*
* @template T - The type of elements in the array.
* @param {ArrayLike<T> | null | undefined} [items] - The array of elements to search. Defaults to an empty array.
* @returns {T | undefined} - The element with the maximum value, or undefined if the array is empty.
*/
declare function max<T>(items: ArrayLike<T> | null | undefined): T | undefined;
//#endregion
export { max };

20
node_modules/es-toolkit/dist/compat/math/max.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
//#region src/compat/math/max.ts
/**
* Finds the element in an array that has the maximum value.
*
* @template T - The type of elements in the array.
* @param {ArrayLike<T> | null | undefined} [items] - The array of elements to search. Defaults to an empty array.
* @returns {T | undefined} - The element with the maximum value, or undefined if the array is empty.
*/
function max(items) {
if (!items || items.length === 0) return;
let maxResult = void 0;
for (let i = 0; i < items.length; i++) {
const current = items[i];
if (current == null || Number.isNaN(current) || typeof current === "symbol") continue;
if (maxResult === void 0 || current > maxResult) maxResult = current;
}
return maxResult;
}
//#endregion
exports.max = max;

20
node_modules/es-toolkit/dist/compat/math/max.mjs generated vendored Normal file
View File

@@ -0,0 +1,20 @@
//#region src/compat/math/max.ts
/**
* Finds the element in an array that has the maximum value.
*
* @template T - The type of elements in the array.
* @param {ArrayLike<T> | null | undefined} [items] - The array of elements to search. Defaults to an empty array.
* @returns {T | undefined} - The element with the maximum value, or undefined if the array is empty.
*/
function max(items) {
if (!items || items.length === 0) return;
let maxResult = void 0;
for (let i = 0; i < items.length; i++) {
const current = items[i];
if (current == null || Number.isNaN(current) || typeof current === "symbol") continue;
if (maxResult === void 0 || current > maxResult) maxResult = current;
}
return maxResult;
}
//#endregion
export { max };

34
node_modules/es-toolkit/dist/compat/math/maxBy.d.mts generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import { ValueIteratee } from "../_internal/ValueIteratee.mjs";
//#region src/compat/math/maxBy.d.ts
/**
* Finds the element in an array that has the maximum value when applying
* the `iteratee` to each element.
*
* @template T - The type of elements in the array.
* @param {ArrayLike<T> | null | undefined} items The array of elements to search.
* @param {ValueIteratee<T>} iteratee
* The criteria used to determine the maximum value.
* - If a **function** is provided, it extracts a numeric value from each element.
* - If a **string** is provided, it is treated as a key to extract values from the objects.
* - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair.
* - If an **object** is provided, it matches elements that contain the specified properties.
* @returns {T | undefined} The element with the maximum value as determined by the `iteratee`.
* @example
* maxBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 3 }
* maxBy([], x => x.a); // Returns: undefined
* maxBy(
* [
* { name: 'john', age: 30 },
* { name: 'jane', age: 28 },
* { name: 'joe', age: 26 },
* ],
* x => x.age
* ); // Returns: { name: 'john', age: 30 }
* maxBy([{ a: 1 }, { a: 2 }], 'a'); // Returns: { a: 2 }
* maxBy([{ a: 1 }, { a: 2 }], ['a', 1]); // Returns: { a: 1 }
* maxBy([{ a: 1 }, { a: 2 }], { a: 1 }); // Returns: { a: 1 }
*/
declare function maxBy<T>(items: ArrayLike<T> | null | undefined, iteratee?: ValueIteratee<T>): T | undefined;
//#endregion
export { maxBy };

34
node_modules/es-toolkit/dist/compat/math/maxBy.d.ts generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import { ValueIteratee } from "../_internal/ValueIteratee.js";
//#region src/compat/math/maxBy.d.ts
/**
* Finds the element in an array that has the maximum value when applying
* the `iteratee` to each element.
*
* @template T - The type of elements in the array.
* @param {ArrayLike<T> | null | undefined} items The array of elements to search.
* @param {ValueIteratee<T>} iteratee
* The criteria used to determine the maximum value.
* - If a **function** is provided, it extracts a numeric value from each element.
* - If a **string** is provided, it is treated as a key to extract values from the objects.
* - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair.
* - If an **object** is provided, it matches elements that contain the specified properties.
* @returns {T | undefined} The element with the maximum value as determined by the `iteratee`.
* @example
* maxBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 3 }
* maxBy([], x => x.a); // Returns: undefined
* maxBy(
* [
* { name: 'john', age: 30 },
* { name: 'jane', age: 28 },
* { name: 'joe', age: 26 },
* ],
* x => x.age
* ); // Returns: { name: 'john', age: 30 }
* maxBy([{ a: 1 }, { a: 2 }], 'a'); // Returns: { a: 2 }
* maxBy([{ a: 1 }, { a: 2 }], ['a', 1]); // Returns: { a: 1 }
* maxBy([{ a: 1 }, { a: 2 }], { a: 1 }); // Returns: { a: 1 }
*/
declare function maxBy<T>(items: ArrayLike<T> | null | undefined, iteratee?: ValueIteratee<T>): T | undefined;
//#endregion
export { maxBy };

38
node_modules/es-toolkit/dist/compat/math/maxBy.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
const require_maxBy = require("../../array/maxBy.js");
const require_identity = require("../../function/identity.js");
const require_iteratee = require("../util/iteratee.js");
//#region src/compat/math/maxBy.ts
/**
* Finds the element in an array that has the maximum value when applying
* the `iteratee` to each element.
*
* @template T - The type of elements in the array.
* @param {ArrayLike<T> | null | undefined} items The array of elements to search.
* @param {ValueIteratee<T>} iteratee
* The criteria used to determine the maximum value.
* - If a **function** is provided, it extracts a numeric value from each element.
* - If a **string** is provided, it is treated as a key to extract values from the objects.
* - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair.
* - If an **object** is provided, it matches elements that contain the specified properties.
* @returns {T | undefined} The element with the maximum value as determined by the `iteratee`.
* @example
* maxBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 3 }
* maxBy([], x => x.a); // Returns: undefined
* maxBy(
* [
* { name: 'john', age: 30 },
* { name: 'jane', age: 28 },
* { name: 'joe', age: 26 },
* ],
* x => x.age
* ); // Returns: { name: 'john', age: 30 }
* maxBy([{ a: 1 }, { a: 2 }], 'a'); // Returns: { a: 2 }
* maxBy([{ a: 1 }, { a: 2 }], ['a', 1]); // Returns: { a: 1 }
* maxBy([{ a: 1 }, { a: 2 }], { a: 1 }); // Returns: { a: 1 }
*/
function maxBy(items, iteratee$1) {
if (items == null) return;
return require_maxBy.maxBy(Array.from(items), require_iteratee.iteratee(iteratee$1 ?? require_identity.identity));
}
//#endregion
exports.maxBy = maxBy;

38
node_modules/es-toolkit/dist/compat/math/maxBy.mjs generated vendored Normal file
View File

@@ -0,0 +1,38 @@
import { maxBy as maxBy$1 } from "../../array/maxBy.mjs";
import { identity } from "../../function/identity.mjs";
import { iteratee } from "../util/iteratee.mjs";
//#region src/compat/math/maxBy.ts
/**
* Finds the element in an array that has the maximum value when applying
* the `iteratee` to each element.
*
* @template T - The type of elements in the array.
* @param {ArrayLike<T> | null | undefined} items The array of elements to search.
* @param {ValueIteratee<T>} iteratee
* The criteria used to determine the maximum value.
* - If a **function** is provided, it extracts a numeric value from each element.
* - If a **string** is provided, it is treated as a key to extract values from the objects.
* - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair.
* - If an **object** is provided, it matches elements that contain the specified properties.
* @returns {T | undefined} The element with the maximum value as determined by the `iteratee`.
* @example
* maxBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 3 }
* maxBy([], x => x.a); // Returns: undefined
* maxBy(
* [
* { name: 'john', age: 30 },
* { name: 'jane', age: 28 },
* { name: 'joe', age: 26 },
* ],
* x => x.age
* ); // Returns: { name: 'john', age: 30 }
* maxBy([{ a: 1 }, { a: 2 }], 'a'); // Returns: { a: 2 }
* maxBy([{ a: 1 }, { a: 2 }], ['a', 1]); // Returns: { a: 1 }
* maxBy([{ a: 1 }, { a: 2 }], { a: 1 }); // Returns: { a: 1 }
*/
function maxBy(items, iteratee$1) {
if (items == null) return;
return maxBy$1(Array.from(items), iteratee(iteratee$1 ?? identity));
}
//#endregion
export { maxBy };

17
node_modules/es-toolkit/dist/compat/math/mean.d.mts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
//#region src/compat/math/mean.d.ts
/**
* Calculates the average of an array of numbers.
*
* If the array is empty, this function returns `NaN`.
*
* @param {ArrayLike<any> | null | undefined} nums - An array of numbers to calculate the average.
* @returns {number} The average of all the numbers in the array.
*
* @example
* const numbers = [1, 2, 3, 4, 5];
* const result = mean(numbers);
* // result will be 3
*/
declare function mean(nums: ArrayLike<any> | null | undefined): number;
//#endregion
export { mean };

17
node_modules/es-toolkit/dist/compat/math/mean.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
//#region src/compat/math/mean.d.ts
/**
* Calculates the average of an array of numbers.
*
* If the array is empty, this function returns `NaN`.
*
* @param {ArrayLike<any> | null | undefined} nums - An array of numbers to calculate the average.
* @returns {number} The average of all the numbers in the array.
*
* @example
* const numbers = [1, 2, 3, 4, 5];
* const result = mean(numbers);
* // result will be 3
*/
declare function mean(nums: ArrayLike<any> | null | undefined): number;
//#endregion
export { mean };

21
node_modules/es-toolkit/dist/compat/math/mean.js generated vendored Normal file
View File

@@ -0,0 +1,21 @@
const require_sum = require("./sum.js");
//#region src/compat/math/mean.ts
/**
* Calculates the average of an array of numbers.
*
* If the array is empty, this function returns `NaN`.
*
* @param {ArrayLike<any> | null | undefined} nums - An array of numbers to calculate the average.
* @returns {number} The average of all the numbers in the array.
*
* @example
* const numbers = [1, 2, 3, 4, 5];
* const result = mean(numbers);
* // result will be 3
*/
function mean(nums) {
const length = nums ? nums.length : 0;
return length === 0 ? NaN : require_sum.sum(nums) / length;
}
//#endregion
exports.mean = mean;

21
node_modules/es-toolkit/dist/compat/math/mean.mjs generated vendored Normal file
View File

@@ -0,0 +1,21 @@
import { sum } from "./sum.mjs";
//#region src/compat/math/mean.ts
/**
* Calculates the average of an array of numbers.
*
* If the array is empty, this function returns `NaN`.
*
* @param {ArrayLike<any> | null | undefined} nums - An array of numbers to calculate the average.
* @returns {number} The average of all the numbers in the array.
*
* @example
* const numbers = [1, 2, 3, 4, 5];
* const result = mean(numbers);
* // result will be 3
*/
function mean(nums) {
const length = nums ? nums.length : 0;
return length === 0 ? NaN : sum(nums) / length;
}
//#endregion
export { mean };

28
node_modules/es-toolkit/dist/compat/math/meanBy.d.mts generated vendored Normal file
View File

@@ -0,0 +1,28 @@
import { ValueIteratee } from "../_internal/ValueIteratee.mjs";
//#region src/compat/math/meanBy.d.ts
/**
* Calculates the average of an array of numbers when applying
* the `iteratee` function to each element.
*
* If the array is empty, this function returns `NaN`.
*
* @template T - The type of elements in the array.
* @param {T[]} items An array to calculate the average.
* @param {((element: T) => unknown) | PropertyKey | [PropertyKey, any] | PartialShallow<T>} iteratee
* The criteria used to determine the maximum value.
* - If a **function** is provided, it extracts a numeric value from each element.
* - If a **string** is provided, it is treated as a key to extract values from the objects.
* - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair.
* - If an **object** is provided, it matches elements that contain the specified properties.
* @returns {number} The average of all the numbers as determined by the `iteratee` function.
*
* @example
* meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2
* meanBy([], x => x.a); // Returns: NaN
* meanBy([[2], [3], [1]], 0); // Returns: 2
* meanBy([{ a: 2 }, { a: 3 }, { a: 1 }], 'a'); // Returns: 2
*/
declare function meanBy<T>(items: ArrayLike<T> | null | undefined, iteratee?: ValueIteratee<T>): number;
//#endregion
export { meanBy };

28
node_modules/es-toolkit/dist/compat/math/meanBy.d.ts generated vendored Normal file
View File

@@ -0,0 +1,28 @@
import { ValueIteratee } from "../_internal/ValueIteratee.js";
//#region src/compat/math/meanBy.d.ts
/**
* Calculates the average of an array of numbers when applying
* the `iteratee` function to each element.
*
* If the array is empty, this function returns `NaN`.
*
* @template T - The type of elements in the array.
* @param {T[]} items An array to calculate the average.
* @param {((element: T) => unknown) | PropertyKey | [PropertyKey, any] | PartialShallow<T>} iteratee
* The criteria used to determine the maximum value.
* - If a **function** is provided, it extracts a numeric value from each element.
* - If a **string** is provided, it is treated as a key to extract values from the objects.
* - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair.
* - If an **object** is provided, it matches elements that contain the specified properties.
* @returns {number} The average of all the numbers as determined by the `iteratee` function.
*
* @example
* meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2
* meanBy([], x => x.a); // Returns: NaN
* meanBy([[2], [3], [1]], 0); // Returns: 2
* meanBy([{ a: 2 }, { a: 3 }, { a: 1 }], 'a'); // Returns: 2
*/
declare function meanBy<T>(items: ArrayLike<T> | null | undefined, iteratee?: ValueIteratee<T>): number;
//#endregion
export { meanBy };

32
node_modules/es-toolkit/dist/compat/math/meanBy.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
const require_identity = require("../../function/identity.js");
const require_meanBy = require("../../math/meanBy.js");
const require_iteratee = require("../util/iteratee.js");
//#region src/compat/math/meanBy.ts
/**
* Calculates the average of an array of numbers when applying
* the `iteratee` function to each element.
*
* If the array is empty, this function returns `NaN`.
*
* @template T - The type of elements in the array.
* @param {T[]} items An array to calculate the average.
* @param {((element: T) => unknown) | PropertyKey | [PropertyKey, any] | PartialShallow<T>} iteratee
* The criteria used to determine the maximum value.
* - If a **function** is provided, it extracts a numeric value from each element.
* - If a **string** is provided, it is treated as a key to extract values from the objects.
* - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair.
* - If an **object** is provided, it matches elements that contain the specified properties.
* @returns {number} The average of all the numbers as determined by the `iteratee` function.
*
* @example
* meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2
* meanBy([], x => x.a); // Returns: NaN
* meanBy([[2], [3], [1]], 0); // Returns: 2
* meanBy([{ a: 2 }, { a: 3 }, { a: 1 }], 'a'); // Returns: 2
*/
function meanBy(items, iteratee$1) {
if (items == null) return NaN;
return require_meanBy.meanBy(Array.from(items), require_iteratee.iteratee(iteratee$1 ?? require_identity.identity));
}
//#endregion
exports.meanBy = meanBy;

32
node_modules/es-toolkit/dist/compat/math/meanBy.mjs generated vendored Normal file
View File

@@ -0,0 +1,32 @@
import { identity } from "../../function/identity.mjs";
import { meanBy as meanBy$1 } from "../../math/meanBy.mjs";
import { iteratee } from "../util/iteratee.mjs";
//#region src/compat/math/meanBy.ts
/**
* Calculates the average of an array of numbers when applying
* the `iteratee` function to each element.
*
* If the array is empty, this function returns `NaN`.
*
* @template T - The type of elements in the array.
* @param {T[]} items An array to calculate the average.
* @param {((element: T) => unknown) | PropertyKey | [PropertyKey, any] | PartialShallow<T>} iteratee
* The criteria used to determine the maximum value.
* - If a **function** is provided, it extracts a numeric value from each element.
* - If a **string** is provided, it is treated as a key to extract values from the objects.
* - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair.
* - If an **object** is provided, it matches elements that contain the specified properties.
* @returns {number} The average of all the numbers as determined by the `iteratee` function.
*
* @example
* meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2
* meanBy([], x => x.a); // Returns: NaN
* meanBy([[2], [3], [1]], 0); // Returns: 2
* meanBy([{ a: 2 }, { a: 3 }, { a: 1 }], 'a'); // Returns: 2
*/
function meanBy(items, iteratee$1) {
if (items == null) return NaN;
return meanBy$1(Array.from(items), iteratee(iteratee$1 ?? identity));
}
//#endregion
export { meanBy };

11
node_modules/es-toolkit/dist/compat/math/min.d.mts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
//#region src/compat/math/min.d.ts
/**
* Finds the element in an array that has the minimum value.
*
* @template T - The type of elements in the array.
* @param {ArrayLike<T> | null | undefined} [items] - The array of elements to search. Defaults to an empty array.
* @returns {T | undefined} - The element with the minimum value, or undefined if the array is empty.
*/
declare function min<T>(items: ArrayLike<T> | null | undefined): T | undefined;
//#endregion
export { min };

11
node_modules/es-toolkit/dist/compat/math/min.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
//#region src/compat/math/min.d.ts
/**
* Finds the element in an array that has the minimum value.
*
* @template T - The type of elements in the array.
* @param {ArrayLike<T> | null | undefined} [items] - The array of elements to search. Defaults to an empty array.
* @returns {T | undefined} - The element with the minimum value, or undefined if the array is empty.
*/
declare function min<T>(items: ArrayLike<T> | null | undefined): T | undefined;
//#endregion
export { min };

20
node_modules/es-toolkit/dist/compat/math/min.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
//#region src/compat/math/min.ts
/**
* Finds the element in an array that has the minimum value.
*
* @template T - The type of elements in the array.
* @param {ArrayLike<T> | null | undefined} [items] - The array of elements to search. Defaults to an empty array.
* @returns {T | undefined} - The element with the minimum value, or undefined if the array is empty.
*/
function min(items) {
if (!items || items.length === 0) return;
let minResult = void 0;
for (let i = 0; i < items.length; i++) {
const current = items[i];
if (current == null || Number.isNaN(current) || typeof current === "symbol") continue;
if (minResult === void 0 || current < minResult) minResult = current;
}
return minResult;
}
//#endregion
exports.min = min;

20
node_modules/es-toolkit/dist/compat/math/min.mjs generated vendored Normal file
View File

@@ -0,0 +1,20 @@
//#region src/compat/math/min.ts
/**
* Finds the element in an array that has the minimum value.
*
* @template T - The type of elements in the array.
* @param {ArrayLike<T> | null | undefined} [items] - The array of elements to search. Defaults to an empty array.
* @returns {T | undefined} - The element with the minimum value, or undefined if the array is empty.
*/
function min(items) {
if (!items || items.length === 0) return;
let minResult = void 0;
for (let i = 0; i < items.length; i++) {
const current = items[i];
if (current == null || Number.isNaN(current) || typeof current === "symbol") continue;
if (minResult === void 0 || current < minResult) minResult = current;
}
return minResult;
}
//#endregion
export { min };

34
node_modules/es-toolkit/dist/compat/math/minBy.d.mts generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import { ValueIteratee } from "../_internal/ValueIteratee.mjs";
//#region src/compat/math/minBy.d.ts
/**
* Finds the element in an array that has the minimum value when applying
* the `iteratee` to each element.
*
* @template T - The type of elements in the array.
* @param {T[]} items The array of elements to search.
* @param {((element: T) => number) | keyof T | [keyof T, unknown] | Partial<T>} iteratee
* The criteria used to determine the minimum value.
* - If a **function** is provided, it extracts a numeric value from each element.
* - If a **string** is provided, it is treated as a key to extract values from the objects.
* - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair.
* - If an **object** is provided, it matches elements that contain the specified properties.
* @returns {T | undefined} The element with the minimum value as determined by the `iteratee`.
* @example
* minBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 1 }
* minBy([], x => x.a); // Returns: undefined
* minBy(
* [
* { name: 'john', age: 30 },
* { name: 'jane', age: 28 },
* { name: 'joe', age: 26 },
* ],
* x => x.age
* ); // Returns: { name: 'joe', age: 26 }
* minBy([{ a: 1 }, { a: 2 }], 'a'); // Returns: { a: 1 }
* minBy([{ a: 1 }, { a: 2 }], ['a', 1]); // Returns: { a: 2 }
* minBy([{ a: 1 }, { a: 2 }], { a: 1 }); // Returns: { a: 2 }
*/
declare function minBy<T>(items: ArrayLike<T> | null | undefined, iteratee?: ValueIteratee<T>): T | undefined;
//#endregion
export { minBy };

34
node_modules/es-toolkit/dist/compat/math/minBy.d.ts generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import { ValueIteratee } from "../_internal/ValueIteratee.js";
//#region src/compat/math/minBy.d.ts
/**
* Finds the element in an array that has the minimum value when applying
* the `iteratee` to each element.
*
* @template T - The type of elements in the array.
* @param {T[]} items The array of elements to search.
* @param {((element: T) => number) | keyof T | [keyof T, unknown] | Partial<T>} iteratee
* The criteria used to determine the minimum value.
* - If a **function** is provided, it extracts a numeric value from each element.
* - If a **string** is provided, it is treated as a key to extract values from the objects.
* - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair.
* - If an **object** is provided, it matches elements that contain the specified properties.
* @returns {T | undefined} The element with the minimum value as determined by the `iteratee`.
* @example
* minBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 1 }
* minBy([], x => x.a); // Returns: undefined
* minBy(
* [
* { name: 'john', age: 30 },
* { name: 'jane', age: 28 },
* { name: 'joe', age: 26 },
* ],
* x => x.age
* ); // Returns: { name: 'joe', age: 26 }
* minBy([{ a: 1 }, { a: 2 }], 'a'); // Returns: { a: 1 }
* minBy([{ a: 1 }, { a: 2 }], ['a', 1]); // Returns: { a: 2 }
* minBy([{ a: 1 }, { a: 2 }], { a: 1 }); // Returns: { a: 2 }
*/
declare function minBy<T>(items: ArrayLike<T> | null | undefined, iteratee?: ValueIteratee<T>): T | undefined;
//#endregion
export { minBy };

38
node_modules/es-toolkit/dist/compat/math/minBy.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
const require_minBy = require("../../array/minBy.js");
const require_identity = require("../../function/identity.js");
const require_iteratee = require("../util/iteratee.js");
//#region src/compat/math/minBy.ts
/**
* Finds the element in an array that has the minimum value when applying
* the `iteratee` to each element.
*
* @template T - The type of elements in the array.
* @param {T[]} items The array of elements to search.
* @param {((element: T) => number) | keyof T | [keyof T, unknown] | Partial<T>} iteratee
* The criteria used to determine the minimum value.
* - If a **function** is provided, it extracts a numeric value from each element.
* - If a **string** is provided, it is treated as a key to extract values from the objects.
* - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair.
* - If an **object** is provided, it matches elements that contain the specified properties.
* @returns {T | undefined} The element with the minimum value as determined by the `iteratee`.
* @example
* minBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 1 }
* minBy([], x => x.a); // Returns: undefined
* minBy(
* [
* { name: 'john', age: 30 },
* { name: 'jane', age: 28 },
* { name: 'joe', age: 26 },
* ],
* x => x.age
* ); // Returns: { name: 'joe', age: 26 }
* minBy([{ a: 1 }, { a: 2 }], 'a'); // Returns: { a: 1 }
* minBy([{ a: 1 }, { a: 2 }], ['a', 1]); // Returns: { a: 2 }
* minBy([{ a: 1 }, { a: 2 }], { a: 1 }); // Returns: { a: 2 }
*/
function minBy(items, iteratee$1) {
if (items == null) return;
return require_minBy.minBy(Array.from(items), require_iteratee.iteratee(iteratee$1 ?? require_identity.identity));
}
//#endregion
exports.minBy = minBy;

38
node_modules/es-toolkit/dist/compat/math/minBy.mjs generated vendored Normal file
View File

@@ -0,0 +1,38 @@
import { minBy as minBy$1 } from "../../array/minBy.mjs";
import { identity } from "../../function/identity.mjs";
import { iteratee } from "../util/iteratee.mjs";
//#region src/compat/math/minBy.ts
/**
* Finds the element in an array that has the minimum value when applying
* the `iteratee` to each element.
*
* @template T - The type of elements in the array.
* @param {T[]} items The array of elements to search.
* @param {((element: T) => number) | keyof T | [keyof T, unknown] | Partial<T>} iteratee
* The criteria used to determine the minimum value.
* - If a **function** is provided, it extracts a numeric value from each element.
* - If a **string** is provided, it is treated as a key to extract values from the objects.
* - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair.
* - If an **object** is provided, it matches elements that contain the specified properties.
* @returns {T | undefined} The element with the minimum value as determined by the `iteratee`.
* @example
* minBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 1 }
* minBy([], x => x.a); // Returns: undefined
* minBy(
* [
* { name: 'john', age: 30 },
* { name: 'jane', age: 28 },
* { name: 'joe', age: 26 },
* ],
* x => x.age
* ); // Returns: { name: 'joe', age: 26 }
* minBy([{ a: 1 }, { a: 2 }], 'a'); // Returns: { a: 1 }
* minBy([{ a: 1 }, { a: 2 }], ['a', 1]); // Returns: { a: 2 }
* minBy([{ a: 1 }, { a: 2 }], { a: 1 }); // Returns: { a: 2 }
*/
function minBy(items, iteratee$1) {
if (items == null) return;
return minBy$1(Array.from(items), iteratee(iteratee$1 ?? identity));
}
//#endregion
export { minBy };

View File

@@ -0,0 +1,19 @@
//#region src/compat/math/multiply.d.ts
/**
* Multiply two numbers.
*
* If either of the numbers is `NaN`, the function returns `NaN`.
*
* @param {number} value The first number in a multiplication
* @param {number} other The second number in a multiplication
* @returns {number} The product of value and other
*
* @example
* multiply(2, 3); // => 6
* multiply(2, NaN); // => NaN
* multiply(NaN, 3); // => NaN
* multiply(NaN, NaN); // => NaN
*/
declare function multiply(value: number, other: number): number;
//#endregion
export { multiply };

19
node_modules/es-toolkit/dist/compat/math/multiply.d.ts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
//#region src/compat/math/multiply.d.ts
/**
* Multiply two numbers.
*
* If either of the numbers is `NaN`, the function returns `NaN`.
*
* @param {number} value The first number in a multiplication
* @param {number} other The second number in a multiplication
* @returns {number} The product of value and other
*
* @example
* multiply(2, 3); // => 6
* multiply(2, NaN); // => NaN
* multiply(NaN, 3); // => NaN
* multiply(NaN, NaN); // => NaN
*/
declare function multiply(value: number, other: number): number;
//#endregion
export { multiply };

32
node_modules/es-toolkit/dist/compat/math/multiply.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
const require_toNumber = require("../util/toNumber.js");
const require_toString = require("../util/toString.js");
//#region src/compat/math/multiply.ts
/**
* Multiply two numbers.
*
* If either of the numbers is `NaN`, the function returns `NaN`.
*
* @param {number} value The first number in a multiplication
* @param {number} other The second number in a multiplication
* @returns {number} The product of value and other
*
* @example
* multiply(2, 3); // => 6
* multiply(2, NaN); // => NaN
* multiply(NaN, 3); // => NaN
* multiply(NaN, NaN); // => NaN
*/
function multiply(value, other) {
if (value === void 0 && other === void 0) return 1;
if (value === void 0 || other === void 0) return value ?? other;
if (typeof value === "string" || typeof other === "string") {
value = require_toString.toString(value);
other = require_toString.toString(other);
} else {
value = require_toNumber.toNumber(value);
other = require_toNumber.toNumber(other);
}
return value * other;
}
//#endregion
exports.multiply = multiply;

32
node_modules/es-toolkit/dist/compat/math/multiply.mjs generated vendored Normal file
View File

@@ -0,0 +1,32 @@
import { toNumber } from "../util/toNumber.mjs";
import { toString } from "../util/toString.mjs";
//#region src/compat/math/multiply.ts
/**
* Multiply two numbers.
*
* If either of the numbers is `NaN`, the function returns `NaN`.
*
* @param {number} value The first number in a multiplication
* @param {number} other The second number in a multiplication
* @returns {number} The product of value and other
*
* @example
* multiply(2, 3); // => 6
* multiply(2, NaN); // => NaN
* multiply(NaN, 3); // => NaN
* multiply(NaN, NaN); // => NaN
*/
function multiply(value, other) {
if (value === void 0 && other === void 0) return 1;
if (value === void 0 || other === void 0) return value ?? other;
if (typeof value === "string" || typeof other === "string") {
value = toString(value);
other = toString(other);
} else {
value = toNumber(value);
other = toNumber(other);
}
return value * other;
}
//#endregion
export { multiply };

View File

@@ -0,0 +1,21 @@
//#region src/compat/math/parseInt.d.ts
/**
* Converts `string` to an integer of the specified radix. If `radix` is undefined or 0, a `radix` of 10 is used unless `string` is a hexadecimal, in which case a `radix` of 16 is used.
*
* @param {string} string The string to convert to an integer.
* @param {number} radix The radix to use when converting the string to an integer. Defaults to `0`.
* @param {unknown} guard Enables use as an iteratee for methods like `Array#map`.
* @returns {number} Returns the converted integer.
*
* @example
* parseInt('08'); // => 8
* parseInt('0x20'); // => 32
*
* parseInt('08', 10); // => 8
* parseInt('0x20', 16); // => 32
*
* ['6', '08', '10'].map(parseInt); // => [6, 8, 10]
*/
declare function parseInt(string: string, radix?: number): number;
//#endregion
export { parseInt };

21
node_modules/es-toolkit/dist/compat/math/parseInt.d.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
//#region src/compat/math/parseInt.d.ts
/**
* Converts `string` to an integer of the specified radix. If `radix` is undefined or 0, a `radix` of 10 is used unless `string` is a hexadecimal, in which case a `radix` of 16 is used.
*
* @param {string} string The string to convert to an integer.
* @param {number} radix The radix to use when converting the string to an integer. Defaults to `0`.
* @param {unknown} guard Enables use as an iteratee for methods like `Array#map`.
* @returns {number} Returns the converted integer.
*
* @example
* parseInt('08'); // => 8
* parseInt('0x20'); // => 32
*
* parseInt('08', 10); // => 8
* parseInt('0x20', 16); // => 32
*
* ['6', '08', '10'].map(parseInt); // => [6, 8, 10]
*/
declare function parseInt(string: string, radix?: number): number;
//#endregion
export { parseInt };

24
node_modules/es-toolkit/dist/compat/math/parseInt.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
//#region src/compat/math/parseInt.ts
/**
* Converts `string` to an integer of the specified radix. If `radix` is undefined or 0, a `radix` of 10 is used unless `string` is a hexadecimal, in which case a `radix` of 16 is used.
*
* @param {string} string The string to convert to an integer.
* @param {number} radix The radix to use when converting the string to an integer. Defaults to `0`.
* @param {unknown} guard Enables use as an iteratee for methods like `Array#map`.
* @returns {number} Returns the converted integer.
*
* @example
* parseInt('08'); // => 8
* parseInt('0x20'); // => 32
*
* parseInt('08', 10); // => 8
* parseInt('0x20', 16); // => 32
*
* ['6', '08', '10'].map(parseInt); // => [6, 8, 10]
*/
function parseInt(string, radix = 0, guard) {
if (guard) radix = 0;
return Number.parseInt(string, radix);
}
//#endregion
exports.parseInt = parseInt;

24
node_modules/es-toolkit/dist/compat/math/parseInt.mjs generated vendored Normal file
View File

@@ -0,0 +1,24 @@
//#region src/compat/math/parseInt.ts
/**
* Converts `string` to an integer of the specified radix. If `radix` is undefined or 0, a `radix` of 10 is used unless `string` is a hexadecimal, in which case a `radix` of 16 is used.
*
* @param {string} string The string to convert to an integer.
* @param {number} radix The radix to use when converting the string to an integer. Defaults to `0`.
* @param {unknown} guard Enables use as an iteratee for methods like `Array#map`.
* @returns {number} Returns the converted integer.
*
* @example
* parseInt('08'); // => 8
* parseInt('0x20'); // => 32
*
* parseInt('08', 10); // => 8
* parseInt('0x20', 16); // => 32
*
* ['6', '08', '10'].map(parseInt); // => [6, 8, 10]
*/
function parseInt(string, radix = 0, guard) {
if (guard) radix = 0;
return Number.parseInt(string, radix);
}
//#endregion
export { parseInt };

47
node_modules/es-toolkit/dist/compat/math/random.d.mts generated vendored Normal file
View File

@@ -0,0 +1,47 @@
//#region src/compat/math/random.d.ts
/**
* Generate a random number between 0 and 1.
* @param {boolean} [floating] - Whether to return a floating point number. Defaults to true.
* @returns {number} A random number between 0 and 1.
* @example
* random(); // Returns a random number between 0 and 1
* random(true); // Returns a random floating point number between 0 and 1
* random(false); // Returns a random integer between 0 and 1
*/
declare function random(floating?: boolean): number;
/**
* Generate a random number between 0 and max.
* @param {number} max - The upper bound (exclusive).
* @param {boolean} [floating] - Whether to return a floating point number. Defaults to true.
* @returns {number} A random number between 0 and max.
* @example
* random(5); // Returns a random number between 0 and 5
* random(10, true); // Returns a random floating point number between 0 and 10
* random(3, false); // Returns a random integer between 0 and 3
*/
declare function random(max: number, floating?: boolean): number;
/**
* Generate a random number between min and max.
* @param {number} min - The lower bound (inclusive).
* @param {number} max - The upper bound (exclusive).
* @param {boolean} [floating] - Whether to return a floating point number. Defaults to true.
* @returns {number} A random number between min and max.
* @example
* random(1, 5); // Returns a random number between 1 and 5
* random(0, 10, true); // Returns a random floating point number between 0 and 10
* random(1, 6, false); // Returns a random integer between 1 and 6
*/
declare function random(min: number, max: number, floating?: boolean): number;
/**
* Generate a random number between 0 and min, using guard object for special cases.
* @param {number} min - The upper bound (exclusive).
* @param {string | number} index - The index or key to check in the guard object.
* @param {object} guard - The guard object to validate the parameters.
* @returns {number} A random number between 0 and min.
* @example
* const guard = { 5: 5 };
* random(5, 5, guard); // Returns a random number between 0 and 5
*/
declare function random(min: number, index: string | number, guard: object): number;
//#endregion
export { random };

47
node_modules/es-toolkit/dist/compat/math/random.d.ts generated vendored Normal file
View File

@@ -0,0 +1,47 @@
//#region src/compat/math/random.d.ts
/**
* Generate a random number between 0 and 1.
* @param {boolean} [floating] - Whether to return a floating point number. Defaults to true.
* @returns {number} A random number between 0 and 1.
* @example
* random(); // Returns a random number between 0 and 1
* random(true); // Returns a random floating point number between 0 and 1
* random(false); // Returns a random integer between 0 and 1
*/
declare function random(floating?: boolean): number;
/**
* Generate a random number between 0 and max.
* @param {number} max - The upper bound (exclusive).
* @param {boolean} [floating] - Whether to return a floating point number. Defaults to true.
* @returns {number} A random number between 0 and max.
* @example
* random(5); // Returns a random number between 0 and 5
* random(10, true); // Returns a random floating point number between 0 and 10
* random(3, false); // Returns a random integer between 0 and 3
*/
declare function random(max: number, floating?: boolean): number;
/**
* Generate a random number between min and max.
* @param {number} min - The lower bound (inclusive).
* @param {number} max - The upper bound (exclusive).
* @param {boolean} [floating] - Whether to return a floating point number. Defaults to true.
* @returns {number} A random number between min and max.
* @example
* random(1, 5); // Returns a random number between 1 and 5
* random(0, 10, true); // Returns a random floating point number between 0 and 10
* random(1, 6, false); // Returns a random integer between 1 and 6
*/
declare function random(min: number, max: number, floating?: boolean): number;
/**
* Generate a random number between 0 and min, using guard object for special cases.
* @param {number} min - The upper bound (exclusive).
* @param {string | number} index - The index or key to check in the guard object.
* @param {object} guard - The guard object to validate the parameters.
* @returns {number} A random number between 0 and min.
* @example
* const guard = { 5: 5 };
* random(5, 5, guard); // Returns a random number between 0 and 5
*/
declare function random(min: number, index: string | number, guard: object): number;
//#endregion
export { random };

56
node_modules/es-toolkit/dist/compat/math/random.js generated vendored Normal file
View File

@@ -0,0 +1,56 @@
const require_random = require("../../math/random.js");
const require_randomInt = require("../../math/randomInt.js");
const require_clamp = require("./clamp.js");
//#region src/compat/math/random.ts
/**
* Generate a random number within the given range.
*
* @param {number} minimum - The lower bound (inclusive).
* @param {number} maximum - The upper bound (exclusive).
* @returns {number} A random number between minimum (inclusive) and maximum (exclusive). The number can be an integer or a decimal.
* @throws {Error} Throws an error if `maximum` is not greater than `minimum`.
*
* @example
* const result1 = random(0, 5); // Returns a random number between 0 and 5.
* const result2 = random(5, 0); // If the minimum is greater than the maximum, an error is thrown.
* const result3 = random(5, 5); // If the minimum is equal to the maximum, an error is thrown.
*/
function random(...args) {
let minimum = 0;
let maximum = 1;
let floating = false;
switch (args.length) {
case 1:
if (typeof args[0] === "boolean") floating = args[0];
else maximum = args[0];
break;
case 2: if (typeof args[1] === "boolean") {
maximum = args[0];
floating = args[1];
} else {
minimum = args[0];
maximum = args[1];
}
case 3: if (typeof args[2] === "object" && args[2] != null && args[2][args[1]] === args[0]) {
minimum = 0;
maximum = args[0];
floating = false;
} else {
minimum = args[0];
maximum = args[1];
floating = args[2];
}
}
if (typeof minimum !== "number") minimum = Number(minimum);
if (typeof maximum !== "number") minimum = Number(maximum);
if (!minimum) minimum = 0;
if (!maximum) maximum = 0;
if (minimum > maximum) [minimum, maximum] = [maximum, minimum];
minimum = require_clamp.clamp(minimum, -Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER);
maximum = require_clamp.clamp(maximum, -Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER);
if (minimum === maximum) return minimum;
if (floating) return require_random.random(minimum, maximum + 1);
else return require_randomInt.randomInt(minimum, maximum + 1);
}
//#endregion
exports.random = random;

56
node_modules/es-toolkit/dist/compat/math/random.mjs generated vendored Normal file
View File

@@ -0,0 +1,56 @@
import { random as random$1 } from "../../math/random.mjs";
import { randomInt } from "../../math/randomInt.mjs";
import { clamp } from "./clamp.mjs";
//#region src/compat/math/random.ts
/**
* Generate a random number within the given range.
*
* @param {number} minimum - The lower bound (inclusive).
* @param {number} maximum - The upper bound (exclusive).
* @returns {number} A random number between minimum (inclusive) and maximum (exclusive). The number can be an integer or a decimal.
* @throws {Error} Throws an error if `maximum` is not greater than `minimum`.
*
* @example
* const result1 = random(0, 5); // Returns a random number between 0 and 5.
* const result2 = random(5, 0); // If the minimum is greater than the maximum, an error is thrown.
* const result3 = random(5, 5); // If the minimum is equal to the maximum, an error is thrown.
*/
function random(...args) {
let minimum = 0;
let maximum = 1;
let floating = false;
switch (args.length) {
case 1:
if (typeof args[0] === "boolean") floating = args[0];
else maximum = args[0];
break;
case 2: if (typeof args[1] === "boolean") {
maximum = args[0];
floating = args[1];
} else {
minimum = args[0];
maximum = args[1];
}
case 3: if (typeof args[2] === "object" && args[2] != null && args[2][args[1]] === args[0]) {
minimum = 0;
maximum = args[0];
floating = false;
} else {
minimum = args[0];
maximum = args[1];
floating = args[2];
}
}
if (typeof minimum !== "number") minimum = Number(minimum);
if (typeof maximum !== "number") minimum = Number(maximum);
if (!minimum) minimum = 0;
if (!maximum) maximum = 0;
if (minimum > maximum) [minimum, maximum] = [maximum, minimum];
minimum = clamp(minimum, -Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER);
maximum = clamp(maximum, -Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER);
if (minimum === maximum) return minimum;
if (floating) return random$1(minimum, maximum + 1);
else return randomInt(minimum, maximum + 1);
}
//#endregion
export { random };

34
node_modules/es-toolkit/dist/compat/math/range.d.mts generated vendored Normal file
View File

@@ -0,0 +1,34 @@
//#region src/compat/math/range.d.ts
/**
* Creates an array of numbers progressing from `start` up to, but not including, `end`.
*
* @param {number} start - The starting number of the range (inclusive)
* @param {number} end - The end number of the range (exclusive)
* @param {number} step - The value to increment or decrement by
* @returns {number[]} An array of numbers from start to end
* @example
* range(4)
* // => [0, 1, 2, 3]
*
* range(1, 5)
* // => [1, 2, 3, 4]
*
* range(0, 20, 5)
* // => [0, 5, 10, 15]
*/
declare function range(start: number, end?: number, step?: number): number[];
/**
* Creates an array of numbers progressing from 0 up to, but not including, `end`.
* Used internally when range is called as an iteratee.
*
* @param {number} end - The end of the range (exclusive)
* @param {string|number} index - The index argument passed to the iteratee
* @param {object} guard - The guard object passed to the iteratee
* @returns {number[]} An array of numbers from 0 to end
* @example
* [1, 2, 3].map(range)
* // => [[0], [0, 1], [0, 1, 2]]
*/
declare function range(end: number, index: string | number, guard: object): number[];
//#endregion
export { range };

34
node_modules/es-toolkit/dist/compat/math/range.d.ts generated vendored Normal file
View File

@@ -0,0 +1,34 @@
//#region src/compat/math/range.d.ts
/**
* Creates an array of numbers progressing from `start` up to, but not including, `end`.
*
* @param {number} start - The starting number of the range (inclusive)
* @param {number} end - The end number of the range (exclusive)
* @param {number} step - The value to increment or decrement by
* @returns {number[]} An array of numbers from start to end
* @example
* range(4)
* // => [0, 1, 2, 3]
*
* range(1, 5)
* // => [1, 2, 3, 4]
*
* range(0, 20, 5)
* // => [0, 5, 10, 15]
*/
declare function range(start: number, end?: number, step?: number): number[];
/**
* Creates an array of numbers progressing from 0 up to, but not including, `end`.
* Used internally when range is called as an iteratee.
*
* @param {number} end - The end of the range (exclusive)
* @param {string|number} index - The index argument passed to the iteratee
* @param {object} guard - The guard object passed to the iteratee
* @returns {number[]} An array of numbers from 0 to end
* @example
* [1, 2, 3].map(range)
* // => [[0], [0, 1], [0, 1, 2]]
*/
declare function range(end: number, index: string | number, guard: object): number[];
//#endregion
export { range };

37
node_modules/es-toolkit/dist/compat/math/range.js generated vendored Normal file
View File

@@ -0,0 +1,37 @@
const require_toFinite = require("../util/toFinite.js");
const require_isIterateeCall = require("../_internal/isIterateeCall.js");
//#region src/compat/math/range.ts
/**
* Returns an array of numbers from `start` (inclusive) to `end` (exclusive), incrementing by `step`.
*
* @param {number} start - The starting number of the range (inclusive).
* @param {number} end - The end number of the range (exclusive).
* @param {number} step - The step value for the range.
* @returns {number[]} An array of numbers from `start` (inclusive) to `end` (exclusive) with the specified `step`.
*
* @example
* // Returns [0, 1, 2, 3]
* range(4);
*
* @example
* // Returns [0, -1, -2, -3]
* range(0, -4, -1);
*/
function range(start, end, step) {
if (step && typeof step !== "number" && require_isIterateeCall.isIterateeCall(start, end, step)) end = step = void 0;
start = require_toFinite.toFinite(start);
if (end === void 0) {
end = start;
start = 0;
} else end = require_toFinite.toFinite(end);
step = step === void 0 ? start < end ? 1 : -1 : require_toFinite.toFinite(step);
const length = Math.max(Math.ceil((end - start) / (step || 1)), 0);
const result = new Array(length);
for (let index = 0; index < length; index++) {
result[index] = start;
start += step;
}
return result;
}
//#endregion
exports.range = range;

37
node_modules/es-toolkit/dist/compat/math/range.mjs generated vendored Normal file
View File

@@ -0,0 +1,37 @@
import { toFinite } from "../util/toFinite.mjs";
import { isIterateeCall } from "../_internal/isIterateeCall.mjs";
//#region src/compat/math/range.ts
/**
* Returns an array of numbers from `start` (inclusive) to `end` (exclusive), incrementing by `step`.
*
* @param {number} start - The starting number of the range (inclusive).
* @param {number} end - The end number of the range (exclusive).
* @param {number} step - The step value for the range.
* @returns {number[]} An array of numbers from `start` (inclusive) to `end` (exclusive) with the specified `step`.
*
* @example
* // Returns [0, 1, 2, 3]
* range(4);
*
* @example
* // Returns [0, -1, -2, -3]
* range(0, -4, -1);
*/
function range(start, end, step) {
if (step && typeof step !== "number" && isIterateeCall(start, end, step)) end = step = void 0;
start = toFinite(start);
if (end === void 0) {
end = start;
start = 0;
} else end = toFinite(end);
step = step === void 0 ? start < end ? 1 : -1 : toFinite(step);
const length = Math.max(Math.ceil((end - start) / (step || 1)), 0);
const result = new Array(length);
for (let index = 0; index < length; index++) {
result[index] = start;
start += step;
}
return result;
}
//#endregion
export { range };

View File

@@ -0,0 +1,32 @@
//#region src/compat/math/rangeRight.d.ts
/**
* Creates an array of numbers from `start` to `end` with optional `step`.
* @param {number} start - The starting number of the range (inclusive).
* @param {number} [end] - The end number of the range (exclusive).
* @param {number} [step] - The step value for the range.
* @returns {number[]} An array of numbers from `start` to `end` with the specified `step`.
* @example
* // Returns [0, 1, 2, 3]
* rangeRight(4);
* @example
* // Returns [0, 2, 4, 6]
* rangeRight(0, 8, 2);
* @example
* // Returns [5, 4, 3, 2, 1]
* rangeRight(1, 6);
*/
declare function rangeRight(start: number, end?: number, step?: number): number[];
/**
* Creates an array of numbers from 0 to `end` with step 1.
* Used when called as an iteratee for methods like `_.map`.
* @param {number} end - The end number of the range (exclusive).
* @param {string | number} index - The index parameter (used for iteratee calls).
* @param {object} guard - The guard parameter (used for iteratee calls).
* @returns {number[]} An array of numbers from 0 to `end` with step 1.
* @example
* // Returns [0, 1, 2, 3]
* rangeRight(4, 'index', {});
*/
declare function rangeRight(end: number, index: string | number, guard: object): number[];
//#endregion
export { rangeRight };

View File

@@ -0,0 +1,32 @@
//#region src/compat/math/rangeRight.d.ts
/**
* Creates an array of numbers from `start` to `end` with optional `step`.
* @param {number} start - The starting number of the range (inclusive).
* @param {number} [end] - The end number of the range (exclusive).
* @param {number} [step] - The step value for the range.
* @returns {number[]} An array of numbers from `start` to `end` with the specified `step`.
* @example
* // Returns [0, 1, 2, 3]
* rangeRight(4);
* @example
* // Returns [0, 2, 4, 6]
* rangeRight(0, 8, 2);
* @example
* // Returns [5, 4, 3, 2, 1]
* rangeRight(1, 6);
*/
declare function rangeRight(start: number, end?: number, step?: number): number[];
/**
* Creates an array of numbers from 0 to `end` with step 1.
* Used when called as an iteratee for methods like `_.map`.
* @param {number} end - The end number of the range (exclusive).
* @param {string | number} index - The index parameter (used for iteratee calls).
* @param {object} guard - The guard parameter (used for iteratee calls).
* @returns {number[]} An array of numbers from 0 to `end` with step 1.
* @example
* // Returns [0, 1, 2, 3]
* rangeRight(4, 'index', {});
*/
declare function rangeRight(end: number, index: string | number, guard: object): number[];
//#endregion
export { rangeRight };

38
node_modules/es-toolkit/dist/compat/math/rangeRight.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
const require_toFinite = require("../util/toFinite.js");
const require_isIterateeCall = require("../_internal/isIterateeCall.js");
//#region src/compat/math/rangeRight.ts
/**
* Returns an array of numbers from `end` (exclusive) to `start` (inclusive), decrementing by `step`.
*
* @param {number} start - The starting number of the range (inclusive).
* @param {string | number} end - The end number of the range (exclusive).
* @param {number | object} step - The step value for the range.
* @returns {number[]} An array of numbers from `end` (exclusive) to `start` (inclusive) with the specified `step`.
* @throws {Error} Throws an error if the step value is not a non-zero integer.
*
* @example
* // Returns [3, 2, 1, 0]
* rangeRight(4);
*
* @example
* // Returns [-3, -2, -1, 0]
* rangeRight(0, -4, -1);
*/
function rangeRight(start, end, step) {
if (step && typeof step !== "number" && require_isIterateeCall.isIterateeCall(start, end, step)) end = step = void 0;
start = require_toFinite.toFinite(start);
if (end === void 0) {
end = start;
start = 0;
} else end = require_toFinite.toFinite(end);
step = step === void 0 ? start < end ? 1 : -1 : require_toFinite.toFinite(step);
const length = Math.max(Math.ceil((end - start) / (step || 1)), 0);
const result = new Array(length);
for (let index = length - 1; index >= 0; index--) {
result[index] = start;
start += step;
}
return result;
}
//#endregion
exports.rangeRight = rangeRight;

View File

@@ -0,0 +1,38 @@
import { toFinite } from "../util/toFinite.mjs";
import { isIterateeCall } from "../_internal/isIterateeCall.mjs";
//#region src/compat/math/rangeRight.ts
/**
* Returns an array of numbers from `end` (exclusive) to `start` (inclusive), decrementing by `step`.
*
* @param {number} start - The starting number of the range (inclusive).
* @param {string | number} end - The end number of the range (exclusive).
* @param {number | object} step - The step value for the range.
* @returns {number[]} An array of numbers from `end` (exclusive) to `start` (inclusive) with the specified `step`.
* @throws {Error} Throws an error if the step value is not a non-zero integer.
*
* @example
* // Returns [3, 2, 1, 0]
* rangeRight(4);
*
* @example
* // Returns [-3, -2, -1, 0]
* rangeRight(0, -4, -1);
*/
function rangeRight(start, end, step) {
if (step && typeof step !== "number" && isIterateeCall(start, end, step)) end = step = void 0;
start = toFinite(start);
if (end === void 0) {
end = start;
start = 0;
} else end = toFinite(end);
step = step === void 0 ? start < end ? 1 : -1 : toFinite(step);
const length = Math.max(Math.ceil((end - start) / (step || 1)), 0);
const result = new Array(length);
for (let index = length - 1; index >= 0; index--) {
result[index] = start;
start += step;
}
return result;
}
//#endregion
export { rangeRight };

16
node_modules/es-toolkit/dist/compat/math/round.d.mts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
//#region src/compat/math/round.d.ts
/**
* Computes number rounded to precision.
*
* @param {number} number The number to round.
* @param {number} precision The precision to round to.
* @returns {number} Returns the rounded number.
*
* @example
* round(4.006); // => 4
* round(4.006, 2); // => 4.01
* round(4060, -2); // => 4100
*/
declare function round(number: number, precision?: number): number;
//#endregion
export { round };

16
node_modules/es-toolkit/dist/compat/math/round.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
//#region src/compat/math/round.d.ts
/**
* Computes number rounded to precision.
*
* @param {number} number The number to round.
* @param {number} precision The precision to round to.
* @returns {number} Returns the rounded number.
*
* @example
* round(4.006); // => 4
* round(4.006, 2); // => 4.01
* round(4060, -2); // => 4100
*/
declare function round(number: number, precision?: number): number;
//#endregion
export { round };

19
node_modules/es-toolkit/dist/compat/math/round.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
const require_decimalAdjust = require("../_internal/decimalAdjust.js");
//#region src/compat/math/round.ts
/**
* Computes number rounded to precision.
*
* @param {number} number The number to round.
* @param {number} precision The precision to round to.
* @returns {number} Returns the rounded number.
*
* @example
* round(4.006); // => 4
* round(4.006, 2); // => 4.01
* round(4060, -2); // => 4100
*/
function round(number, precision = 0) {
return require_decimalAdjust.decimalAdjust("round", number, precision);
}
//#endregion
exports.round = round;

19
node_modules/es-toolkit/dist/compat/math/round.mjs generated vendored Normal file
View File

@@ -0,0 +1,19 @@
import { decimalAdjust } from "../_internal/decimalAdjust.mjs";
//#region src/compat/math/round.ts
/**
* Computes number rounded to precision.
*
* @param {number} number The number to round.
* @param {number} precision The precision to round to.
* @returns {number} Returns the rounded number.
*
* @example
* round(4.006); // => 4
* round(4.006, 2); // => 4.01
* round(4060, -2); // => 4100
*/
function round(number, precision = 0) {
return decimalAdjust("round", number, precision);
}
//#endregion
export { round };

View File

@@ -0,0 +1,18 @@
//#region src/compat/math/subtract.d.ts
/**
* Subtracts one number from another.
*
* If either of the numbers is `NaN`, the function returns `NaN`.
*
* @param {number} value The first number. (minuend)
* @param {number} other The second number.(subtrahend)
* @returns {number} The difference of the two numbers, or `NaN` if any input is `NaN`.
*
* @example
* subtract(6, 3); // => 3
* subtract(6, NaN); // => NaN
* subtract(NaN, 3); // => NaN
*/
declare function subtract(value: number, other: number): number;
//#endregion
export { subtract };

18
node_modules/es-toolkit/dist/compat/math/subtract.d.ts generated vendored Normal file
View File

@@ -0,0 +1,18 @@
//#region src/compat/math/subtract.d.ts
/**
* Subtracts one number from another.
*
* If either of the numbers is `NaN`, the function returns `NaN`.
*
* @param {number} value The first number. (minuend)
* @param {number} other The second number.(subtrahend)
* @returns {number} The difference of the two numbers, or `NaN` if any input is `NaN`.
*
* @example
* subtract(6, 3); // => 3
* subtract(6, NaN); // => NaN
* subtract(NaN, 3); // => NaN
*/
declare function subtract(value: number, other: number): number;
//#endregion
export { subtract };

31
node_modules/es-toolkit/dist/compat/math/subtract.js generated vendored Normal file
View File

@@ -0,0 +1,31 @@
const require_toNumber = require("../util/toNumber.js");
const require_toString = require("../util/toString.js");
//#region src/compat/math/subtract.ts
/**
* Subtracts one number from another.
*
* If either of the numbers is `NaN`, the function returns `NaN`.
*
* @param {number} value The first number. (minuend)
* @param {number} other The second number.(subtrahend)
* @returns {number} The difference of the two numbers, or `NaN` if any input is `NaN`.
*
* @example
* subtract(6, 3); // => 3
* subtract(6, NaN); // => NaN
* subtract(NaN, 3); // => NaN
*/
function subtract(value, other) {
if (value === void 0 && other === void 0) return 0;
if (value === void 0 || other === void 0) return value ?? other;
if (typeof value === "string" || typeof other === "string") {
value = require_toString.toString(value);
other = require_toString.toString(other);
} else {
value = require_toNumber.toNumber(value);
other = require_toNumber.toNumber(other);
}
return value - other;
}
//#endregion
exports.subtract = subtract;

31
node_modules/es-toolkit/dist/compat/math/subtract.mjs generated vendored Normal file
View File

@@ -0,0 +1,31 @@
import { toNumber } from "../util/toNumber.mjs";
import { toString } from "../util/toString.mjs";
//#region src/compat/math/subtract.ts
/**
* Subtracts one number from another.
*
* If either of the numbers is `NaN`, the function returns `NaN`.
*
* @param {number} value The first number. (minuend)
* @param {number} other The second number.(subtrahend)
* @returns {number} The difference of the two numbers, or `NaN` if any input is `NaN`.
*
* @example
* subtract(6, 3); // => 3
* subtract(6, NaN); // => NaN
* subtract(NaN, 3); // => NaN
*/
function subtract(value, other) {
if (value === void 0 && other === void 0) return 0;
if (value === void 0 || other === void 0) return value ?? other;
if (typeof value === "string" || typeof other === "string") {
value = toString(value);
other = toString(other);
} else {
value = toNumber(value);
other = toNumber(other);
}
return value - other;
}
//#endregion
export { subtract };

20
node_modules/es-toolkit/dist/compat/math/sum.d.mts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
//#region src/compat/math/sum.d.ts
/**
* Computes the sum of the values that are returned by the `iteratee` function.
*
* It does not coerce values to `number`.
*
* @param {ArrayLike<any> | null | undefined} array - The array to iterate over.
* @returns {number} Returns the sum.
*
* @example
* sum([1, 2, 3]); // => 6
* sum([1n, 2n, 3n]); // => 6n
* sum(["1", "2"]); // => "12"
* sum([1, undefined, 2]); // => 3
* sum(null); // => 0
* sum(undefined); // => 0
*/
declare function sum(array: ArrayLike<any> | null | undefined): number;
//#endregion
export { sum };

20
node_modules/es-toolkit/dist/compat/math/sum.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
//#region src/compat/math/sum.d.ts
/**
* Computes the sum of the values that are returned by the `iteratee` function.
*
* It does not coerce values to `number`.
*
* @param {ArrayLike<any> | null | undefined} array - The array to iterate over.
* @returns {number} Returns the sum.
*
* @example
* sum([1, 2, 3]); // => 6
* sum([1n, 2n, 3n]); // => 6n
* sum(["1", "2"]); // => "12"
* sum([1, undefined, 2]); // => 3
* sum(null); // => 0
* sum(undefined); // => 0
*/
declare function sum(array: ArrayLike<any> | null | undefined): number;
//#endregion
export { sum };

23
node_modules/es-toolkit/dist/compat/math/sum.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
const require_sumBy = require("./sumBy.js");
//#region src/compat/math/sum.ts
/**
* Computes the sum of the values that are returned by the `iteratee` function.
*
* It does not coerce values to `number`.
*
* @param {ArrayLike<any> | null | undefined} array - The array to iterate over.
* @returns {number} Returns the sum.
*
* @example
* sum([1, 2, 3]); // => 6
* sum([1n, 2n, 3n]); // => 6n
* sum(["1", "2"]); // => "12"
* sum([1, undefined, 2]); // => 3
* sum(null); // => 0
* sum(undefined); // => 0
*/
function sum(array) {
return require_sumBy.sumBy(array);
}
//#endregion
exports.sum = sum;

23
node_modules/es-toolkit/dist/compat/math/sum.mjs generated vendored Normal file
View File

@@ -0,0 +1,23 @@
import { sumBy } from "./sumBy.mjs";
//#region src/compat/math/sum.ts
/**
* Computes the sum of the values that are returned by the `iteratee` function.
*
* It does not coerce values to `number`.
*
* @param {ArrayLike<any> | null | undefined} array - The array to iterate over.
* @returns {number} Returns the sum.
*
* @example
* sum([1, 2, 3]); // => 6
* sum([1n, 2n, 3n]); // => 6n
* sum(["1", "2"]); // => "12"
* sum([1, undefined, 2]); // => 3
* sum(null); // => 0
* sum(undefined); // => 0
*/
function sum(array) {
return sumBy(array);
}
//#endregion
export { sum };

22
node_modules/es-toolkit/dist/compat/math/sumBy.d.mts generated vendored Normal file
View File

@@ -0,0 +1,22 @@
//#region src/compat/math/sumBy.d.ts
/**
* Computes the sum of the values that are returned by the `iteratee` function.
*
* It does not coerce values to `number`.
*
* @template T - The type of the array elements.
* @param {ArrayLike<T> | null | undefined} array - The array to iterate over.
* @param {((value: T) => number) | string} iteratee - The function invoked per iteration.
* @returns {number} Returns the sum.
*
* @example
* sumBy([1, undefined, 2], value => value); // => 3
* sumBy(null); // => 0
* sumBy(undefined); // => 0
* sumBy([1, 2, 3]); // => 6
* sumBy([1n, 2n, 3n]); // => 6n
* sumBy([{ a: "1" }, { a: "2" }], object => object.a); // => "12"
*/
declare function sumBy<T>(array: ArrayLike<T> | null | undefined, iteratee?: ((value: T) => number) | string): number;
//#endregion
export { sumBy };

22
node_modules/es-toolkit/dist/compat/math/sumBy.d.ts generated vendored Normal file
View File

@@ -0,0 +1,22 @@
//#region src/compat/math/sumBy.d.ts
/**
* Computes the sum of the values that are returned by the `iteratee` function.
*
* It does not coerce values to `number`.
*
* @template T - The type of the array elements.
* @param {ArrayLike<T> | null | undefined} array - The array to iterate over.
* @param {((value: T) => number) | string} iteratee - The function invoked per iteration.
* @returns {number} Returns the sum.
*
* @example
* sumBy([1, undefined, 2], value => value); // => 3
* sumBy(null); // => 0
* sumBy(undefined); // => 0
* sumBy([1, 2, 3]); // => 6
* sumBy([1n, 2n, 3n]); // => 6n
* sumBy([{ a: "1" }, { a: "2" }], object => object.a); // => "12"
*/
declare function sumBy<T>(array: ArrayLike<T> | null | undefined, iteratee?: ((value: T) => number) | string): number;
//#endregion
export { sumBy };

33
node_modules/es-toolkit/dist/compat/math/sumBy.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
const require_iteratee = require("../util/iteratee.js");
//#region src/compat/math/sumBy.ts
/**
* Computes the sum of the values that are returned by the `iteratee` function.
*
* It does not coerce values to `number`.
*
* @template T - The type of the array elements.
* @param {ArrayLike<T> | null | undefined} array - The array to iterate over.
* @param {((value: T) => number) | string} iteratee - The function invoked per iteration.
* @returns {number} Returns the sum.
*
* @example
* sumBy([1, undefined, 2], value => value); // => 3
* sumBy(null); // => 0
* sumBy(undefined); // => 0
* sumBy([1, 2, 3]); // => 6
* sumBy([1n, 2n, 3n]); // => 6n
* sumBy([{ a: "1" }, { a: "2" }], object => object.a); // => "12"
*/
function sumBy(array, iteratee$1) {
if (!array || !array.length) return 0;
if (iteratee$1 != null) iteratee$1 = require_iteratee.iteratee(iteratee$1);
let result = void 0;
for (let i = 0; i < array.length; i++) {
const current = iteratee$1 ? iteratee$1(array[i]) : array[i];
if (current !== void 0) if (result === void 0) result = current;
else result += current;
}
return result;
}
//#endregion
exports.sumBy = sumBy;

33
node_modules/es-toolkit/dist/compat/math/sumBy.mjs generated vendored Normal file
View File

@@ -0,0 +1,33 @@
import { iteratee } from "../util/iteratee.mjs";
//#region src/compat/math/sumBy.ts
/**
* Computes the sum of the values that are returned by the `iteratee` function.
*
* It does not coerce values to `number`.
*
* @template T - The type of the array elements.
* @param {ArrayLike<T> | null | undefined} array - The array to iterate over.
* @param {((value: T) => number) | string} iteratee - The function invoked per iteration.
* @returns {number} Returns the sum.
*
* @example
* sumBy([1, undefined, 2], value => value); // => 3
* sumBy(null); // => 0
* sumBy(undefined); // => 0
* sumBy([1, 2, 3]); // => 6
* sumBy([1n, 2n, 3n]); // => 6n
* sumBy([{ a: "1" }, { a: "2" }], object => object.a); // => "12"
*/
function sumBy(array, iteratee$1) {
if (!array || !array.length) return 0;
if (iteratee$1 != null) iteratee$1 = iteratee(iteratee$1);
let result = void 0;
for (let i = 0; i < array.length; i++) {
const current = iteratee$1 ? iteratee$1(array[i]) : array[i];
if (current !== void 0) if (result === void 0) result = current;
else result += current;
}
return result;
}
//#endregion
export { sumBy };