parent
eaeebd6991
commit
9fa00fa258
@ -0,0 +1,9 @@
|
||||
const BYTE_UNITS = ['B', 'KB', 'MB', 'GB', 'TB'];
|
||||
|
||||
export function formatBytes(bytes: number): string {
|
||||
if (bytes === 0) return '0 B';
|
||||
const k = 1024;
|
||||
const i = Math.min(Math.floor(Math.log(bytes) / Math.log(k)), BYTE_UNITS.length - 1);
|
||||
const v = bytes / Math.pow(k, i);
|
||||
return `${Number.isInteger(v) ? v : v.toFixed(1)} ${BYTE_UNITS[i]}`;
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
export { default as Provider } from './components/toggle-group.svelte';
|
||||
export { default as Item } from './components/toggle-group-item.svelte';
|
||||
|
||||
export type { ToggleGroupType } from './toggle-group-provider.svelte';
|
||||
|
||||
export type { ToggleGroupProps as ProviderProps, ToggleGroupItemProps as ItemProps } from './types';
|
||||
export type {
|
||||
ToggleGroupType,
|
||||
ToggleGroupProps as ProviderProps,
|
||||
ToggleGroupItemProps as ItemProps
|
||||
} from './types';
|
||||
|
||||
Loading…
Reference in new issue