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 8.0.2 to 8.0.3

4

lib/filesize.es6.js

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

* @license BSD-3-Clause
* @version 8.0.1
* @version 8.0.3
*/

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

symbols = descriptor.symbols || {};
standard = descriptor.standard in symbol ? descriptor.standard : "iec";
standard = base === 2 ? descriptor.standard || "iec" : "jedec";
output = descriptor.output || "string";

@@ -65,0 +65,0 @@ full = descriptor.fullform === true;

/*!
2021 Jason Mulligan <jason.mulligan@avoidwork.com>
@version 8.0.1
@version 8.0.3
*/
!function(i,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(i="undefined"!=typeof globalThis?globalThis:i||self).filesize=t()}(this,(function(){"use strict";const i=/^(b|B)$/,t={iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},e={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]},o={floor:Math.floor,ceil:Math.ceil};function n(n,r={}){let a,b,s,l,d,p,c,f,u,B,h,g,y,M,m,x,v,N,T,E,j,w=[],P=0;if(isNaN(n))throw new TypeError("Invalid number");if(s=!0===r.bits,m=!0===r.unix,g=!0===r.pad,b=r.base||10,y=void 0!==r.round?r.round:m?1:2,c=void 0!==r.locale?r.locale:"",f=r.localeOptions||{},x=void 0!==r.separator?r.separator:"",v=void 0!==r.spacer?r.spacer:m?"":" ",T=r.symbols||{},N=r.standard in t?r.standard:"iec",h=r.output||"string",d=!0===r.fullform,p=r.fullforms instanceof Array?r.fullforms:[],a=void 0!==r.exponent?r.exponent:-1,E=o[r.roundingMethod]||Math.round,B=Number(n),u=B<0,l=b>2?1e3:1024,j=!1===isNaN(r.precision)?parseInt(r.precision,10):0,u&&(B=-B),(-1===a||isNaN(a))&&(a=Math.floor(Math.log(B)/Math.log(l)),a<0&&(a=0)),a>8&&(j>0&&(j+=8-a),a=8),"exponent"===h)return a;if(0===B)w[0]=0,M=w[1]=m?"":t[N][s?"bits":"bytes"][a];else{P=B/(2===b?Math.pow(2,10*a):Math.pow(1e3,a)),s&&(P*=8,P>=l&&a<8&&(P/=l,a++));const e=Math.pow(10,a>0?y:0);w[0]=E(P*e)/e,w[0]===l&&a<8&&void 0===r.exponent&&(w[0]=1,a++),M=w[1]=10===b&&1===a?s?"kbit":"kB":t[N][s?"bits":"bytes"][a],m&&(w[1]=w[1].charAt(0),i.test(w[1])&&(w[0]=Math.floor(w[0]),w[1]=""))}if(u&&(w[0]=-w[0]),j>0&&(w[0]=w[0].toPrecision(j)),w[1]=T[w[1]]||w[1],!0===c?w[0]=w[0].toLocaleString():c.length>0?w[0]=w[0].toLocaleString(c,f):x.length>0&&(w[0]=w[0].toString().replace(".",x)),g&&!1===Number.isInteger(w[0])&&y>0){const i=x||".",t=w[0].toString().split(i),e=t[1]||"",o=e.length,n=y-o;w[0]=`${t[0]}${i}${e.padEnd(o+n,"0")}`}return d&&(w[1]=p[a]?p[a]:e[N][a]+(s?"bit":"byte")+(1===w[0]?"":"s")),"array"===h?w:"object"===h?{value:w[0],symbol:w[1],exponent:a,unit:M}:w.join(v)}return n.partial=i=>t=>n(t,i),n}));
!function(i,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(i="undefined"!=typeof globalThis?globalThis:i||self).filesize=t()}(this,(function(){"use strict";const i=/^(b|B)$/,t={iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},e={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]},o={floor:Math.floor,ceil:Math.ceil};function n(n,r={}){let a,b,s,l,c,p,d,f,u,B,h,g,y,M,m,x,v,N,T,j,E,w=[],P=0;if(isNaN(n))throw new TypeError("Invalid number");if(s=!0===r.bits,m=!0===r.unix,g=!0===r.pad,b=r.base||10,y=void 0!==r.round?r.round:m?1:2,d=void 0!==r.locale?r.locale:"",f=r.localeOptions||{},x=void 0!==r.separator?r.separator:"",v=void 0!==r.spacer?r.spacer:m?"":" ",T=r.symbols||{},N=2===b?r.standard||"iec":"jedec",h=r.output||"string",c=!0===r.fullform,p=r.fullforms instanceof Array?r.fullforms:[],a=void 0!==r.exponent?r.exponent:-1,j=o[r.roundingMethod]||Math.round,B=Number(n),u=B<0,l=b>2?1e3:1024,E=!1===isNaN(r.precision)?parseInt(r.precision,10):0,u&&(B=-B),(-1===a||isNaN(a))&&(a=Math.floor(Math.log(B)/Math.log(l)),a<0&&(a=0)),a>8&&(E>0&&(E+=8-a),a=8),"exponent"===h)return a;if(0===B)w[0]=0,M=w[1]=m?"":t[N][s?"bits":"bytes"][a];else{P=B/(2===b?Math.pow(2,10*a):Math.pow(1e3,a)),s&&(P*=8,P>=l&&a<8&&(P/=l,a++));const e=Math.pow(10,a>0?y:0);w[0]=j(P*e)/e,w[0]===l&&a<8&&void 0===r.exponent&&(w[0]=1,a++),M=w[1]=10===b&&1===a?s?"kbit":"kB":t[N][s?"bits":"bytes"][a],m&&(w[1]=w[1].charAt(0),i.test(w[1])&&(w[0]=Math.floor(w[0]),w[1]=""))}if(u&&(w[0]=-w[0]),E>0&&(w[0]=w[0].toPrecision(E)),w[1]=T[w[1]]||w[1],!0===d?w[0]=w[0].toLocaleString():d.length>0?w[0]=w[0].toLocaleString(d,f):x.length>0&&(w[0]=w[0].toString().replace(".",x)),g&&!1===Number.isInteger(w[0])&&y>0){const i=x||".",t=w[0].toString().split(i),e=t[1]||"",o=e.length,n=y-o;w[0]=`${t[0]}${i}${e.padEnd(o+n,"0")}`}return c&&(w[1]=p[a]?p[a]:e[N][a]+(s?"bit":"byte")+(1===w[0]?"":"s")),"array"===h?w:"object"===h?{value:w[0],symbol:w[1],exponent:a,unit:M}:w.join(v)}return n.partial=i=>t=>n(t,i),n}));
//# sourceMappingURL=filesize.es6.min.js.map

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

* @license BSD-3-Clause
* @version 8.0.1
* @version 8.0.3
*/

@@ -56,3 +56,3 @@ const b = /^(b|B)$/,

symbols = descriptor.symbols || {};
standard = descriptor.standard in symbol ? descriptor.standard : "iec";
standard = base === 2 ? descriptor.standard || "iec" : "jedec";
output = descriptor.output || "string";

@@ -59,0 +59,0 @@ full = descriptor.fullform === true;

/*!
2021 Jason Mulligan <jason.mulligan@avoidwork.com>
@version 8.0.1
@version 8.0.3
*/
const i=/^(b|B)$/,t={iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},e={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]},o={floor:Math.floor,ceil:Math.ceil};function a(a,r={}){let n,b,s,l,p,c,d,B,u,f,g,h,M,y,m,x,v,N,E,w,P,T=[],j=0;if(isNaN(a))throw new TypeError("Invalid number");if(s=!0===r.bits,m=!0===r.unix,h=!0===r.pad,b=r.base||10,M=void 0!==r.round?r.round:m?1:2,d=void 0!==r.locale?r.locale:"",B=r.localeOptions||{},x=void 0!==r.separator?r.separator:"",v=void 0!==r.spacer?r.spacer:m?"":" ",E=r.symbols||{},N=r.standard in t?r.standard:"iec",g=r.output||"string",p=!0===r.fullform,c=r.fullforms instanceof Array?r.fullforms:[],n=void 0!==r.exponent?r.exponent:-1,w=o[r.roundingMethod]||Math.round,f=Number(a),u=f<0,l=b>2?1e3:1024,P=!1===isNaN(r.precision)?parseInt(r.precision,10):0,u&&(f=-f),(-1===n||isNaN(n))&&(n=Math.floor(Math.log(f)/Math.log(l)),n<0&&(n=0)),n>8&&(P>0&&(P+=8-n),n=8),"exponent"===g)return n;if(0===f)T[0]=0,y=T[1]=m?"":t[N][s?"bits":"bytes"][n];else{j=f/(2===b?Math.pow(2,10*n):Math.pow(1e3,n)),s&&(j*=8,j>=l&&n<8&&(j/=l,n++));const e=Math.pow(10,n>0?M:0);T[0]=w(j*e)/e,T[0]===l&&n<8&&void 0===r.exponent&&(T[0]=1,n++),y=T[1]=10===b&&1===n?s?"kbit":"kB":t[N][s?"bits":"bytes"][n],m&&(T[1]=T[1].charAt(0),i.test(T[1])&&(T[0]=Math.floor(T[0]),T[1]=""))}if(u&&(T[0]=-T[0]),P>0&&(T[0]=T[0].toPrecision(P)),T[1]=E[T[1]]||T[1],!0===d?T[0]=T[0].toLocaleString():d.length>0?T[0]=T[0].toLocaleString(d,B):x.length>0&&(T[0]=T[0].toString().replace(".",x)),h&&!1===Number.isInteger(T[0])&&M>0){const i=x||".",t=T[0].toString().split(i),e=t[1]||"",o=e.length,a=M-o;T[0]=`${t[0]}${i}${e.padEnd(o+a,"0")}`}return p&&(T[1]=c[n]?c[n]:e[N][n]+(s?"bit":"byte")+(1===T[0]?"":"s")),"array"===g?T:"object"===g?{value:T[0],symbol:T[1],exponent:n,unit:y}:T.join(v)}a.partial=i=>t=>a(t,i);export{a as default};
const i=/^(b|B)$/,t={iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},e={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]},o={floor:Math.floor,ceil:Math.ceil};function a(a,r={}){let b,n,s,l,c,p,d,B,u,f,g,h,M,y,m,x,v,N,E,j,w,P=[],T=0;if(isNaN(a))throw new TypeError("Invalid number");if(s=!0===r.bits,m=!0===r.unix,h=!0===r.pad,n=r.base||10,M=void 0!==r.round?r.round:m?1:2,d=void 0!==r.locale?r.locale:"",B=r.localeOptions||{},x=void 0!==r.separator?r.separator:"",v=void 0!==r.spacer?r.spacer:m?"":" ",E=r.symbols||{},N=2===n?r.standard||"iec":"jedec",g=r.output||"string",c=!0===r.fullform,p=r.fullforms instanceof Array?r.fullforms:[],b=void 0!==r.exponent?r.exponent:-1,j=o[r.roundingMethod]||Math.round,f=Number(a),u=f<0,l=n>2?1e3:1024,w=!1===isNaN(r.precision)?parseInt(r.precision,10):0,u&&(f=-f),(-1===b||isNaN(b))&&(b=Math.floor(Math.log(f)/Math.log(l)),b<0&&(b=0)),b>8&&(w>0&&(w+=8-b),b=8),"exponent"===g)return b;if(0===f)P[0]=0,y=P[1]=m?"":t[N][s?"bits":"bytes"][b];else{T=f/(2===n?Math.pow(2,10*b):Math.pow(1e3,b)),s&&(T*=8,T>=l&&b<8&&(T/=l,b++));const e=Math.pow(10,b>0?M:0);P[0]=j(T*e)/e,P[0]===l&&b<8&&void 0===r.exponent&&(P[0]=1,b++),y=P[1]=10===n&&1===b?s?"kbit":"kB":t[N][s?"bits":"bytes"][b],m&&(P[1]=P[1].charAt(0),i.test(P[1])&&(P[0]=Math.floor(P[0]),P[1]=""))}if(u&&(P[0]=-P[0]),w>0&&(P[0]=P[0].toPrecision(w)),P[1]=E[P[1]]||P[1],!0===d?P[0]=P[0].toLocaleString():d.length>0?P[0]=P[0].toLocaleString(d,B):x.length>0&&(P[0]=P[0].toString().replace(".",x)),h&&!1===Number.isInteger(P[0])&&M>0){const i=x||".",t=P[0].toString().split(i),e=t[1]||"",o=e.length,a=M-o;P[0]=`${t[0]}${i}${e.padEnd(o+a,"0")}`}return c&&(P[1]=p[b]?p[b]:e[N][b]+(s?"bit":"byte")+(1===P[0]?"":"s")),"array"===g?P:"object"===g?{value:P[0],symbol:P[1],exponent:b,unit:y}:P.join(v)}a.partial=i=>t=>a(t,i);export{a as default};
//# sourceMappingURL=filesize.esm.min.js.map

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

* @license BSD-3-Clause
* @version 8.0.1
* @version 8.0.3
*/

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

symbols = descriptor.symbols || {};
standard = descriptor.standard in symbol ? descriptor.standard : "iec";
standard = base === 2 ? descriptor.standard || "iec" : "jedec";
output = descriptor.output || "string";

@@ -86,0 +86,0 @@ full = descriptor.fullform === true;

/*!
2021 Jason Mulligan <jason.mulligan@avoidwork.com>
@version 8.0.1
@version 8.0.3
*/
!function(i,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(i="undefined"!=typeof globalThis?globalThis:i||self).filesize=t()}(this,(function(){"use strict";var i=/^(b|B)$/,t={iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},e={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]},o={floor:Math.floor,ceil:Math.ceil};function n(n){var r,a,b,s,l,c,d,f,p,u,h,B,g,y,M,m,v,x,N,T,E,j=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},w=[],P=0;if(isNaN(n))throw new TypeError("Invalid number");if(b=!0===j.bits,M=!0===j.unix,B=!0===j.pad,a=j.base||10,g=void 0!==j.round?j.round:M?1:2,d=void 0!==j.locale?j.locale:"",f=j.localeOptions||{},m=void 0!==j.separator?j.separator:"",v=void 0!==j.spacer?j.spacer:M?"":" ",N=j.symbols||{},x=j.standard in t?j.standard:"iec",h=j.output||"string",l=!0===j.fullform,c=j.fullforms instanceof Array?j.fullforms:[],r=void 0!==j.exponent?j.exponent:-1,T=o[j.roundingMethod]||Math.round,p=(u=Number(n))<0,s=a>2?1e3:1024,E=!1===isNaN(j.precision)?parseInt(j.precision,10):0,p&&(u=-u),(-1===r||isNaN(r))&&(r=Math.floor(Math.log(u)/Math.log(s)))<0&&(r=0),r>8&&(E>0&&(E+=8-r),r=8),"exponent"===h)return r;if(0===u)w[0]=0,y=w[1]=M?"":t[x][b?"bits":"bytes"][r];else{P=u/(2===a?Math.pow(2,10*r):Math.pow(1e3,r)),b&&(P*=8)>=s&&r<8&&(P/=s,r++);var k=Math.pow(10,r>0?g:0);w[0]=T(P*k)/k,w[0]===s&&r<8&&void 0===j.exponent&&(w[0]=1,r++),y=w[1]=10===a&&1===r?b?"kbit":"kB":t[x][b?"bits":"bytes"][r],M&&(w[1]=w[1].charAt(0),i.test(w[1])&&(w[0]=Math.floor(w[0]),w[1]=""))}if(p&&(w[0]=-w[0]),E>0&&(w[0]=w[0].toPrecision(E)),w[1]=N[w[1]]||w[1],!0===d?w[0]=w[0].toLocaleString():d.length>0?w[0]=w[0].toLocaleString(d,f):m.length>0&&(w[0]=w[0].toString().replace(".",m)),B&&!1===Number.isInteger(w[0])&&g>0){var G=m||".",K=w[0].toString().split(G),S=K[1]||"",Y=S.length,Z=g-Y;w[0]="".concat(K[0]).concat(G).concat(S.padEnd(Y+Z,"0"))}return l&&(w[1]=c[r]?c[r]:e[x][r]+(b?"bit":"byte")+(1===w[0]?"":"s")),"array"===h?w:"object"===h?{value:w[0],symbol:w[1],exponent:r,unit:y}:w.join(v)}return n.partial=function(i){return function(t){return n(t,i)}},n}));
!function(i,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(i="undefined"!=typeof globalThis?globalThis:i||self).filesize=t()}(this,(function(){"use strict";var i=/^(b|B)$/,t={iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},e={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]},o={floor:Math.floor,ceil:Math.ceil};function n(n){var r,a,b,s,l,c,f,d,p,u,h,B,g,y,M,m,v,x,N,T,j,E=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},w=[],P=0;if(isNaN(n))throw new TypeError("Invalid number");if(b=!0===E.bits,M=!0===E.unix,B=!0===E.pad,a=E.base||10,g=void 0!==E.round?E.round:M?1:2,f=void 0!==E.locale?E.locale:"",d=E.localeOptions||{},m=void 0!==E.separator?E.separator:"",v=void 0!==E.spacer?E.spacer:M?"":" ",N=E.symbols||{},x=2===a?E.standard||"iec":"jedec",h=E.output||"string",l=!0===E.fullform,c=E.fullforms instanceof Array?E.fullforms:[],r=void 0!==E.exponent?E.exponent:-1,T=o[E.roundingMethod]||Math.round,p=(u=Number(n))<0,s=a>2?1e3:1024,j=!1===isNaN(E.precision)?parseInt(E.precision,10):0,p&&(u=-u),(-1===r||isNaN(r))&&(r=Math.floor(Math.log(u)/Math.log(s)))<0&&(r=0),r>8&&(j>0&&(j+=8-r),r=8),"exponent"===h)return r;if(0===u)w[0]=0,y=w[1]=M?"":t[x][b?"bits":"bytes"][r];else{P=u/(2===a?Math.pow(2,10*r):Math.pow(1e3,r)),b&&(P*=8)>=s&&r<8&&(P/=s,r++);var k=Math.pow(10,r>0?g:0);w[0]=T(P*k)/k,w[0]===s&&r<8&&void 0===E.exponent&&(w[0]=1,r++),y=w[1]=10===a&&1===r?b?"kbit":"kB":t[x][b?"bits":"bytes"][r],M&&(w[1]=w[1].charAt(0),i.test(w[1])&&(w[0]=Math.floor(w[0]),w[1]=""))}if(p&&(w[0]=-w[0]),j>0&&(w[0]=w[0].toPrecision(j)),w[1]=N[w[1]]||w[1],!0===f?w[0]=w[0].toLocaleString():f.length>0?w[0]=w[0].toLocaleString(f,d):m.length>0&&(w[0]=w[0].toString().replace(".",m)),B&&!1===Number.isInteger(w[0])&&g>0){var G=m||".",K=w[0].toString().split(G),S=K[1]||"",Y=S.length,Z=g-Y;w[0]="".concat(K[0]).concat(G).concat(S.padEnd(Y+Z,"0"))}return l&&(w[1]=c[r]?c[r]:e[x][r]+(b?"bit":"byte")+(1===w[0]?"":"s")),"array"===h?w:"object"===h?{value:w[0],symbol:w[1],exponent:r,unit:y}:w.join(v)}return n.partial=function(i){return function(t){return n(t,i)}},n}));
//# sourceMappingURL=filesize.min.js.map
{
"name": "filesize",
"description": "JavaScript library to generate a human readable String describing the file size",
"version": "8.0.2",
"version": "8.0.3",
"homepage": "https://filesizejs.com",

@@ -6,0 +6,0 @@ "author": "Jason Mulligan <jason.mulligan@avoidwork.com>",

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc