Adjust default argument handling, fix indentation

This commit is contained in:
John Furrow
2016-01-09 12:23:55 -08:00
parent 997d52f2a7
commit 1e21a721a4

View File

@@ -1,7 +1,6 @@
import React from 'react'; import React from 'react';
const format = { const format = {
eta: function(eta) { eta: function(eta) {
if (eta === 'Infinity') { if (eta === 'Infinity') {
return '∞'; return '∞';
@@ -69,9 +68,7 @@ const format = {
} }
}, },
data: function(bytes, extraUnits, precision) { data: function(bytes, extraUnits, precision = 2) {
precision = precision || 2;
let kilobyte = 1024, let kilobyte = 1024,
megabyte = kilobyte * 1024, megabyte = kilobyte * 1024,
gigabyte = megabyte * 1024, gigabyte = megabyte * 1024,
@@ -99,9 +96,9 @@ const format = {
unit = 'B'; unit = 'B';
} }
if (extraUnits) { if (extraUnits) {
unit += extraUnits; unit += extraUnits;
} }
return { return {
value, value,
@@ -121,7 +118,6 @@ const format = {
return ratio.toFixed(precision); return ratio.toFixed(precision);
} }
}; };
export default format; export default format;