ts-prime
Version:
A utility library for JavaScript and Typescript.
27 lines • 778 B
TypeScript
/**
* Clamp the given value within the inclusive min and max bounds.
* @param value - the number
* @param limits - the bounds limits
* @signature
* P.clamp(value, { min, max });
* @signature
* P.clamp({ min, max })(value);
* @example
* P.clamp(10, { min: 20 }) // => 20
* P.clamp(10, { max: 5 }) // => 5
* P.clamp(10, { max: 20, min: 5 }) // => 10
*
* P.clamp({ min: 20 })(10) // => 20
* P.clamp({ max: 5 })(10) // => 5
* P.clamp({ max: 20, min: 5 })(10) // => 10
* @category Number, Pipe
*/
export declare function clamp(value: number, limits: {
min?: number;
max?: number;
}): number;
export declare function clamp(limits: {
min?: number;
max?: number;
}): (value: number) => number;
//# sourceMappingURL=clamp.d.ts.map