Comparing version 1.9.1 to 1.9.2
@@ -9,3 +9,3 @@ /** | ||
* @module filesize | ||
* @version 1.9.1 | ||
* @version 1.9.2 | ||
*/ | ||
@@ -18,2 +18,3 @@ ( function ( global ) { | ||
bit = /b$/, | ||
byte = /^B$/, | ||
zero = /^0$/, | ||
@@ -43,2 +44,3 @@ options = { | ||
bits = true, | ||
skip = false, | ||
i, neg, num, pos, short, size, sizes, suffix, z; | ||
@@ -77,7 +79,3 @@ | ||
if ( num === 0 ) { | ||
if ( short ) { | ||
pos = 0; | ||
} | ||
result = Number( 0 ).toFixed( pos ) + "B"; | ||
result = Number( 0 ).toFixed( 0 ) + "B"; | ||
} | ||
@@ -99,5 +97,11 @@ else { | ||
if ( num >= size ) { | ||
// Treating bytes as cardinal | ||
if ( byte.test( suffix ) ) { | ||
skip = true; | ||
pos = 0; | ||
} | ||
result = ( num / size ).toFixed( pos ); | ||
if ( short ) { | ||
if ( !skip && short ) { | ||
if ( bits && bit.test( suffix ) ) { | ||
@@ -104,0 +108,0 @@ suffix = suffix.toLowerCase(); |
{ | ||
"name": "filesize", | ||
"description": "JavaScript library to generate a human readable String describing the file size", | ||
"version": "1.9.1", | ||
"version": "1.9.2", | ||
"homepage": "http://filesizejs.com", | ||
@@ -6,0 +6,0 @@ "author": { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
7230
122
0