UNPKG

es-toolkit

Version:

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

13 lines (9 loc) 281 B
'use strict'; Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); function clamp(value, bound1, bound2) { if (bound2 == null) { return Math.min(value, bound1); } return Math.min(Math.max(value, bound1), bound2); } exports.clamp = clamp;