Skip to content

Commit

Permalink
chore(dev): use double quote in js file
Browse files Browse the repository at this point in the history
  • Loading branch information
orblazer committed Dec 4, 2021
1 parent a310230 commit fcce8b1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.{js,sh}]
indent_style = space
indent_size = 2
30 changes: 19 additions & 11 deletions package/contents/ui/components/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,34 @@
* @returns The percent of usage
*/
function getPercentUsage(current, max) {
var x = current / max
return isNaN(x) ? 0 : Math.min(x, 1)
var x = current / max;
return isNaN(x) ? 0 : Math.min(x, 1);
}

function humanReadableBits(value) {
if (isNaN(parseInt(value))) {
return ''
return "";
}

if (value < 1000) {
return Math.max(value, 0) + ' bps'
return Math.max(value, 0) + " bps";
}

var i = -1
var byteUnits = [' kbps', ' Mbps', ' Gbps', ' Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps']
var i = -1;
var byteUnits = [
" Kbps",
" Mbps",
" Gbps",
" Tbps",
" Pbps",
" Ebps",
" Zbps",
" Ybps",
];
do {
value = value / 1000
i++
} while (value > 1000)
value = value / 1000;
i++;
} while (value > 1000);


return (Math.round(Math.max(value, 0) * 10) / 10) + byteUnits[i]
return Math.round(Math.max(value, 0) * 10) / 10 + byteUnits[i];
}

0 comments on commit fcce8b1

Please sign in to comment.