]> arthur.barton.de Git - netdata.git/commitdiff
faster zeropad2(); #1281
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 26 Nov 2016 13:32:38 +0000 (15:32 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 26 Nov 2016 13:32:38 +0000 (15:32 +0200)
node.d/node_modules/netdata.js

index 6b138ee54fc08199de5c8a1bccfa672504d06183..572e639beee9a69b88fc6f721c86675a62150408 100644 (file)
@@ -134,14 +134,7 @@ var netdata = {
     },
 
     zeropad2: function(s) {
-        if(typeof s !== 'string')
-            s = s.toString();
-
-        switch(s.length) {
-            case 0: return '00';
-            case 1: return '0' + s;
-            default: return s;
-        }
+        return ("00" + s).slice(-2);
     },
 
     logdate: function(d) {