@augment-vir/common
Version:
A collection of augments, helpers types, functions, and classes for any JavaScript environment.
19 lines (18 loc) • 528 B
TypeScript
import { type MinMax } from '@augment-vir/core';
/**
* Clamp's the given value to within the min and max bounds, inclusive.
*
* @category Number
* @category Package : @augment-vir/common
* @example
*
* ```ts
* import {clamp} from '@augment-vir/common';
*
* // `result` will be `40`
* const result = clamp(42, {min: 30, max: 40});
* ```
*
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
*/
export declare function clamp(value: number, { min, max }: Readonly<MinMax>): number;