https://github.com/hughsk/clamp
Clamp a value between two other values.
https://github.com/hughsk/clamp
Last synced: 2 months ago
JSON representation
Clamp a value between two other values.
- Host: GitHub
- URL: https://github.com/hughsk/clamp
- Owner: hughsk
- License: mit
- Created: 2013-10-16T09:11:37.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2020-05-21T17:07:41.000Z (about 5 years ago)
- Last Synced: 2025-04-09T16:08:49.912Z (2 months ago)
- Language: JavaScript
- Size: 188 KB
- Stars: 39
- Watchers: 2
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# clamp [](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 ##
[](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.