mongoku
Version:
[](https://github.com/huggingface/Mongoku/actions/workflows/ci.yml)
36 lines (34 loc) • 787 B
JavaScript
function formatBytes(bytes) {
if (bytes === 0) {
return "0 B";
}
if (bytes < 1e3) {
return bytes + " B";
}
if (bytes < 1e6) {
return (bytes / 1e3).toFixed(2) + " kB";
}
if (bytes < 1e9) {
return (bytes / 1e6).toFixed(2) + " MB";
}
if (bytes < 1e12) {
return (bytes / 1e9).toFixed(2) + " GB";
}
return (bytes / 1e12).toFixed(2) + " TB";
}
function formatNumber(num) {
return num.toLocaleString();
}
function serverName(name) {
if (name.startsWith("mongodb://") || name.startsWith("mongodb+srv://")) {
try {
const url = new URL(name);
return url.hostname;
} catch {
return name;
}
}
return name;
}
export { formatNumber as a, formatBytes as f, serverName as s };
//# sourceMappingURL=filters-B3U8Nh9P.js.map