Files
zipline/src/lib/bytes.ts
2023-08-09 23:27:52 -07:00

9 lines
372 B
TypeScript

import bytesFn, { BytesOptions } from 'bytes';
export function bytes(value: string): number;
export function bytes(value: number, options?: BytesOptions): string;
export function bytes(value: string | number, options?: BytesOptions): string | number {
if (typeof value === 'string') return bytesFn(value);
return bytesFn(value, { ...options, unitSeparator: ' ' });
}