shared
utils
string
object
is
extension
js
tracking
string
dom
when
selection
position
iframe
event
scroll
console
node
string
project
fs
console
clamp
Type:Function
Status:stable
Since:1.0.0
Platform:jsnode
@blackbyte.sugar.shared.math
Clamp a number between two values
Params
- num*-Number
The number to clamp
- min*-Number
The minimum value
- max*-Number
The maximum value
Return
- -Number
The clamped number
Example
import { clamp } from '@blackbyte/sugar/math';
clamp(10, 0, 100); // => 10
clamp(0, 0, 100); // => 0
clamp(100, 0, 100); // => 100
clamp(101, 0, 100); // => 100Todo
- testsnormal
Author
- Olivier Bosselolivier.bossel@gmail.comhttps://blackbyte.space