super-utils-plus
Version:
A superior alternative to Lodash with improved performance, TypeScript support, and developer experience
22 lines (21 loc) • 430 B
TypeScript
/**
* Clamps a number within the inclusive lower and upper bounds.
*
* @param value - The number to clamp
* @param lower - The lower bound
* @param upper - The upper bound
* @returns The clamped number
*
* @example
* ```ts
* clamp(-10, -5, 5);
* // => -5
*
* clamp(10, -5, 5);
* // => 5
*
* clamp(3, -5, 5);
* // => 3
* ```
*/
export declare function clamp(value: number, lower: number, upper: number): number;