@coscine/app-util
Advanced tools
Comparing version 1.2.2 to 1.3.0
@@ -49,3 +49,20 @@ var LanguageUtil = /** @class */ (function () { | ||
export { LanguageUtil, GuidUtil }; | ||
var FileUtil = /** @class */ (function () { | ||
function FileUtil() { | ||
} | ||
FileUtil.formatBytes = function (bytes, decimals) { | ||
if (decimals === void 0) { decimals = 2; } | ||
if (bytes === 0) { | ||
return '0 Bytes'; | ||
} | ||
var k = 1024; | ||
var dm = decimals < 0 ? 0 : decimals; | ||
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; | ||
var i = Math.floor(Math.log(bytes) / Math.log(k)); | ||
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; | ||
}; | ||
return FileUtil; | ||
}()); | ||
export { LanguageUtil, GuidUtil, FileUtil }; | ||
//# sourceMappingURL=app-util.es5.js.map |
@@ -55,4 +55,22 @@ (function (global, factory) { | ||
var FileUtil = /** @class */ (function () { | ||
function FileUtil() { | ||
} | ||
FileUtil.formatBytes = function (bytes, decimals) { | ||
if (decimals === void 0) { decimals = 2; } | ||
if (bytes === 0) { | ||
return '0 Bytes'; | ||
} | ||
var k = 1024; | ||
var dm = decimals < 0 ? 0 : decimals; | ||
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; | ||
var i = Math.floor(Math.log(bytes) / Math.log(k)); | ||
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; | ||
}; | ||
return FileUtil; | ||
}()); | ||
exports.LanguageUtil = LanguageUtil; | ||
exports.GuidUtil = GuidUtil; | ||
exports.FileUtil = FileUtil; | ||
@@ -59,0 +77,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -7,2 +7,4 @@ "use strict"; | ||
exports.GuidUtil = guid_1.GuidUtil; | ||
var file_1 = require("./util/file"); | ||
exports.FileUtil = file_1.FileUtil; | ||
//# sourceMappingURL=app-util.js.map |
export { LanguageUtil } from './util/language'; | ||
export { GuidUtil } from './util/guid'; | ||
export { FileUtil } from './util/file'; |
{ | ||
"name": "@coscine/app-util", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "This library provides utility methods for the CoScInE Apps with JavaScript.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
28842
20
230