Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pwlin committed May 10, 2012
1 parent 68c89ab commit d2d3ec0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/ananas/mime.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions lib/ananas/utils.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var utils = {
}, },




format_date : function (date, format){ format_date : function (date, format) {
// format="YYYY-MM-dd hh:mm:ss" // format="YYYY-MM-dd hh:mm:ss"
var o = { var o = {
"Y" : date.getFullYear(), "Y" : date.getFullYear(),
Expand Down Expand Up @@ -84,7 +84,7 @@ var utils = {
return format; return format;
}, },


format_month_name : function(date_month){ format_month_name : function(date_month) {
var date_month_name; var date_month_name;
switch(date_month){ switch(date_month){
case 0: case 0:
Expand Down Expand Up @@ -131,21 +131,21 @@ var utils = {


}, },


url_decode : function(str){ url_decode : function(str) {
return decodeURIComponent((str + '').replace(/\+/g, '%20')); return decodeURIComponent((str + '').replace(/\+/g, '%20'));
}, },


nice_size: function(bytes){ nice_size: function(bytes) {
var s = ['bytes', 'kb', 'MB', 'GB', 'TB', 'PB'], var s = ['bytes', 'kb', 'MB', 'GB', 'TB', 'PB'],
e = Math.floor(Math.log(bytes)/Math.log(1024)), e = Math.floor(Math.log(bytes)/Math.log(1024)),
m = (bytes/Math.pow(1024, Math.floor(e))).toFixed(2), m = (bytes/Math.pow(1024, Math.floor(e))).toFixed(2),
se = s[e]; se = s[e];
if(m.match(/\.00$/)) { m = m.replace(/\.00$/, ''); } if(m.match(/\.00$/)) { m = m.replace(/\.00$/, ''); }
if (m == 'NaN') { m = '0'; se = 'bytes'; } if (m == 'NaN') { m = '0'; se = 'bytes'; }
return m + ' ' + se ; return m + ' ' + se ;
}, },


trim: function(str){ trim: function(str) {
str = str.replace(/^\s\s*/, ''); str = str.replace(/^\s\s*/, '');
var ws = /\s/, i = str.length; var ws = /\s/, i = str.length;
while (ws.test(str.charAt(--i))); while (ws.test(str.charAt(--i)));
Expand Down

0 comments on commit d2d3ec0

Please sign in to comment.