You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2016/09/01 15:09:37 UTC

[3/4] fauxton commit: updated refs/heads/master to e799551

allow setting amount of decimals

PR: #757
PR-URL: https://github.com/apache/couchdb-fauxton/pull/757
Reviewed-By: Michelle Phung <mi...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/6bd82869
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/6bd82869
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/6bd82869

Branch: refs/heads/master
Commit: 6bd82869bf9923624112f82d9109b72c1c1cec9f
Parents: e617ad2
Author: Robert Kowalski <ro...@apache.org>
Authored: Tue Aug 23 13:10:17 2016 +0200
Committer: Robert Kowalski <ro...@apache.org>
Committed: Thu Sep 1 17:09:18 2016 +0200

----------------------------------------------------------------------
 app/helpers.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6bd82869/app/helpers.js
----------------------------------------------------------------------
diff --git a/app/helpers.js b/app/helpers.js
index 16f56ee..f80a3f0 100644
--- a/app/helpers.js
+++ b/app/helpers.js
@@ -38,7 +38,7 @@ Helpers.getDocUrl = function (key) {
 };
 
 // File size pretty printing, taken from futon.format.js
-Helpers.formatSize = function (size) {
+Helpers.formatSize = function (size, decimals = 1) {
     var jump = 512;
     if (size < jump) return size + " bytes";
     var units = ["KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
@@ -47,7 +47,7 @@ Helpers.formatSize = function (size) {
       i += 1;
       size /= 1024;
     }
-    return size.toFixed(1) + ' ' + units[i - 1];
+    return size.toFixed(decimals) + ' ' + units[i - 1];
   };
 
 Helpers.formatDate = function (timestamp) {