mirror of
https://github.com/robonen/tools.git
synced 2026-03-20 19:04:46 +00:00
refactor(packages/stdlib): add doc, update tests
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
/**
|
||||
* Clamps a number between a minimum and maximum value
|
||||
*
|
||||
* @param {number} value The number to clamp
|
||||
* @param {number} min Minimum value
|
||||
* @param {number} max Maximum value
|
||||
* @returns {number} The clamped number
|
||||
*/
|
||||
export function clamp(value: number, min: number, max: number): number {
|
||||
return Math.min(Math.max(value, min), max);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user