froebel
Version:
TypeScript utility library
17 lines (13 loc) • 402 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
/** Clamp `num` between `min` and `max` inclusively. */
const clamp = (min, num, max) => {
if (min > max) [min, max] = [max, min];
return Math.max(Math.min(num, max), min);
};
var _default = clamp;
exports.default = _default;
module.exports = Object.assign(exports.default || {}, exports);