wxt
Version:
⚡ Next-gen Web Extension Framework
10 lines (9 loc) • 329 B
JavaScript
//#region src/core/utils/time.ts
function formatDuration(duration) {
if (duration < 1e3) return `${duration} ms`;
if (duration < 1e4) return `${(duration / 1e3).toFixed(3)} s`;
if (duration < 6e4) return `${(duration / 1e3).toFixed(1)} s`;
return `${(duration / 1e3).toFixed(0)} s`;
}
//#endregion
export { formatDuration };