MCPcopy Index your code
hub / github.com/doesdev/rollup-plugin-analyzer / formatBytes

Function formatBytes

module.js:7–14  ·  view source on GitHub ↗
(bytes)

Source from the content-addressed store, hash-verified

5const borderX = `${Array(30).join('-')}\n`
6
7const formatBytes = (bytes) => {
8 if (bytes === 0) return '0 Byte'
9 const k = 1000
10 const dm = 3
11 const sizes = ['Bytes', 'KB', 'MB', 'GB']
12 const i = Math.floor(Math.log(bytes) / Math.log(k))
13 return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]
14}
15
16const shakenPct = (n = 0, o = 0) => {
17 const pct = Math.max((100 - ((n / o) * 100)).toFixed(2), 0)

Callers 1

reporterFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…