mirror of
https://github.com/coalaura/whiskr.git
synced 2025-09-09 01:09:54 +00:00
statistics
This commit is contained in:
@@ -60,3 +60,17 @@ function escapeHtml(text) {
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">");
|
||||
}
|
||||
|
||||
function formatMilliseconds(ms) {
|
||||
if (ms < 1000) {
|
||||
return `${ms}ms`;
|
||||
} else if (ms < 10000) {
|
||||
return `${(ms / 1000).toFixed(1)}s`;
|
||||
}
|
||||
|
||||
return `${Math.round(ms / 1000)}s`;
|
||||
}
|
||||
|
||||
function fixed(num, decimals = 0) {
|
||||
return num.toFixed(decimals).replace(/\.?0+$/m, "");
|
||||
}
|
||||
|
Reference in New Issue
Block a user