Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function stringifyMerkleDAGNode(merkleDAG) {
// ${merkleDAG.isDir ? 'š' : ''}
const cid = merkleDAG.cid
const name = merkleDAG.name || 'root'
const parsedSize = byteSize(merkleDAG.size)
const size = parsedSize.value + parsedSize.unit
const delimiter = chalk.gray(' - ')
return [name, size, chalk.gray(cid)].join(delimiter)
}
}
}
const { size, gzip } = resp
switch (topic) {
case 'min':
return {
subject: 'minified size',
status: byteSize(size, { units: 'iec' }).toString().replace(/iB\b/, 'B'),
color: 'blue'
}
case 'minzip':
return {
subject: 'minzipped size',
status: byteSize(gzip, { units: 'iec' }).toString().replace(/iB\b/, 'B'),
color: 'blue'
}
default:
return {
subject: 'bundlephobia',
status: 'unknown topic',
color: 'grey'
}
}
}
.calc('size', 'code', (code) => {
const bytes = new Blob([code], {
type: 'text/javascript'
}).size;
const { value, unit } = byteSize(bytes, {
units: 'iec'
});
return bytes ? value + unit : '';
})
.calc('code', {
getFolderSize(repoPath, (err, size) => {
if (err) {
reject(err)
} else {
const humanReadableSize = byteSize(size)
resolve(humanReadableSize)
}
})
})
toBytes(data) {
var obj = {};
for (var prop in data) {
if (data.hasOwnProperty(prop)) {
obj[prop] = bytes(data[prop], { precision: 1 });
}
}
return obj;
}
if (!resp) {
return {
subject: 'bundlephobia',
status: 'unknown',
color: 'grey'
}
}
const { size, gzip } = resp
switch (topic) {
case 'min':
return {
subject: 'minified size',
status: byteSize(size, { units: 'iec' }).toString().replace(/iB\b/, 'B'),
color: 'blue'
}
case 'minzip':
return {
subject: 'minzipped size',
status: byteSize(gzip, { units: 'iec' }).toString().replace(/iB\b/, 'B'),
color: 'blue'
}
default:
return {
subject: 'bundlephobia',
status: 'unknown topic',
color: 'grey'
}
}
}
const changeSize = () => {
const bytes = getBytes(editor.getValue());
sizeBlock.innerHTML = bytes ? byteSize(bytes, {
units: 'iec'
}) : '';
};