MCPcopy Create free account
hub / github.com/ReactTooltip/react-tooltip / formatDuration

Function formatDuration

benchmarks/run-scaling-series.mjs:52–66  ·  view source on GitHub ↗
(ms)

Source from the content-addressed store, hash-verified

50})
51
52function formatDuration(ms) {
53 if (ms < 1000) {
54 return `${ms}ms`
55 }
56
57 const totalSeconds = Math.round(ms / 1000)
58 const minutes = Math.floor(totalSeconds / 60)
59 const seconds = totalSeconds % 60
60
61 if (minutes === 0) {
62 return `${seconds}s`
63 }
64
65 return `${minutes}m ${seconds}s`
66}
67
68function logSeries(message) {
69 const elapsedMs = Date.now() - seriesStartedAt

Callers 3

logSeriesFunction · 0.85
runWorkerLoopFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected