diff options
-rw-r--r-- | src/element.ts | 1 | ||||
-rw-r--r-- | src/show.ts | 10 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/element.ts b/src/element.ts index ed86cfe..b3fb20c 100644 --- a/src/element.ts +++ b/src/element.ts @@ -35,6 +35,7 @@ type EEl<K extends keyof HTMLElementTagNameMap> = string | OVar<Opts<HTMLElementTagNameMap[K]>> | OVar<string> | OVar<HTMLElement> + | OVar<OVar<HTMLDivElement>> | OVar<HTMLUListElement> // is this possible with dudplication? | OVar<HTMLOListElement> | OVar<HTMLInputElement> diff --git a/src/show.ts b/src/show.ts index 193a93b..b75ed7b 100644 --- a/src/show.ts +++ b/src/show.ts @@ -1,9 +1,9 @@ -export function byte_size(x: number): string { - if (x > 1000000000) return (x / 1000000000).toFixed(1) + "G" - if (x > 1000000) return (x / 1000000).toFixed(1) + "M" - if (x > 1000) return (x / 1000).toFixed(1) + "k" - return x.toString() +export function metric(x: number, unit = ""): string { + if (x > 1000000000) return (x / 1000000000).toFixed(1) + "G" + unit + if (x > 1000000) return (x / 1000000).toFixed(1) + "M" + unit + if (x > 1000) return (x / 1000).toFixed(1) + "k" + unit + return x.toString() + unit } export function duration(t: number): string { |