@cgi-learning-hub/ui
Version:
@cgi-learning-hub/ui is an open-source React component library that implements UI for HUB's features
14 lines (13 loc) • 375 B
JavaScript
const l = (t) => {
if (!t || t < 0) return null;
const n = ["octets", "Ko", "Mo", "Go", "To"], o = Math.min(Math.floor(Math.log2(t) / 10), n.length - 1);
return `${(t / 1024 ** o).toFixed(1)} ${n[o]}`;
}, e = (t) => {
if (!t) return null;
const n = t.split(".").pop();
return n ? n.toUpperCase() : null;
};
export {
e as displayExtension,
l as displaySize
};