Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

filesize

Package Overview
Dependencies
Maintainers
1
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filesize - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

20

lib/filesize.js

@@ -5,7 +5,7 @@ /**

* @author Jason Mulligan <jason.mulligan@avoidwork.com>
* @copyright 2013 Jason Mulligan
* @copyright 2014 Jason Mulligan
* @license BSD-3 <https://raw.github.com/avoidwork/filesize.js/master/LICENSE>
* @link http://filesizejs.com
* @module filesize
* @version 2.0.0
* @version 2.0.1
*/

@@ -33,3 +33,3 @@ ( function ( global ) {

i = 6,
base, bits, neg, num, round, size, sizes, unix, spacer, suffix, z;
base, bits, neg, num, round, size, sizes, unix, spacer, suffix, z, suffixes;

@@ -43,5 +43,6 @@ if ( isNaN( arg ) ) {

unix = ( descriptor.unix === true );
base = descriptor.base !== undefined ? descriptor.base : unix ? 2 : 10;
round = descriptor.round !== undefined ? descriptor.round : unix ? 1 : 2;
spacer = descriptor.spacer !== undefined ? descriptor.spacer : unix ? "" : " ";
base = descriptor.base !== undefined ? descriptor.base : unix ? 2 : 10;
round = descriptor.round !== undefined ? descriptor.round : unix ? 1 : 2;
spacer = descriptor.spacer !== undefined ? descriptor.spacer : unix ? "" : " ";
suffixes = descriptor.suffixes !== undefined ? descriptor.suffixes : {};
num = Number( arg );

@@ -61,3 +62,4 @@ neg = ( num < 0 );

else {
result = "0" + spacer + "B";
suffix = "B";
result = "0" + spacer + ( suffixes[suffix] || suffix );
}

@@ -97,6 +99,6 @@ }

result += spacer + suffix;
result += spacer + ( suffixes[suffix] || suffix );
}
else if ( !unix ) {
result += spacer + suffix;
result += spacer + ( suffixes[suffix] || suffix );
}

@@ -103,0 +105,0 @@

{
"name": "filesize",
"description": "JavaScript library to generate a human readable String describing the file size",
"version": "2.0.0",
"version": "2.0.1",
"homepage": "http://filesizejs.com",

@@ -6,0 +6,0 @@ "author": {

@@ -25,2 +25,5 @@ [![build status](https://secure.travis-ci.org/avoidwork/filesize.js.png)](http://travis-ci.org/avoidwork/filesize.js)

### suffixes
_***(object)***_ Dictionary of SI suffixes to replace for localization, defaults to english if no match is found
## Examples

@@ -34,2 +37,3 @@

filesize(265318, {base: 2, round: 1}); // "259.1 kB"
filesize(1, {suffixes: {B: "Б"}}); // "1 Б"
```

@@ -36,0 +40,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc