@cjser/math-clamp
v2.2.1-cjser.2
Published
Clamp a number
Maintainers
Readme
math-clamp
Clamp a number
Install
npm install math-clampUsage
import mathClamp from 'math-clamp';
mathClamp(1, {min: 2, max: 4});
//=> 2
mathClamp(1, {min: 2});
//=> 2
mathClamp(5, {max: 4});
//=> 4API
mathClamp(number, {min?, max?})
Related
- math-sum - Sum numbers
- math-average - Get the average of numbers
cjser
This package is a CommonJS-compatible build generated by cjser for projects that still need require() support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.
Original repository: https://github.com/sindresorhus/math-clamp
