MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / formatValue

Function formatValue

console/src/platform/connectors/utils.ts:103–114  ·  view source on GitHub ↗
(
  value: number | null,
  yAxisUnit: ByteUnit | null,
)

Source from the content-addressed store, hash-verified

101}
102
103export const formatValue = (
104 value: number | null,
105 yAxisUnit: ByteUnit | null,
106) => {
107 if (value === null) return "-";
108
109 const result = yAxisUnit ? convertBytes(value, yAxisUnit) : value;
110 const numberFormatter = Intl.NumberFormat("default", {
111 maximumFractionDigits: decimalDigits(result),
112 });
113 return numberFormatter.format(result);
114};
115
116export function largestPossibleByteUnit(bytes: number): ByteUnit {
117 if (bytes < KB) return "B";

Callers 3

CurrentValueFunction · 0.90
formatArrayFunction · 0.50

Calls 3

convertBytesFunction · 0.90
decimalDigitsFunction · 0.85
formatMethod · 0.45

Tested by

no test coverage detected