|
1 |
| -interface FileSizeOptionsBase { |
2 |
| - base?: number; |
| 1 | +export interface FileSizeOptions { |
3 | 2 | bits?: boolean;
|
4 |
| - exponent?: number; |
5 |
| - fullform?: boolean; |
6 |
| - fullforms?: string[]; |
7 |
| - locale?: string | boolean; |
8 |
| - localeOptions?: Intl.DateTimeFormatOptions; |
9 | 3 | pad?: boolean;
|
10 |
| - precision?: number; |
| 4 | + base?: number; |
11 | 5 | round?: number;
|
12 |
| - roundingMethod?: 'round' | 'floor' | 'ceil'; |
| 6 | + locale?: string; |
| 7 | + localeOptions?: {}; |
13 | 8 | separator?: string;
|
14 | 9 | spacer?: string;
|
| 10 | + symbols?: {}; |
15 | 11 | standard?: 'iec' | 'jedec';
|
16 |
| - symbols?: { |
17 |
| - iec: { |
18 |
| - bits: string[], |
19 |
| - bytes: string[] |
20 |
| - }, |
21 |
| - jedec: { |
22 |
| - bits: string[], |
23 |
| - bytes: string[] |
24 |
| - } |
25 |
| - }; |
26 |
| -} |
27 |
| - |
28 |
| -interface FileSizeOptionsArray extends FileSizeOptionsBase { |
29 |
| - output: 'array' |
30 |
| -} |
31 |
| - |
32 |
| -interface FileSizeOptionsExponent extends FileSizeOptionsBase { |
33 |
| - output: 'exponent' |
34 |
| -} |
35 |
| - |
36 |
| -interface FileSizeOptionsObject extends FileSizeOptionsBase { |
37 |
| - output: 'object' |
38 |
| -} |
39 |
| - |
40 |
| -interface FileSizeOptionsString extends FileSizeOptionsBase { |
41 |
| - output: 'string' |
42 |
| -} |
43 |
| - |
44 |
| -interface FileSizeReturnObject { |
45 |
| - value: string, |
46 |
| - symbol: string, |
47 |
| - exponent: number, |
48 |
| - unit: string, |
| 12 | + output?: 'array' | 'exponent' | 'object' | 'string'; |
| 13 | + fullform?: boolean; |
| 14 | + fullforms?: any[]; |
| 15 | + exponent?: number; |
| 16 | + roundingMethod?: 'round' | 'floor' | 'ceil'; |
| 17 | + precision?: number; |
49 | 18 | }
|
50 | 19 |
|
51 |
| -type FileSizeReturnArray = [ number, string ] |
52 |
| - |
53 |
| -export function filesize(byteCount: number, options: FileSizeOptionsString): string |
54 |
| -export function filesize(byteCount: number, options: FileSizeOptionsArray): FileSizeReturnArray |
55 |
| -export function filesize(byteCount: number, options: FileSizeOptionsExponent): number |
56 |
| -export function filesize(byteCount: number, options: FileSizeOptionsObject): FileSizeReturnObject |
57 |
| -export function filesize(byteCount: number): string |
58 |
| - |
59 |
| -export function partial(options: FileSizeOptionsString): (byteCount: number) => string |
60 |
| -export function partial(options: FileSizeOptionsArray): (byteCount: number) => FileSizeReturnArray |
61 |
| -export function partial(options: FileSizeOptionsExponent): (byteCount: number) => number |
62 |
| -export function partial(options: FileSizeOptionsObject): (byteCount: number) => FileSizeReturnObject |
63 |
| -export function partial(): (byteCount: number) => string |
| 20 | +export function filesize(arg: any, { bits, pad, base, round, locale, localeOptions, separator, spacer, symbols, standard, output, fullform, fullforms, exponent, roundingMethod, precision }?: FileSizeOptions): string | number | any[] | { |
| 21 | + value: any; |
| 22 | + symbol: any; |
| 23 | + exponent: number; |
| 24 | + unit: string; |
| 25 | +}; |
| 26 | + |
| 27 | +export function partial({ bits, pad, base, round, locale, localeOptions, separator, spacer, symbols, standard, output, fullform, fullforms, exponent, roundingMethod, precision }?: FileSizeOptions): (arg: any) => string | number | any[] | { |
| 28 | + value: any; |
| 29 | + symbol: any; |
| 30 | + exponent: number; |
| 31 | + unit: string; |
| 32 | +}; |
0 commit comments