UNPKG

@taiga-ui/kit

Version:
24 lines (20 loc) 582 B
import { round } from '@taiga-ui/cdk'; const BYTES_PER_KB = 1000; const BYTES_PER_MB = 1000 * BYTES_PER_KB; function formatSize(units, size) { if (size === undefined) { return null; } if (size < BYTES_PER_KB) { return `${size} ${units[0]}`; } if (size < BYTES_PER_MB) { return `${(size / BYTES_PER_KB).toFixed()} ${units[1]}`; } return `${round(size / BYTES_PER_MB, 2).toLocaleString()} ${units[2]}`; } /** * Generated bundle index. Do not edit. */ export { formatSize }; //# sourceMappingURL=taiga-ui-kit-utils-files.js.map