UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

27 lines 716 B
//#region src/compat/math/clamp.d.ts /** * Clamps a number within the specified bounds. * * @param number The number to clamp * @param lower The lower bound * @param upper The upper bound * @returns 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 The number to clamp * @param upper The upper bound * @returns Returns the clamped number * @example * clamp(5, 3) // => 3 * clamp(2, 3) // => 2 */ declare function clamp(number: number, upper: number): number; //#endregion export { clamp };