UNPKG

@cran/lib.vue.ref

Version:

Vue Reactivity Extensions

13 lines (12 loc) 331 B
import { eagerComputed, unwrap } from "../utility"; /** * @since 0.0.1 * @category Math * @inheritdoc Math.round */ export function useRound(x, precision = 0) { return eagerComputed(function compute() { const modifier = 10 ** unwrap(precision); return Math.round(unwrap(x) * modifier) / modifier; }); }