@atlaskit/tokens
Version:
Design tokens are the single source of truth to name and store design decisions.
20 lines (19 loc) • 404 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.clampDouble = clampDouble;
/**
* Clamps an integer between two floating-point numbers.
*
* @return input when min <= input <= max, and either min or max
* otherwise.
*/
function clampDouble(min, max, input) {
if (input < min) {
return min;
} else if (input > max) {
return max;
}
return input;
}