@tsmx/human-readable
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -47,3 +47,3 @@ var sizes = new Map(); | ||
yield* [...this.entries()].sort((a, b) => b[1].index - a[1].index); | ||
} | ||
}; | ||
@@ -56,3 +56,3 @@ const factorDecimal = 1000; | ||
function countDecimals(value) { | ||
return value % 1 ? value.toString().split(".")[1].length : 0; | ||
return value % 1 ? value.toString().split('.')[1].length : 0; | ||
} | ||
@@ -90,3 +90,3 @@ | ||
let factor = iecMode ? factorIEC : factorDecimal; | ||
for (let [key, value] of sizes) { | ||
for (let [, value] of sizes) { | ||
if (bytes >= Math.pow(factor, value.index)) { | ||
@@ -105,3 +105,3 @@ resultValue = bytes / Math.pow(factor, value.index); | ||
if (!(options && options.fullPrecision === true)) { | ||
if (options && options.hasOwnProperty('fixedPrecision')) { | ||
if (options && Object.prototype.hasOwnProperty.call(options, 'fixedPrecision')) { | ||
let precision = parseInt(options.fixedPrecision); | ||
@@ -135,3 +135,3 @@ if (!isNaN(precision)) { | ||
return postProcessResult(val, unit, options); | ||
} | ||
}; | ||
@@ -143,6 +143,6 @@ module.exports.fromTo = function (value, fromSize, toSize, options) { | ||
return postProcessResult(val, unit, options); | ||
} | ||
}; | ||
module.exports.availableSizes = function () { | ||
return availableSizes; | ||
} | ||
}; |
{ | ||
"name": "@tsmx/human-readable", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Easily create human-readable strings from byte sizes, e.g. 17238 --> 17.24 kB. Supports decimal (MB,GB,..) and binary (MiB, GiB,..) units as well as user-defined conversion from/to other sizes.", | ||
@@ -5,0 +5,0 @@ "main": "human-readable.js", |
@@ -6,3 +6,3 @@ # [**@tsmx/human-readable**](https://github.com/tsmx/human-readable) | ||
![node-current (scoped)](https://img.shields.io/node/v/@tsmx/human-readable) | ||
[![Build Status](https://travis-ci.com/tsmx/human-readable.svg?branch=master)](https://travis-ci.org/tsmx/human-readable) | ||
[![Build Status](https://img.shields.io/github/workflow/status/tsmx/human-readable/git-ci-build)](https://img.shields.io/github/workflow/status/tsmx/human-readable/git-ci-build) | ||
[![Coverage Status](https://coveralls.io/repos/github/tsmx/human-readable/badge.svg?branch=master)](https://coveralls.io/github/tsmx/human-readable?branch=master) | ||
@@ -9,0 +9,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18638