Skip to content

Commit b7a39f9

Browse files
committed
minor cleanup for shortSize
1 parent d3a4bf1 commit b7a39f9

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

index.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,12 @@ const saveData = (function() {
141141
};
142142
}());
143143

144-
const shortSize = (function() {
145-
return function(size, suffixes = ['', 'k', 'm', 'g', 't', 'p']) {
146-
const suffixNdx = Math.log2(Math.abs(size)) / 10 | 0;
147-
const suffix = suffixes[Math.min(suffixNdx, suffixes.length - 1)];
148-
const base = 2 ** (suffixNdx * 10);
149-
return `${(size / base).toFixed(0)}${suffix}`;
150-
};
151-
})();
144+
function shortSize(size, suffixes = ['', 'k', 'm', 'g', 't', 'p']) {
145+
const suffixNdx = Math.log2(Math.abs(size)) / 10 | 0;
146+
const suffix = suffixes[Math.min(suffixNdx, suffixes.length - 1)];
147+
const base = 2 ** (suffixNdx * 10);
148+
return `${(size / base).toFixed(0)}${suffix}`;
149+
}
152150

153151
const shortSizeByType = (function() {
154152
const suffixesByType = {

0 commit comments

Comments
 (0)