Socket
Socket
Sign inDemoInstall

filesize

Package Overview
Dependencies
0
Maintainers
1
Versions
120
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.2.5 to 6.2.6

4

lib/filesize.es6.js

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

* @license BSD-3-Clause
* @version 6.2.5
* @version 6.2.6
*/

@@ -93,3 +93,3 @@ (function (global, factory) {

result[0] = 0;
result[1] = unix ? "" : symbol[standard][bits ? "bits" : "bytes"][e];
u = result[1] = unix ? "" : symbol[standard][bits ? "bits" : "bytes"][e];
} else {

@@ -96,0 +96,0 @@ val = num / (base === 2 ? Math.pow(2, e * 10) : Math.pow(1000, e));

/*!
2020 Jason Mulligan <jason.mulligan@avoidwork.com>
@version 6.2.5
@version 6.2.6
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).filesize=t()}(this,(function(){"use strict";const e=/^(b|B)$/,t={iec:{bits:["b","Kib","Mib","Gib","Tib","Pib","Eib","Zib","Yib"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["b","Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},i={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]};function o(o,n={}){let b,r,a,s,l,d,p,f,c,u,B,g,y,h,m,x,M,v,j,N=[],T=0;if(isNaN(o))throw new TypeError("Invalid number");if(a=!0===n.bits,m=!0===n.unix,g=!0===n.pad,r=n.base||2,y=void 0!==n.round?n.round:m?1:2,p=void 0!==n.locale?n.locale:"",f=n.localeOptions||{},x=void 0!==n.separator?n.separator:"",M=void 0!==n.spacer?n.spacer:m?"":" ",j=n.symbols||{},v=2===r&&n.standard||"jedec",B=n.output||"string",l=!0===n.fullform,d=n.fullforms instanceof Array?n.fullforms:[],b=void 0!==n.exponent?n.exponent:-1,u=Number(o),c=u<0,s=r>2?1e3:1024,c&&(u=-u),(-1===b||isNaN(b))&&(b=Math.floor(Math.log(u)/Math.log(s)),b<0&&(b=0)),b>8&&(b=8),"exponent"===B)return b;if(0===u?(N[0]=0,N[1]=m?"":t[v][a?"bits":"bytes"][b]):(T=u/(2===r?Math.pow(2,10*b):Math.pow(1e3,b)),a&&(T*=8,T>=s&&b<8&&(T/=s,b++)),N[0]=Number(T.toFixed(b>0?y:0)),N[0]===s&&b<8&&void 0===n.exponent&&(N[0]=1,b++),h=N[1]=10===r&&1===b?a?"kb":"kB":t[v][a?"bits":"bytes"][b],m&&(N[1]="jedec"===v?N[1].charAt(0):b>0?N[1].replace(/B$/,""):N[1],e.test(N[1])&&(N[0]=Math.floor(N[0]),N[1]=""))),c&&(N[0]=-N[0]),N[1]=j[N[1]]||N[1],!0===p?N[0]=N[0].toLocaleString():p.length>0?N[0]=N[0].toLocaleString(p,f):x.length>0&&(N[0]=N[0].toString().replace(".",x)),g&&!1===Number.isInteger(N[0])&&y>0){const e=x||".",t=N[0].toString().split(e),i=t[1]||"",o=i.length,n=y-o;N[0]=`${t[0]}${e}${i.padEnd(o+n,"0")}`}return l&&(N[1]=d[b]?d[b]:i[v][b]+(a?"bit":"byte")+(1===N[0]?"":"s")),"array"===B?N:"object"===B?{value:N[0],symbol:N[1],exponent:b,unit:h}:N.join(M)}return o.partial=e=>t=>o(t,e),o}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).filesize=t()}(this,(function(){"use strict";const e=/^(b|B)$/,t={iec:{bits:["b","Kib","Mib","Gib","Tib","Pib","Eib","Zib","Yib"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["b","Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},i={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]};function o(o,n={}){let b,r,a,s,l,d,p,f,c,u,B,g,y,h,m,x,M,v,j,N=[],T=0;if(isNaN(o))throw new TypeError("Invalid number");if(a=!0===n.bits,m=!0===n.unix,g=!0===n.pad,r=n.base||2,y=void 0!==n.round?n.round:m?1:2,p=void 0!==n.locale?n.locale:"",f=n.localeOptions||{},x=void 0!==n.separator?n.separator:"",M=void 0!==n.spacer?n.spacer:m?"":" ",j=n.symbols||{},v=2===r&&n.standard||"jedec",B=n.output||"string",l=!0===n.fullform,d=n.fullforms instanceof Array?n.fullforms:[],b=void 0!==n.exponent?n.exponent:-1,u=Number(o),c=u<0,s=r>2?1e3:1024,c&&(u=-u),(-1===b||isNaN(b))&&(b=Math.floor(Math.log(u)/Math.log(s)),b<0&&(b=0)),b>8&&(b=8),"exponent"===B)return b;if(0===u?(N[0]=0,h=N[1]=m?"":t[v][a?"bits":"bytes"][b]):(T=u/(2===r?Math.pow(2,10*b):Math.pow(1e3,b)),a&&(T*=8,T>=s&&b<8&&(T/=s,b++)),N[0]=Number(T.toFixed(b>0?y:0)),N[0]===s&&b<8&&void 0===n.exponent&&(N[0]=1,b++),h=N[1]=10===r&&1===b?a?"kb":"kB":t[v][a?"bits":"bytes"][b],m&&(N[1]="jedec"===v?N[1].charAt(0):b>0?N[1].replace(/B$/,""):N[1],e.test(N[1])&&(N[0]=Math.floor(N[0]),N[1]=""))),c&&(N[0]=-N[0]),N[1]=j[N[1]]||N[1],!0===p?N[0]=N[0].toLocaleString():p.length>0?N[0]=N[0].toLocaleString(p,f):x.length>0&&(N[0]=N[0].toString().replace(".",x)),g&&!1===Number.isInteger(N[0])&&y>0){const e=x||".",t=N[0].toString().split(e),i=t[1]||"",o=i.length,n=y-o;N[0]=`${t[0]}${e}${i.padEnd(o+n,"0")}`}return l&&(N[1]=d[b]?d[b]:i[v][b]+(a?"bit":"byte")+(1===N[0]?"":"s")),"array"===B?N:"object"===B?{value:N[0],symbol:N[1],exponent:b,unit:h}:N.join(M)}return o.partial=e=>t=>o(t,e),o}));
//# sourceMappingURL=filesize.es6.min.js.map

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

* @license BSD-3-Clause
* @version 6.2.5
* @version 6.2.6
*/

@@ -111,3 +111,3 @@ (function (global, factory) {

result[0] = 0;
result[1] = unix ? "" : symbol[standard][bits ? "bits" : "bytes"][e];
u = result[1] = unix ? "" : symbol[standard][bits ? "bits" : "bytes"][e];
} else {

@@ -114,0 +114,0 @@ val = num / (base === 2 ? Math.pow(2, e * 10) : Math.pow(1000, e));

/*!
2020 Jason Mulligan <jason.mulligan@avoidwork.com>
@version 6.2.5
@version 6.2.6
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).filesize=t()}(this,(function(){"use strict";var e=/^(b|B)$/,t={iec:{bits:["b","Kib","Mib","Gib","Tib","Pib","Eib","Zib","Yib"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["b","Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},i={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]};function o(o){var n,r,a,b,l,s,c,d,u,f,p,B,g,y,h,m,v,x,M,j=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},N=[],T=0;if(isNaN(o))throw new TypeError("Invalid number");if(a=!0===j.bits,h=!0===j.unix,B=!0===j.pad,r=j.base||2,g=void 0!==j.round?j.round:h?1:2,c=void 0!==j.locale?j.locale:"",d=j.localeOptions||{},m=void 0!==j.separator?j.separator:"",v=void 0!==j.spacer?j.spacer:h?"":" ",M=j.symbols||{},x=2===r&&j.standard||"jedec",p=j.output||"string",l=!0===j.fullform,s=j.fullforms instanceof Array?j.fullforms:[],n=void 0!==j.exponent?j.exponent:-1,b=r>2?1e3:1024,(u=(f=Number(o))<0)&&(f=-f),(-1===n||isNaN(n))&&(n=Math.floor(Math.log(f)/Math.log(b)))<0&&(n=0),n>8&&(n=8),"exponent"===p)return n;if(0===f?(N[0]=0,N[1]=h?"":t[x][a?"bits":"bytes"][n]):(T=f/(2===r?Math.pow(2,10*n):Math.pow(1e3,n)),a&&(T*=8)>=b&&n<8&&(T/=b,n++),N[0]=Number(T.toFixed(n>0?g:0)),N[0]===b&&n<8&&void 0===j.exponent&&(N[0]=1,n++),y=N[1]=10===r&&1===n?a?"kb":"kB":t[x][a?"bits":"bytes"][n],h&&(N[1]="jedec"===x?N[1].charAt(0):n>0?N[1].replace(/B$/,""):N[1],e.test(N[1])&&(N[0]=Math.floor(N[0]),N[1]=""))),u&&(N[0]=-N[0]),N[1]=M[N[1]]||N[1],!0===c?N[0]=N[0].toLocaleString():c.length>0?N[0]=N[0].toLocaleString(c,d):m.length>0&&(N[0]=N[0].toString().replace(".",m)),B&&!1===Number.isInteger(N[0])&&g>0){var E=m||".",k=N[0].toString().split(E),w=k[1]||"",G=w.length,K=g-G;N[0]="".concat(k[0]).concat(E).concat(w.padEnd(G+K,"0"))}return l&&(N[1]=s[n]?s[n]:i[x][n]+(a?"bit":"byte")+(1===N[0]?"":"s")),"array"===p?N:"object"===p?{value:N[0],symbol:N[1],exponent:n,unit:y}:N.join(v)}return o.partial=function(e){return function(t){return o(t,e)}},o}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).filesize=t()}(this,(function(){"use strict";var e=/^(b|B)$/,t={iec:{bits:["b","Kib","Mib","Gib","Tib","Pib","Eib","Zib","Yib"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["b","Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},i={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]};function o(o){var n,r,a,b,l,s,c,d,u,f,p,B,g,y,h,m,v,x,M,j=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},N=[],T=0;if(isNaN(o))throw new TypeError("Invalid number");if(a=!0===j.bits,h=!0===j.unix,B=!0===j.pad,r=j.base||2,g=void 0!==j.round?j.round:h?1:2,c=void 0!==j.locale?j.locale:"",d=j.localeOptions||{},m=void 0!==j.separator?j.separator:"",v=void 0!==j.spacer?j.spacer:h?"":" ",M=j.symbols||{},x=2===r&&j.standard||"jedec",p=j.output||"string",l=!0===j.fullform,s=j.fullforms instanceof Array?j.fullforms:[],n=void 0!==j.exponent?j.exponent:-1,b=r>2?1e3:1024,(u=(f=Number(o))<0)&&(f=-f),(-1===n||isNaN(n))&&(n=Math.floor(Math.log(f)/Math.log(b)))<0&&(n=0),n>8&&(n=8),"exponent"===p)return n;if(0===f?(N[0]=0,y=N[1]=h?"":t[x][a?"bits":"bytes"][n]):(T=f/(2===r?Math.pow(2,10*n):Math.pow(1e3,n)),a&&(T*=8)>=b&&n<8&&(T/=b,n++),N[0]=Number(T.toFixed(n>0?g:0)),N[0]===b&&n<8&&void 0===j.exponent&&(N[0]=1,n++),y=N[1]=10===r&&1===n?a?"kb":"kB":t[x][a?"bits":"bytes"][n],h&&(N[1]="jedec"===x?N[1].charAt(0):n>0?N[1].replace(/B$/,""):N[1],e.test(N[1])&&(N[0]=Math.floor(N[0]),N[1]=""))),u&&(N[0]=-N[0]),N[1]=M[N[1]]||N[1],!0===c?N[0]=N[0].toLocaleString():c.length>0?N[0]=N[0].toLocaleString(c,d):m.length>0&&(N[0]=N[0].toString().replace(".",m)),B&&!1===Number.isInteger(N[0])&&g>0){var E=m||".",k=N[0].toString().split(E),w=k[1]||"",G=w.length,K=g-G;N[0]="".concat(k[0]).concat(E).concat(w.padEnd(G+K,"0"))}return l&&(N[1]=s[n]?s[n]:i[x][n]+(a?"bit":"byte")+(1===N[0]?"":"s")),"array"===p?N:"object"===p?{value:N[0],symbol:N[1],exponent:n,unit:y}:N.join(v)}return o.partial=function(e){return function(t){return o(t,e)}},o}));
//# sourceMappingURL=filesize.min.js.map
{
"name": "filesize",
"description": "JavaScript library to generate a human readable String describing the file size",
"version": "6.2.5",
"version": "6.2.6",
"homepage": "https://filesizejs.com",

@@ -31,3 +31,4 @@ "author": "Jason Mulligan <jason.mulligan@avoidwork.com>",

"test:unit": "nodeunit test/*.js",
"lint": "eslint test/*.js src/*.js"
"lint": "eslint test/*.js src/*.js",
"types": "npx typescript src/filesize.js --declaration --allowJs --emitDeclarationOnly --outDir ./"
},

@@ -34,0 +35,0 @@ "devDependencies": {

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc