filled in size placeholder and other malarkey

This commit is contained in:
Danny Coates 2019-02-22 10:37:52 -08:00
parent 7449d1c351
commit c8e6e761d0
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB
4 changed files with 25 additions and 20 deletions

View file

@ -57,7 +57,7 @@ const LOCALIZE_NUMBERS = !!(
);
const UNITS = ['B', 'kB', 'MB', 'GB'];
function bytes(num) {
function bytes(num, decimalDigits = 1) {
if (num < 1) {
return '0B';
}
@ -68,8 +68,8 @@ function bytes(num) {
try {
const locale = document.querySelector('html').lang;
nStr = n.toLocaleString(locale, {
minimumFractionDigits: 1,
maximumFractionDigits: 1
minimumFractionDigits: decimalDigits,
maximumFractionDigits: decimalDigits
});
} catch (e) {
// fall through