@transloadit/prettier-bytes
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -1,1 +0,2 @@ | ||
export default function prettierBytes(num: number): string; | ||
declare const _default: (num: number) => string; | ||
export = _default; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function prettierBytes(num) { | ||
module.exports = function prettierBytes(num) { | ||
if (typeof num !== 'number' || Number.isNaN(num)) { | ||
@@ -16,3 +15,3 @@ throw new TypeError(`Expected a number, got ${typeof num}`); | ||
const exponent = Math.min(Math.floor(Math.log(num) / Math.log(1024)), units.length - 1); | ||
num = Number(num / Math.pow(1024, exponent)); | ||
num = Number(num / 1024 ** exponent); | ||
const unit = units[exponent]; | ||
@@ -23,4 +22,3 @@ if (num >= 10 || num % 1 === 0) { | ||
return `${(neg ? '-' : '') + num.toFixed(1)} ${unit}`; | ||
} | ||
exports.default = prettierBytes; | ||
}; | ||
//# sourceMappingURL=prettierBytes.js.map |
{ | ||
"name": "@transloadit/prettier-bytes", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"repository": { | ||
@@ -23,3 +23,3 @@ "type": "git", | ||
}, | ||
"gitHead": "412a97c914bd1a8c6d21df01c9f7e18ab19b218a" | ||
"gitHead": "714bbf75e54490ceb20bea49a728230668d456c1" | ||
} |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
5404
7
48
1