You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
596 B
18 lines
596 B
5 years ago
|
# clamp [![frozen](http://hughsk.github.io/stability-badges/dist/frozen.svg)](http://github.com/hughsk/stability-badges) #
|
||
|
|
||
|
Clamp a value between two other values. It's as simple as modules come - saving
|
||
|
keystrokes because I've had to write this function too many times.
|
||
|
|
||
|
## Usage ##
|
||
|
|
||
|
[![clamp](https://nodei.co/npm/clamp.png?mini=true)](https://nodei.co/npm/clamp)
|
||
|
|
||
|
### `clamp(value, a, b)` ###
|
||
|
|
||
|
Returns `value`, if it is between `a` and `b`. Otherwise, returns the number
|
||
|
it's gone past.
|
||
|
|
||
|
## License ##
|
||
|
|
||
|
MIT. See [LICENSE.md](http://github.com/hughsk/clamp/blob/master/LICENSE.md) for details.
|