UNPKG

react-middleware

Version:

Connect middleware for serving React components from a standard folder structure.

27 lines (22 loc) 943 B
'use strict'; var _templateObject = _taggedTemplateLiteral(['', ' B'], ['', ' B']); Object.defineProperty(exports, "__esModule", { value: true }); function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } // See: http://stackoverflow.com/a/14919494/1745661 var fileSize = exports.fileSize = function fileSize(bytes) { var si = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1]; var threshold = si ? 1000 : 1024; if (Math.abs(bytes) < threshold) { return ' B'(_templateObject, bytes); } var units = si ? ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] : ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']; var u = -1; do { bytes /= threshold; ++u; } while (Math.abs(bytes) >= threshold && u < units.length - 1); return '' + bytes.toFixed(1) + units[u]; }; //# sourceMappingURL=util.js.map