X-Git-Url: http://git.roojs.org/?p=roojs1;a=blobdiff_plain;f=roojs-debug.js;h=4c9a82c533bd4e716e29b39675dd71fa20394be9;hp=ba91ad09eead0c6570e07dc4ddd380aaf90928ad;hb=9da53a68d13d5f73e41052aa33a3b3b44d56e887;hpb=9f8d87bc51eb15080637e5fb5ef63913529df854 diff --git a/roojs-debug.js b/roojs-debug.js index ba91ad09ee..4c9a82c533 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -13990,7 +13990,25 @@ Roo.util.Format = function(){ */ stripTags : function(v){ return !v ? v : String(v).replace(this.stripTagsRE, ""); + }, + /** + * Size in Mb,Gb etc. + * @param {Number} value The number to be formated + * @param {number} decimals how many decimal places + * @return {String} the formated string + */ + size : function(value, decimals) + { + var sizes = ['b', 'k', 'M', 'G', 'T']; + if (v == 0) { + return 0; + } + var i = parseInt(Math.floor(Math.log(v) / Math.log(1024))); + return this.number(v / Math.pow(1024, i) ,decimals) + ' ' + sizes[i]; } + + + }; }(); Roo.util.Format.defaults = {