优化代码

This commit is contained in:
GoEdgeLab
2024-01-13 19:31:52 +08:00
parent 77d4d2bd9c
commit b1781b0bd0
5 changed files with 212 additions and 35 deletions

View File

@@ -1097,10 +1097,13 @@ window.teaweb = {
return -1
},
convertSizeCapacityToString: function (c) {
if (c == null || c.count == null || c.unit == null) {
if (c == null || c.count == null || c.unit == null || c.unit.length == 0) {
return ""
}
return c.count + c.unit.toString().toUpperCase()
if (c.unit == "byte") {
return c.count + "B"
}
return c.count + c.unit[0].toUpperCase() + "i" + c.unit.substring(1).toUpperCase()
}
}