UNPKG

es-next-tools

Version:

A comprehensive utility library for JavaScript and TypeScript that provides a wide range of functions for common programming tasks, including mathematical operations, date manipulations, array and object handling, string utilities, and more.

13 lines (12 loc) 471 B
/** * Clamps a number within a specified range. * @param {number} min - The minimum value of the range. * @param {number} value - The value to clamp. * @param {number} max - The maximum value of the range. * @returns {number} The clamped value. * @example * const result = clamp(0, 5, 10); // 5 * const result2 = clamp(0, -5, 10); // 0 * const result3 = clamp(0, 15, 10); // 10 */ export declare function clamp(min: number, value: number, max: number): number;