MCPcopy Create free account
hub / github.com/code-pushup/cli / roundValue

Function roundValue

packages/utils/src/lib/reports/utils.ts:117–123  ·  view source on GitHub ↗
(value: number)

Source from the content-addressed store, hash-verified

115const MIN_NON_ZERO_RESULT = 0.1;
116
117export function roundValue(value: number): number {
118 const roundedValue = Math.round(value * 10) / 10; // round with max 1 decimal
119 if (roundedValue === 0 && value !== 0) {
120 return MIN_NON_ZERO_RESULT * Math.sign(value);
121 }
122 return roundedValue;
123}
124
125export function formatScoreChange(diff: number): InlineText {
126 const marker = getDiffMarker(diff);

Callers 3

formatScoreChangeFunction · 0.85
formatValueChangeFunction · 0.85
utils.unit.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected