UNPKG

plyr

Version:

Deprecated; security updates only. Use Video.js 10 for new projects (https://videojs.org). A simple, accessible and customizable HTML5, YouTube and Vimeo media player.

18 lines (16 loc) • 523 B
/** * Returns a number whose value is limited to the given range. * * Example: limit the output of this computation to between 0 and 255 * (x * 255).clamp(0, 255) * * @param {number} input * @param {number} min The lower boundary of the output range * @param {number} max The upper boundary of the output range * @returns A number within the bounds of min and max * @type Number */ export function clamp(input = 0, min = 0, max = 255) { return Math.min(Math.max(input, min), max); } export default { clamp };