ts-prime
Version:
A utility library for JavaScript and Typescript.
21 lines (20 loc) • 475 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var purry_1 = require("./purry");
function clamp() {
return purry_1.purry(_clamp, arguments);
}
exports.clamp = clamp;
function _clamp(value, limits) {
if (limits.min != null) {
if (limits.min > value) {
return limits.min;
}
}
if (limits.max != null) {
if (limits.max < value) {
return limits.max;
}
}
return value;
}