UNPKG

rc-js-util

Version:

A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.

88 lines (41 loc) 990 B
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [rc-js-util](./rc-js-util.md) &gt; [mathBound](./rc-js-util.mathbound.md) ## mathBound() function Bound a value in to a range. **Signature:** ```typescript export declare function mathBound(value: number, min: number, max: number): number; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> value </td><td> number </td><td> </td></tr> <tr><td> min </td><td> number </td><td> </td></tr> <tr><td> max </td><td> number </td><td> </td></tr> </tbody></table> **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()](./rc-js-util.mathbound.md)<!-- -->.