Socket
Socket
Sign inDemoInstall

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 3.0.0 to 3.0.1

.idea/jsLibraryMappings.xml

11

lib/filesize.js

@@ -9,3 +9,3 @@ /**

* @module filesize
* @version 3.0.0
* @version 3.0.1
*/

@@ -43,2 +43,3 @@ ( function ( global ) {

output = descriptor.output !== undefined ? descriptor.output : "string";
e = descriptor.exponent !== undefined ? descriptor.exponent : -1;
num = Number( arg );

@@ -65,3 +66,6 @@ neg = ( num < 0 );

else {
e = Math.floor( Math.log( num ) / Math.log( 1000 ) );
// Determining the exponent
if ( e === -1 || isNaN( e ) ) {
e = Math.floor( Math.log( num ) / Math.log( 1000 ) );
}

@@ -122,2 +126,5 @@ // Exceeding supported length, time to reduce & multiply

}
else if ( output === "exponent" ) {
return e;
}
else if ( output === "object" ) {

@@ -124,0 +131,0 @@ return { value: result[ 0 ], suffix: result[ 1 ] };

2

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

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

@@ -17,4 +17,7 @@ # filesize.js

### exponent
_***(number)***_ Specifies the SI suffix via exponent, e.g. `2` is `MB` for bytes, default is `-1`
### output
_***(string)***_ Output of function (`array`, `object`, or `string`), default is `string`
_***(string)***_ Output of function (`array`, `exponent`, `object`, or `string`), default is `string`

@@ -44,2 +47,5 @@ ### round

filesize(1, {suffixes: {B: "Б"}}); // "1 Б"
filesize(1024); // "1 kB"
filesize(1024, {exponent: 0}); // "1024 B"
filesize(1024, {output: "exponent"}); // 1
```

@@ -46,0 +52,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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