mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-08 22:22:17 +02:00
13 lines
466 B
TypeScript
13 lines
466 B
TypeScript
/** Formatting helpers shared by the playground runs table and runner output. */
|
|
|
|
export function formatCost(costMicros: number | null | undefined): string {
|
|
if (costMicros == null) return "—";
|
|
if (costMicros === 0) return "Free";
|
|
return `$${(costMicros / 1_000_000).toFixed(4)}`;
|
|
}
|
|
|
|
export function formatDuration(ms: number | null | undefined): string {
|
|
if (ms == null) return "—";
|
|
if (ms < 1000) return `${ms}ms`;
|
|
return `${(ms / 1000).toFixed(1)}s`;
|
|
}
|