UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

9 lines (7 loc) 187 B
function clamp(value, bound1, bound2) { if (bound2 == null) { return Math.min(value, bound1); } return Math.min(Math.max(value, bound1), bound2); } export { clamp };