@7sage/vidstack
Version:
UI component library for building high-quality, accessible video and audio experiences on the web.
12 lines (10 loc) • 326 B
JavaScript
function round(num, decimalPlaces = 2) {
return Number(num.toFixed(decimalPlaces));
}
function getNumberOfDecimalPlaces(num) {
return String(num).split(".")[1]?.length ?? 0;
}
function clampNumber(min, value, max) {
return Math.max(min, Math.min(max, value));
}
export { clampNumber, getNumberOfDecimalPlaces, round };