source:
node_modules/es-toolkit/dist/math/clamp.mjs
| Last change on this file was a762898, checked in by , 5 months ago | |
|---|---|
|
|
| File size: 187 bytes | |
| Line | |
|---|---|
| 1 | function clamp(value, bound1, bound2) { |
| 2 | if (bound2 == null) { |
| 3 | return Math.min(value, bound1); |
| 4 | } |
| 5 | return Math.min(Math.max(value, bound1), bound2); |
| 6 | } |
| 7 | |
| 8 | export { clamp }; |
Note:
See TracBrowser
for help on using the repository browser.
