@lahzenegar/react-drop-n-crop
Version:
A combined implementation of react-dropzone and react-cropper (translated to farsi)
12 lines (10 loc) • 337 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (bytes) {
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
if (bytes === 0) return '0 Byte';
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)), 10);
return Math.round(bytes / Math.pow(1024, i), 2) + sizes[i];
};