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 1.7.4 to 1.7.5

12

lib/filesize.js

@@ -6,6 +6,6 @@ /**

* @copyright 2013 Jason Mulligan
* @license BSD-3 <http://opensource.org/licenses/BSD-3-Clause>
* @license BSD-3 <https://raw.github.com/avoidwork/filesize.js/master/LICENSE>
* @link http://filesizejs.com
* @module filesize
* @version 1.7.4
* @version 1.7.5
*/

@@ -28,3 +28,3 @@

if (typeof arguments[2] !== "undefined") {
if (arguments[2] !== undefined) {
pos = arguments[1];

@@ -35,6 +35,6 @@ short = arguments[2];

if (isNaN(arg) || (typeof pos !== "undefined" && isNaN(pos))) throw Error("Invalid arguments");
if (isNaN(arg) || (pos !== undefined && isNaN(pos))) throw Error("Invalid arguments");
short = (short === true);
pos = short ? 1 : (typeof pos === "undefined" ? 2 : parseInt(pos, base));
pos = short ? 1 : (pos === undefined ? 2 : parseInt(pos, base));
num = Number(arg);

@@ -63,3 +63,3 @@ neg = (num < 0);

z = regex.exec(result);
if (z !== null && typeof z[1] !== "undefined" && zero.test(z[1])) result = parseInt(result, base);
if (z !== null && z[1] !== undefined && zero.test(z[1])) result = parseInt(result, base);
}

@@ -66,0 +66,0 @@ result += suffix;

@@ -6,7 +6,7 @@ /**

* @copyright 2013 Jason Mulligan
* @license BSD-3 <http://opensource.org/licenses/BSD-3-Clause>
* @license BSD-3 <https://raw.github.com/avoidwork/filesize.js/master/LICENSE>
* @link http://filesizejs.com
* @module filesize
* @version 1.7.4
* @version 1.7.5
*/
(function(e){"use strict";var t=function(e){var t=10,n,r,i,s,o,u,a,f,l,c,h,p,d,v;typeof arguments[2]!="undefined"?(u=arguments[1],l=arguments[2]):typeof arguments[1]=="boolean"?l=arguments[1]:u=arguments[1];if(isNaN(e)||typeof u!="undefined"&&isNaN(u))throw Error("Invalid arguments");l=l===!0,u=l?1:typeof u=="undefined"?2:parseInt(u,t),o=Number(e),s=o<0,h=[["B",0],["Kb",128],["KB",1024],["Mb",131072],["MB","1.049e+6"],["Gb","1.342e+8"],["GB","1.074e+9"],["Tb","1.374e+11"],["TB","1.1e+12"],["Pb","1.407e+14"],["PB","1.126e+15"]],i=h.length,f="",a=/\.(.*)/,n=/b$/,r=/^B$/,v=/^0$/,s&&(o=Math.abs(o));while(i--){c=h[i][1],p=h[i][0],i>3&&(c=Number(c));if(o>=c){f=(r.test(p)?o:o/c).toFixed(u),l&&(n.test(p)&&(p=p.toLowerCase()),p=p.slice(0,1),d=a.exec(f),d!==null&&typeof d[1]!="undefined"&&v.test(d[1])&&(f=parseInt(f,t))),f+=p;break}}return(s?"-":"")+f};switch(!0){case typeof exports!="undefined":module.exports=t;break;case typeof define=="function":define(function(){return t});break;default:e.filesize=t}})(this);
(function(e){"use strict";var t=function(e){var t=10,n,r,i,s,o,u,a,f,l,c,h,p,d,v;arguments[2]!==undefined?(u=arguments[1],l=arguments[2]):typeof arguments[1]=="boolean"?l=arguments[1]:u=arguments[1];if(isNaN(e)||u!==undefined&&isNaN(u))throw Error("Invalid arguments");l=l===!0,u=l?1:u===undefined?2:parseInt(u,t),o=Number(e),s=o<0,h=[["B",0],["Kb",128],["KB",1024],["Mb",131072],["MB","1.049e+6"],["Gb","1.342e+8"],["GB","1.074e+9"],["Tb","1.374e+11"],["TB","1.1e+12"],["Pb","1.407e+14"],["PB","1.126e+15"]],i=h.length,f="",a=/\.(.*)/,n=/b$/,r=/^B$/,v=/^0$/,s&&(o=Math.abs(o));while(i--){c=h[i][1],p=h[i][0],i>3&&(c=Number(c));if(o>=c){f=(r.test(p)?o:o/c).toFixed(u),l&&(n.test(p)&&(p=p.toLowerCase()),p=p.slice(0,1),d=a.exec(f),d!==null&&d[1]!==undefined&&v.test(d[1])&&(f=parseInt(f,t))),f+=p;break}}return(s?"-":"")+f};switch(!0){case typeof exports!="undefined":module.exports=t;break;case typeof define=="function":define(function(){return t});break;default:e.filesize=t}})(this);
{
"name": "filesize",
"description": "JavaScript library to generate a human readable String describing the file size",
"version": "1.7.4",
"version": "1.7.5",
"homepage": "http://filesizejs.com",

@@ -20,3 +20,3 @@ "author": {

"type": "BSD-3",
"url": "http://opensource.org/licenses/BSD-3-Clause"
"url": "https://raw.github.com/avoidwork/filesize.js/master/LICENSE"
}

@@ -23,0 +23,0 @@ ],

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

if (typeof arguments[2] !== "undefined") {
if (arguments[2] !== undefined) {
pos = arguments[1];

@@ -23,6 +23,6 @@ short = arguments[2];

if (isNaN(arg) || (typeof pos !== "undefined" && isNaN(pos))) throw Error("Invalid arguments");
if (isNaN(arg) || (pos !== undefined && isNaN(pos))) throw Error("Invalid arguments");
short = (short === true);
pos = short ? 1 : (typeof pos === "undefined" ? 2 : parseInt(pos, base));
pos = short ? 1 : (pos === undefined ? 2 : parseInt(pos, base));
num = Number(arg);

@@ -51,3 +51,3 @@ neg = (num < 0);

z = regex.exec(result);
if (z !== null && typeof z[1] !== "undefined" && zero.test(z[1])) result = parseInt(result, base);
if (z !== null && z[1] !== undefined && zero.test(z[1])) result = parseInt(result, base);
}

@@ -54,0 +54,0 @@ result += suffix;

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