MCPcopy Create free account
hub / github.com/adobe/react-spectrum / toFixedNumber

Function toFixedNumber

packages/react-stately/src/utils/number.ts:76–80  ·  view source on GitHub ↗
(value: number, digits: number, base: number = 10)

Source from the content-addressed store, hash-verified

74
75/* Takes a value and rounds off to the number of digits. */
76export function toFixedNumber(value: number, digits: number, base: number = 10): number {
77 const pow = Math.pow(base, digits);
78
79 return Math.round(value * pow) / pow;
80}

Callers 6

toHSBMethod · 0.90
toHSLMethod · 0.90
toStringMethod · 0.90
toHSLMethod · 0.90
toStringMethod · 0.90
toHSBMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected