MCPcopy Create free account
hub / github.com/ReactTooltip/react-tooltip / formatMemory

Function formatMemory

docs/src/pages/benchmark.tsx:11–20  ·  view source on GitHub ↗
(value: number)

Source from the content-addressed store, hash-verified

9}
10
11function formatMemory(value: number) {
12 const sign = value > 0 ? '+' : ''
13 const absolute = Math.abs(value)
14
15 if (absolute >= 1024) {
16 return `${sign}${(value / 1024).toFixed(2)} MiB`
17 }
18
19 return `${sign}${value.toFixed(1)} KiB`
20}
21
22function formatPercent(value: number) {
23 return `${value.toFixed(1)}%`

Callers 1

BenchmarkPageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected