Delete web/src/lib/format.ts with huggingface_hub
Browse files- web/src/lib/format.ts +0 -29
web/src/lib/format.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
| 1 |
-
export function fmtTs(s: number): string {
|
| 2 |
-
const t = Math.floor(s);
|
| 3 |
-
const h = Math.floor(t / 3600);
|
| 4 |
-
const m = Math.floor((t % 3600) / 60);
|
| 5 |
-
const sec = t % 60;
|
| 6 |
-
return h ? `${h}:${String(m).padStart(2, "0")}:${String(sec).padStart(2, "0")}` : `${m}:${String(sec).padStart(2, "0")}`;
|
| 7 |
-
}
|
| 8 |
-
|
| 9 |
-
export function fmtDuration(s: number): string {
|
| 10 |
-
const m = Math.round(s / 60);
|
| 11 |
-
return m >= 60 ? `${Math.floor(m / 60)}h ${m % 60}m` : `${m} min`;
|
| 12 |
-
}
|
| 13 |
-
|
| 14 |
-
export function compact(n: number | null | undefined): string {
|
| 15 |
-
if (n == null) return "–";
|
| 16 |
-
return Intl.NumberFormat("en", { notation: "compact", maximumFractionDigits: 1 }).format(n);
|
| 17 |
-
}
|
| 18 |
-
|
| 19 |
-
export function bytes(n: number): string {
|
| 20 |
-
if (n < 1024) return `${n} B`;
|
| 21 |
-
if (n < 1024 ** 2) return `${(n / 1024).toFixed(1)} KB`;
|
| 22 |
-
return `${(n / 1024 ** 2).toFixed(2)} MB`;
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
-
export const pct = (x: number, digits = 0) => `${(x * 100).toFixed(digits)}%`;
|
| 26 |
-
|
| 27 |
-
export function youtubeAt(url: string | null | undefined, start: number): string | null {
|
| 28 |
-
return url ? `${url}&t=${Math.floor(start)}s` : null;
|
| 29 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|