Comparing version 10.0.6 to 10.0.7
/** | ||
* filesize | ||
* | ||
* @copyright 2022 Jason Mulligan <jason.mulligan@avoidwork.com> | ||
* @copyright 2023 Jason Mulligan <jason.mulligan@avoidwork.com> | ||
* @license BSD-3-Clause | ||
* @version 10.0.6 | ||
* @version 10.0.7 | ||
*/ | ||
@@ -8,0 +8,0 @@ const ARRAY = "array"; |
/*! | ||
2022 Jason Mulligan <jason.mulligan@avoidwork.com> | ||
@version 10.0.6 | ||
2023 Jason Mulligan <jason.mulligan@avoidwork.com> | ||
@version 10.0.7 | ||
*/ | ||
const t={symbol:{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"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function i(i,{bits:e=!1,pad:o=!1,base:n=-1,round:r=2,locale:b="",localeOptions:s={},separator:l="",spacer:a=" ",symbols:c={},standard:p="",output:u="string",fullform:d=!1,fullforms:f=[],exponent:g=-1,roundingMethod:m="round",precision:y=0}={}){let B=g,h=Number(i),M=[],j=0,x="";-1===n&&0===p.length?(n=10,p="jedec"):-1===n&&p.length>0?n="iec"===(p="iec"===p?"iec":"jedec")?2:10:p=10===(n=2===n?2:10)||"jedec"===p?"jedec":"iec";const w=10===n?1e3:1024,E=!0===d,N=h<0,T=Math[m];if("bigint"!=typeof i&&isNaN(i))throw new TypeError("Invalid number");if("function"!=typeof T)throw new TypeError("Invalid rounding method");if(N&&(h=-h),(-1===B||isNaN(B))&&(B=Math.floor(Math.log(h)/Math.log(w)),B<0&&(B=0)),B>8&&(y>0&&(y+=8-B),B=8),"exponent"===u)return B;if(0===h)M[0]=0,x=M[1]=t.symbol[p][e?"bits":"bytes"][B];else{j=h/(2===n?Math.pow(2,10*B):Math.pow(1e3,B)),e&&(j*=8,j>=w&&B<8&&(j/=w,B++));const i=Math.pow(10,B>0?r:0);M[0]=T(j*i)/i,M[0]===w&&B<8&&-1===g&&(M[0]=1,B++),x=M[1]=10===n&&1===B?e?"kbit":"kB":t.symbol[p][e?"bits":"bytes"][B]}if(N&&(M[0]=-M[0]),y>0&&(M[0]=M[0].toPrecision(y)),M[1]=c[M[1]]||M[1],!0===b?M[0]=M[0].toLocaleString():b.length>0?M[0]=M[0].toLocaleString(b,s):l.length>0&&(M[0]=M[0].toString().replace(".",l)),o&&!1===Number.isInteger(M[0])&&r>0){const t=l||".",i=M[0].toString().split(t),e=i[1]||"",o=e.length,n=r-o;M[0]=`${i[0]}${t}${e.padEnd(o+n,"0")}`}return E&&(M[1]=f[B]?f[B]:t.fullform[p][B]+(e?"bit":"byte")+(1===M[0]?"":"s")),"array"===u?M:"object"===u?{value:M[0],symbol:M[1],exponent:B,unit:x}:M.join(a)}function e({bits:t=!1,pad:e=!1,base:o=-1,round:n=2,locale:r="",localeOptions:b={},separator:s="",spacer:l=" ",symbols:a={},standard:c="",output:p="string",fullform:u=!1,fullforms:d=[],exponent:f=-1,roundingMethod:g="round",precision:m=0}={}){return y=>i(y,{bits:t,pad:e,base:o,round:n,locale:r,localeOptions:b,separator:s,spacer:l,symbols:a,standard:c,output:p,fullform:u,fullforms:d,exponent:f,roundingMethod:g,precision:m})}export{i as filesize,e as partial};//# sourceMappingURL=filesize.esm.min.js.map | ||
const t="array",i="bit",e="bits",o="byte",n="bytes",r="",b="exponent",l="function",a="iec",s="Invalid number",p="Invalid rounding method",u="jedec",c="object",d=".",f="round",g="s",m="kbit",B="kB",h=" ",y="string",M="0",x={symbol:{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"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function w(w,{bits:E=!1,pad:N=!1,base:T=-1,round:j=2,locale:P=r,localeOptions:k={},separator:G=r,spacer:K=h,symbols:S={},standard:Y=r,output:Z=y,fullform:v=!1,fullforms:I=[],exponent:O=-1,roundingMethod:$=f,precision:z=0}={}){let L=O,q=Number(w),A=[],C=0,D=r;-1===T&&0===Y.length?(T=10,Y=u):-1===T&&Y.length>0?T=(Y=Y===a?a:u)===a?2:10:Y=10===(T=2===T?2:10)||Y===u?u:a;const F=10===T?1e3:1024,H=!0===v,J=q<0,Q=Math[$];if("bigint"!=typeof w&&isNaN(w))throw new TypeError(s);if(typeof Q!==l)throw new TypeError(p);if(J&&(q=-q),(-1===L||isNaN(L))&&(L=Math.floor(Math.log(q)/Math.log(F)),L<0&&(L=0)),L>8&&(z>0&&(z+=8-L),L=8),Z===b)return L;if(0===q)A[0]=0,D=A[1]=x.symbol[Y][E?e:n][L];else{C=q/(2===T?Math.pow(2,10*L):Math.pow(1e3,L)),E&&(C*=8,C>=F&&L<8&&(C/=F,L++));const t=Math.pow(10,L>0?j:0);A[0]=Q(C*t)/t,A[0]===F&&L<8&&-1===O&&(A[0]=1,L++),D=A[1]=10===T&&1===L?E?m:B:x.symbol[Y][E?e:n][L]}if(J&&(A[0]=-A[0]),z>0&&(A[0]=A[0].toPrecision(z)),A[1]=S[A[1]]||A[1],!0===P?A[0]=A[0].toLocaleString():P.length>0?A[0]=A[0].toLocaleString(P,k):G.length>0&&(A[0]=A[0].toString().replace(d,G)),N&&!1===Number.isInteger(A[0])&&j>0){const t=G||d,i=A[0].toString().split(t),e=i[1]||r,o=e.length,n=j-o;A[0]=`${i[0]}${t}${e.padEnd(o+n,M)}`}return H&&(A[1]=I[L]?I[L]:x.fullform[Y][L]+(E?i:o)+(1===A[0]?r:g)),Z===t?A:Z===c?{value:A[0],symbol:A[1],exponent:L,unit:D}:A.join(K)}function E({bits:t=!1,pad:i=!1,base:e=-1,round:o=2,locale:n=r,localeOptions:b={},separator:l=r,spacer:a=h,symbols:s={},standard:p=r,output:u=y,fullform:c=!1,fullforms:d=[],exponent:g=-1,roundingMethod:m=f,precision:B=0}={}){return r=>w(r,{bits:t,pad:i,base:e,round:o,locale:n,localeOptions:b,separator:l,spacer:a,symbols:s,standard:p,output:u,fullform:c,fullforms:d,exponent:g,roundingMethod:m,precision:B})}export{w as filesize,E as partial};//# sourceMappingURL=filesize.esm.min.js.map |
/** | ||
* filesize | ||
* | ||
* @copyright 2022 Jason Mulligan <jason.mulligan@avoidwork.com> | ||
* @copyright 2023 Jason Mulligan <jason.mulligan@avoidwork.com> | ||
* @license BSD-3-Clause | ||
* @version 10.0.6 | ||
* @version 10.0.7 | ||
*/ | ||
@@ -228,2 +228,2 @@ (function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports):typeof define==='function'&&define.amd?define(['exports'],f):(g=typeof globalThis!=='undefined'?globalThis:g||self,f(g.filesize={}));})(this,(function(exports){'use strict';const ARRAY = "array"; | ||
}); | ||
}exports.filesize=filesize;exports.partial=partial;Object.defineProperty(exports,'__esModule',{value:true});})); | ||
}exports.filesize=filesize;exports.partial=partial;})); |
/*! | ||
2022 Jason Mulligan <jason.mulligan@avoidwork.com> | ||
@version 10.0.6 | ||
2023 Jason Mulligan <jason.mulligan@avoidwork.com> | ||
@version 10.0.7 | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).filesize={})}(this,(function(t){"use strict";const e="bits",i="bytes",o="",n="iec",r="jedec",l="round",s="string",a={symbol:{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"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function b(t,{bits:b=!1,pad:p=!1,base:f=-1,round:u=2,locale:d="",localeOptions:c={},separator:g="",spacer:m=" ",symbols:y={},standard:h="",output:B=s,fullform:M=!1,fullforms:x=[],exponent:T=-1,roundingMethod:j=l,precision:w=0}={}){let E=T,N=Number(t),P=[],k=0,v=o;-1===f&&0===h.length?(f=10,h=r):-1===f&&h.length>0?f=(h=h===n?n:r)===n?2:10:h=10===(f=2===f?2:10)||h===r?r:n;const z=10===f?1e3:1024,G=!0===M,K=N<0,O=Math[j];if("bigint"!=typeof t&&isNaN(t))throw new TypeError("Invalid number");if("function"!=typeof O)throw new TypeError("Invalid rounding method");if(K&&(N=-N),(-1===E||isNaN(E))&&(E=Math.floor(Math.log(N)/Math.log(z)),E<0&&(E=0)),E>8&&(w>0&&(w+=8-E),E=8),"exponent"===B)return E;if(0===N)P[0]=0,v=P[1]=a.symbol[h][b?e:i][E];else{k=N/(2===f?Math.pow(2,10*E):Math.pow(1e3,E)),b&&(k*=8,k>=z&&E<8&&(k/=z,E++));const t=Math.pow(10,E>0?u:0);P[0]=O(k*t)/t,P[0]===z&&E<8&&-1===T&&(P[0]=1,E++),v=P[1]=10===f&&1===E?b?"kbit":"kB":a.symbol[h][b?e:i][E]}if(K&&(P[0]=-P[0]),w>0&&(P[0]=P[0].toPrecision(w)),P[1]=y[P[1]]||P[1],!0===d?P[0]=P[0].toLocaleString():d.length>0?P[0]=P[0].toLocaleString(d,c):g.length>0&&(P[0]=P[0].toString().replace(".",g)),p&&!1===Number.isInteger(P[0])&&u>0){const t=g||".",e=P[0].toString().split(t),i=e[1]||o,n=i.length,r=u-n;P[0]=`${e[0]}${t}${i.padEnd(n+r,"0")}`}return G&&(P[1]=x[E]?x[E]:a.fullform[h][E]+(b?"bit":"byte")+(1===P[0]?o:"s")),"array"===B?P:"object"===B?{value:P[0],symbol:P[1],exponent:E,unit:v}:P.join(m)}t.filesize=b,t.partial=function({bits:t=!1,pad:e=!1,base:i=-1,round:o=2,locale:n="",localeOptions:r={},separator:a="",spacer:p=" ",symbols:f={},standard:u="",output:d=s,fullform:c=!1,fullforms:g=[],exponent:m=-1,roundingMethod:y=l,precision:h=0}={}){return l=>b(l,{bits:t,pad:e,base:i,round:o,locale:n,localeOptions:r,separator:a,spacer:p,symbols:f,standard:u,output:d,fullform:c,fullforms:g,exponent:m,roundingMethod:y,precision:h})},Object.defineProperty(t,"__esModule",{value:!0})}));//# sourceMappingURL=filesize.min.js.map | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).filesize={})}(this,(function(t){"use strict";const i="array",e="bit",o="bits",n="byte",r="bytes",s="",l="exponent",a="function",b="iec",p="Invalid number",f="Invalid rounding method",u="jedec",d="object",c=".",g="round",m="s",y="kbit",h="kB",B=" ",M="string",x="0",T={symbol:{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"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function w(t,{bits:w=!1,pad:E=!1,base:j=-1,round:N=2,locale:P=s,localeOptions:k={},separator:z=s,spacer:G=B,symbols:K={},standard:S=s,output:Y=M,fullform:Z=!1,fullforms:v=[],exponent:I=-1,roundingMethod:O=g,precision:$=0}={}){let L=I,q=Number(t),A=[],C=0,D=s;-1===j&&0===S.length?(j=10,S=u):-1===j&&S.length>0?j=(S=S===b?b:u)===b?2:10:S=10===(j=2===j?2:10)||S===u?u:b;const F=10===j?1e3:1024,H=!0===Z,J=q<0,Q=Math[O];if("bigint"!=typeof t&&isNaN(t))throw new TypeError(p);if(typeof Q!==a)throw new TypeError(f);if(J&&(q=-q),(-1===L||isNaN(L))&&(L=Math.floor(Math.log(q)/Math.log(F)),L<0&&(L=0)),L>8&&($>0&&($+=8-L),L=8),Y===l)return L;if(0===q)A[0]=0,D=A[1]=T.symbol[S][w?o:r][L];else{C=q/(2===j?Math.pow(2,10*L):Math.pow(1e3,L)),w&&(C*=8,C>=F&&L<8&&(C/=F,L++));const t=Math.pow(10,L>0?N:0);A[0]=Q(C*t)/t,A[0]===F&&L<8&&-1===I&&(A[0]=1,L++),D=A[1]=10===j&&1===L?w?y:h:T.symbol[S][w?o:r][L]}if(J&&(A[0]=-A[0]),$>0&&(A[0]=A[0].toPrecision($)),A[1]=K[A[1]]||A[1],!0===P?A[0]=A[0].toLocaleString():P.length>0?A[0]=A[0].toLocaleString(P,k):z.length>0&&(A[0]=A[0].toString().replace(c,z)),E&&!1===Number.isInteger(A[0])&&N>0){const t=z||c,i=A[0].toString().split(t),e=i[1]||s,o=e.length,n=N-o;A[0]=`${i[0]}${t}${e.padEnd(o+n,x)}`}return H&&(A[1]=v[L]?v[L]:T.fullform[S][L]+(w?e:n)+(1===A[0]?s:m)),Y===i?A:Y===d?{value:A[0],symbol:A[1],exponent:L,unit:D}:A.join(G)}t.filesize=w,t.partial=function({bits:t=!1,pad:i=!1,base:e=-1,round:o=2,locale:n=s,localeOptions:r={},separator:l=s,spacer:a=B,symbols:b={},standard:p=s,output:f=M,fullform:u=!1,fullforms:d=[],exponent:c=-1,roundingMethod:m=g,precision:y=0}={}){return s=>w(s,{bits:t,pad:i,base:e,round:o,locale:n,localeOptions:r,separator:l,spacer:a,symbols:b,standard:p,output:f,fullform:u,fullforms:d,exponent:c,roundingMethod:m,precision:y})}}));//# sourceMappingURL=filesize.min.js.map |
{ | ||
"name": "filesize", | ||
"description": "JavaScript library to generate a human readable String describing the file size", | ||
"version": "10.0.6", | ||
"version": "10.0.7", | ||
"homepage": "https://filesizejs.com", | ||
@@ -28,3 +28,3 @@ "author": "Jason Mulligan <jason.mulligan@avoidwork.com>", | ||
"scripts": { | ||
"build": "mkdir -p dist && rm -rf dist/* || rm dist/* || echo 'nothing in ./dist' && npm run rollup", | ||
"build": "npm run rollup", | ||
"changelog": "auto-changelog -p", | ||
@@ -40,8 +40,8 @@ "coverage": "nyc npm run test", | ||
"devDependencies": { | ||
"@rollup/plugin-terser": "^0.4.0", | ||
"auto-changelog": "^2.4.0", | ||
"eslint": "^8.24.0", | ||
"mocha": "^10.0.0", | ||
"rollup": "^2.79.1", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"typescript": "^4.8.4" | ||
"eslint": "^8.37.0", | ||
"mocha": "^10.2.0", | ||
"rollup": "^3.20.2", | ||
"typescript": "^5.0.2" | ||
}, | ||
@@ -48,0 +48,0 @@ "keywords": [ |
@@ -78,3 +78,3 @@ # filesize.js | ||
## License | ||
Copyright (c) 2022 Jason Mulligan | ||
Copyright (c) 2023 Jason Mulligan | ||
Licensed under the BSD-3 license. |
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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51481
728