Skip to content

Commit

Permalink
lib: tiny refactor format
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelGSS committed Sep 29, 2024
1 parent 1b6bf53 commit c97f947
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/clock.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,18 @@ class Timer {
validateNumber(timeInNs, 'timeInNs', 0);

if (timeInNs > 1e9) {
return `${ (timeInNs / 1e9).toFixed(2) }s`;
return `${(timeInNs / 1e9).toFixed(2)}s`;
}

if (timeInNs > 1e6) {
return `${ (timeInNs / 1e6).toFixed(2) }ms`;
return `${(timeInNs / 1e6).toFixed(2)}ms`;
}

if (timeInNs > 1e3) {
return `${ (timeInNs / 1e3).toFixed(2) }us`;
return `${(timeInNs / 1e3).toFixed(2)}us`;
}

if (timeInNs > 1e2) {
return `${ (timeInNs).toFixed(2) }ns`;
}

return `${ (timeInNs).toFixed(2) }ns`;
return `${(timeInNs).toFixed(2)}ns`;
}
}

Expand Down

0 comments on commit c97f947

Please sign in to comment.