UNPKG

@cran/lib.vue.ref

Version:

Vue Reactivity Extensions

11 lines (10 loc) 270 B
import { eagerComputed, unwrap } from "../utility"; /** * @since 0.0.1 * @category Math */ export function useClamp(value, min, max) { return eagerComputed(function compute() { return Math.min(unwrap(max), Math.max(unwrap(min), unwrap(value))); }); }