js-util

Home > rc-js-util > mathBound

mathBound() function

Bound a value in to a range.

Signature:

export declare function mathBound(value: number, min: number, max: number): number;

Parameters

Parameter Type Description
value number  
min number  
max number  

Returns:

number

The value if it lies between min and max, otherwise min if smaller and max if greater.

Remarks

NaN input will cause a debug error.

See mathBound().