Comparing version 8.0.7 to 9.0.0
@@ -0,0 +0,0 @@ // Type definitions for filesize 8.0.3 |
@@ -6,3 +6,3 @@ /** | ||
* @license BSD-3-Clause | ||
* @version 8.0.7 | ||
* @version 9.0.0 | ||
*/ | ||
@@ -15,4 +15,3 @@ (function (global, factory) { | ||
const b = /^(b|B)$/, | ||
symbol = { | ||
const symbol = { | ||
iec: { | ||
@@ -47,3 +46,3 @@ bits: ["bit", "Kibit", "Mibit", "Gibit", "Tibit", "Pibit", "Eibit", "Zibit", "Yibit"], | ||
val = 0, | ||
e, base, bits, ceil, full, fullforms, locale, localeOptions, neg, num, output, pad, round, u, unix, separator, spacer, standard, symbols, roundingFunc, precision; | ||
e, base, bits, ceil, full, fullforms, locale, localeOptions, neg, num, output, pad, round, u, separator, spacer, standard, symbols, roundingFunc, precision; | ||
@@ -55,12 +54,11 @@ if (isNaN(arg)) { | ||
bits = descriptor.bits === true; | ||
unix = descriptor.unix === true; | ||
pad = descriptor.pad === true; | ||
base = descriptor.base || 10; | ||
round = descriptor.round !== void 0 ? descriptor.round : unix ? 1 : 2; | ||
round = descriptor.round !== void 0 ? descriptor.round : 2; | ||
locale = descriptor.locale !== void 0 ? descriptor.locale : ""; | ||
localeOptions = descriptor.localeOptions || {}; | ||
separator = descriptor.separator !== void 0 ? descriptor.separator : ""; | ||
spacer = descriptor.spacer !== void 0 ? descriptor.spacer : unix ? "" : " "; | ||
spacer = descriptor.spacer !== void 0 ? descriptor.spacer : " "; | ||
symbols = descriptor.symbols || {}; | ||
standard = base === 2 ? descriptor.standard || "iec" : "jedec"; | ||
standard = descriptor.standard in symbol ? descriptor.standard : "iec"; | ||
output = descriptor.output || "string"; | ||
@@ -106,3 +104,3 @@ full = descriptor.fullform === true; | ||
result[0] = 0; | ||
u = result[1] = unix ? "" : symbol[standard][bits ? "bits" : "bytes"][e]; | ||
u = result[1] = symbol[standard][bits ? "bits" : "bytes"][e]; | ||
} else { | ||
@@ -128,12 +126,3 @@ val = num / (base === 2 ? Math.pow(2, e * 10) : Math.pow(1000, e)); | ||
u = result[1] = base === 10 && e === 1 ? bits ? "kbit" : "kB" : symbol[standard][bits ? "bits" : "bytes"][e]; | ||
if (unix) { | ||
result[1] = result[1].charAt(0); | ||
if (b.test(result[1])) { | ||
result[0] = Math.floor(result[0]); | ||
result[1] = ""; | ||
} | ||
} | ||
u = result[1] = symbol[standard][bits ? "bits" : "bytes"][e]; | ||
} | ||
@@ -140,0 +129,0 @@ |
/*! | ||
2022 Jason Mulligan <jason.mulligan@avoidwork.com> | ||
@version 8.0.7 | ||
@version 9.0.0 | ||
*/ | ||
!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})); | ||
!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={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"]}},t={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]},e={floor:Math.floor,ceil:Math.ceil};function o(o,n={}){let r,a,b,s,l,d,p,c,f,u,g,B,h,y,M,m,x,v,N,T,E=[],j=0;if(isNaN(o))throw new TypeError("Invalid number");if(b=!0===n.bits,B=!0===n.pad,a=n.base||10,h=void 0!==n.round?n.round:2,p=void 0!==n.locale?n.locale:"",c=n.localeOptions||{},M=void 0!==n.separator?n.separator:"",m=void 0!==n.spacer?n.spacer:" ",v=n.symbols||{},x=n.standard in i?n.standard:"iec",g=n.output||"string",l=!0===n.fullform,d=n.fullforms instanceof Array?n.fullforms:[],r=void 0!==n.exponent?n.exponent:-1,N=e[n.roundingMethod]||Math.round,u=Number(o),f=u<0,s=a>2?1e3:1024,T=!1===isNaN(n.precision)?parseInt(n.precision,10):0,f&&(u=-u),(-1===r||isNaN(r))&&(r=Math.floor(Math.log(u)/Math.log(s)),r<0&&(r=0)),r>8&&(T>0&&(T+=8-r),r=8),"exponent"===g)return r;if(0===u)E[0]=0,y=E[1]=i[x][b?"bits":"bytes"][r];else{j=u/(2===a?Math.pow(2,10*r):Math.pow(1e3,r)),b&&(j*=8,j>=s&&r<8&&(j/=s,r++));const t=Math.pow(10,r>0?h:0);E[0]=N(j*t)/t,E[0]===s&&r<8&&void 0===n.exponent&&(E[0]=1,r++),y=E[1]=i[x][b?"bits":"bytes"][r]}if(f&&(E[0]=-E[0]),T>0&&(E[0]=E[0].toPrecision(T)),E[1]=v[E[1]]||E[1],!0===p?E[0]=E[0].toLocaleString():p.length>0?E[0]=E[0].toLocaleString(p,c):M.length>0&&(E[0]=E[0].toString().replace(".",M)),B&&!1===Number.isInteger(E[0])&&h>0){const i=M||".",t=E[0].toString().split(i),e=t[1]||"",o=e.length,n=h-o;E[0]=`${t[0]}${i}${e.padEnd(o+n,"0")}`}return l&&(E[1]=d[r]?d[r]:t[x][r]+(b?"bit":"byte")+(1===E[0]?"":"s")),"array"===g?E:"object"===g?{value:E[0],symbol:E[1],exponent:r,unit:y}:E.join(m)}return o.partial=i=>t=>o(t,i),o})); | ||
//# sourceMappingURL=filesize.es6.min.js.map |
@@ -6,6 +6,5 @@ /** | ||
* @license BSD-3-Clause | ||
* @version 8.0.7 | ||
* @version 9.0.0 | ||
*/ | ||
const b = /^(b|B)$/, | ||
symbol = { | ||
const symbol = { | ||
iec: { | ||
@@ -40,3 +39,3 @@ bits: ["bit", "Kibit", "Mibit", "Gibit", "Tibit", "Pibit", "Eibit", "Zibit", "Yibit"], | ||
val = 0, | ||
e, base, bits, ceil, full, fullforms, locale, localeOptions, neg, num, output, pad, round, u, unix, separator, spacer, standard, symbols, roundingFunc, precision; | ||
e, base, bits, ceil, full, fullforms, locale, localeOptions, neg, num, output, pad, round, u, separator, spacer, standard, symbols, roundingFunc, precision; | ||
@@ -48,12 +47,11 @@ if (isNaN(arg)) { | ||
bits = descriptor.bits === true; | ||
unix = descriptor.unix === true; | ||
pad = descriptor.pad === true; | ||
base = descriptor.base || 10; | ||
round = descriptor.round !== void 0 ? descriptor.round : unix ? 1 : 2; | ||
round = descriptor.round !== void 0 ? descriptor.round : 2; | ||
locale = descriptor.locale !== void 0 ? descriptor.locale : ""; | ||
localeOptions = descriptor.localeOptions || {}; | ||
separator = descriptor.separator !== void 0 ? descriptor.separator : ""; | ||
spacer = descriptor.spacer !== void 0 ? descriptor.spacer : unix ? "" : " "; | ||
spacer = descriptor.spacer !== void 0 ? descriptor.spacer : " "; | ||
symbols = descriptor.symbols || {}; | ||
standard = base === 2 ? descriptor.standard || "iec" : "jedec"; | ||
standard = descriptor.standard in symbol ? descriptor.standard : "iec"; | ||
output = descriptor.output || "string"; | ||
@@ -99,3 +97,3 @@ full = descriptor.fullform === true; | ||
result[0] = 0; | ||
u = result[1] = unix ? "" : symbol[standard][bits ? "bits" : "bytes"][e]; | ||
u = result[1] = symbol[standard][bits ? "bits" : "bytes"][e]; | ||
} else { | ||
@@ -121,12 +119,3 @@ val = num / (base === 2 ? Math.pow(2, e * 10) : Math.pow(1000, e)); | ||
u = result[1] = base === 10 && e === 1 ? bits ? "kbit" : "kB" : symbol[standard][bits ? "bits" : "bytes"][e]; | ||
if (unix) { | ||
result[1] = result[1].charAt(0); | ||
if (b.test(result[1])) { | ||
result[0] = Math.floor(result[0]); | ||
result[1] = ""; | ||
} | ||
} | ||
u = result[1] = symbol[standard][bits ? "bits" : "bytes"][e]; | ||
} | ||
@@ -133,0 +122,0 @@ |
/*! | ||
2022 Jason Mulligan <jason.mulligan@avoidwork.com> | ||
@version 8.0.7 | ||
@version 9.0.0 | ||
*/ | ||
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}; | ||
const i={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"]}},t={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]},e={floor:Math.floor,ceil:Math.ceil};function o(o,a={}){let n,r,b,s,l,p,c,d,u,B,f,g,h,M,y,m,v,x,N,E,w=[],P=0;if(isNaN(o))throw new TypeError("Invalid number");if(b=!0===a.bits,g=!0===a.pad,r=a.base||10,h=void 0!==a.round?a.round:2,c=void 0!==a.locale?a.locale:"",d=a.localeOptions||{},y=void 0!==a.separator?a.separator:"",m=void 0!==a.spacer?a.spacer:" ",x=a.symbols||{},v=a.standard in i?a.standard:"iec",f=a.output||"string",l=!0===a.fullform,p=a.fullforms instanceof Array?a.fullforms:[],n=void 0!==a.exponent?a.exponent:-1,N=e[a.roundingMethod]||Math.round,B=Number(o),u=B<0,s=r>2?1e3:1024,E=!1===isNaN(a.precision)?parseInt(a.precision,10):0,u&&(B=-B),(-1===n||isNaN(n))&&(n=Math.floor(Math.log(B)/Math.log(s)),n<0&&(n=0)),n>8&&(E>0&&(E+=8-n),n=8),"exponent"===f)return n;if(0===B)w[0]=0,M=w[1]=i[v][b?"bits":"bytes"][n];else{P=B/(2===r?Math.pow(2,10*n):Math.pow(1e3,n)),b&&(P*=8,P>=s&&n<8&&(P/=s,n++));const t=Math.pow(10,n>0?h:0);w[0]=N(P*t)/t,w[0]===s&&n<8&&void 0===a.exponent&&(w[0]=1,n++),M=w[1]=i[v][b?"bits":"bytes"][n]}if(u&&(w[0]=-w[0]),E>0&&(w[0]=w[0].toPrecision(E)),w[1]=x[w[1]]||w[1],!0===c?w[0]=w[0].toLocaleString():c.length>0?w[0]=w[0].toLocaleString(c,d):y.length>0&&(w[0]=w[0].toString().replace(".",y)),g&&!1===Number.isInteger(w[0])&&h>0){const i=y||".",t=w[0].toString().split(i),e=t[1]||"",o=e.length,a=h-o;w[0]=`${t[0]}${i}${e.padEnd(o+a,"0")}`}return l&&(w[1]=p[n]?p[n]:t[v][n]+(b?"bit":"byte")+(1===w[0]?"":"s")),"array"===f?w:"object"===f?{value:w[0],symbol:w[1],exponent:n,unit:M}:w.join(m)}o.partial=i=>t=>o(t,i);export{o as default}; | ||
//# sourceMappingURL=filesize.esm.min.js.map |
@@ -6,3 +6,3 @@ /** | ||
* @license BSD-3-Clause | ||
* @version 8.0.7 | ||
* @version 9.0.0 | ||
*/ | ||
@@ -15,4 +15,3 @@ (function (global, factory) { | ||
var b = /^(b|B)$/, | ||
symbol = { | ||
var symbol = { | ||
iec: { | ||
@@ -62,3 +61,2 @@ bits: ["bit", "Kibit", "Mibit", "Gibit", "Tibit", "Pibit", "Eibit", "Zibit", "Yibit"], | ||
u, | ||
unix, | ||
separator, | ||
@@ -76,12 +74,11 @@ spacer, | ||
bits = descriptor.bits === true; | ||
unix = descriptor.unix === true; | ||
pad = descriptor.pad === true; | ||
base = descriptor.base || 10; | ||
round = descriptor.round !== void 0 ? descriptor.round : unix ? 1 : 2; | ||
round = descriptor.round !== void 0 ? descriptor.round : 2; | ||
locale = descriptor.locale !== void 0 ? descriptor.locale : ""; | ||
localeOptions = descriptor.localeOptions || {}; | ||
separator = descriptor.separator !== void 0 ? descriptor.separator : ""; | ||
spacer = descriptor.spacer !== void 0 ? descriptor.spacer : unix ? "" : " "; | ||
spacer = descriptor.spacer !== void 0 ? descriptor.spacer : " "; | ||
symbols = descriptor.symbols || {}; | ||
standard = base === 2 ? descriptor.standard || "iec" : "jedec"; | ||
standard = descriptor.standard in symbol ? descriptor.standard : "iec"; | ||
output = descriptor.output || "string"; | ||
@@ -126,3 +123,3 @@ full = descriptor.fullform === true; | ||
result[0] = 0; | ||
u = result[1] = unix ? "" : symbol[standard][bits ? "bits" : "bytes"][e]; | ||
u = result[1] = symbol[standard][bits ? "bits" : "bytes"][e]; | ||
} else { | ||
@@ -148,12 +145,3 @@ val = num / (base === 2 ? Math.pow(2, e * 10) : Math.pow(1000, e)); | ||
u = result[1] = base === 10 && e === 1 ? bits ? "kbit" : "kB" : symbol[standard][bits ? "bits" : "bytes"][e]; | ||
if (unix) { | ||
result[1] = result[1].charAt(0); | ||
if (b.test(result[1])) { | ||
result[0] = Math.floor(result[0]); | ||
result[1] = ""; | ||
} | ||
} | ||
u = result[1] = symbol[standard][bits ? "bits" : "bytes"][e]; | ||
} // Decorating a 'diff' | ||
@@ -160,0 +148,0 @@ |
/*! | ||
2022 Jason Mulligan <jason.mulligan@avoidwork.com> | ||
@version 8.0.7 | ||
@version 9.0.0 | ||
*/ | ||
!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})); | ||
!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={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"]}},t={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]},e={floor:Math.floor,ceil:Math.ceil};function o(o){var n,r,a,b,s,l,c,d,f,p,u,g,h,B,y,M,m,v,x,N,T=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},E=[],j=0;if(isNaN(o))throw new TypeError("Invalid number");if(a=!0===T.bits,g=!0===T.pad,r=T.base||10,h=void 0!==T.round?T.round:2,c=void 0!==T.locale?T.locale:"",d=T.localeOptions||{},y=void 0!==T.separator?T.separator:"",M=void 0!==T.spacer?T.spacer:" ",v=T.symbols||{},m=T.standard in i?T.standard:"iec",u=T.output||"string",s=!0===T.fullform,l=T.fullforms instanceof Array?T.fullforms:[],n=void 0!==T.exponent?T.exponent:-1,x=e[T.roundingMethod]||Math.round,f=(p=Number(o))<0,b=r>2?1e3:1024,N=!1===isNaN(T.precision)?parseInt(T.precision,10):0,f&&(p=-p),(-1===n||isNaN(n))&&(n=Math.floor(Math.log(p)/Math.log(b)))<0&&(n=0),n>8&&(N>0&&(N+=8-n),n=8),"exponent"===u)return n;if(0===p)E[0]=0,B=E[1]=i[m][a?"bits":"bytes"][n];else{j=p/(2===r?Math.pow(2,10*n):Math.pow(1e3,n)),a&&(j*=8)>=b&&n<8&&(j/=b,n++);var w=Math.pow(10,n>0?h:0);E[0]=x(j*w)/w,E[0]===b&&n<8&&void 0===T.exponent&&(E[0]=1,n++),B=E[1]=i[m][a?"bits":"bytes"][n]}if(f&&(E[0]=-E[0]),N>0&&(E[0]=E[0].toPrecision(N)),E[1]=v[E[1]]||E[1],!0===c?E[0]=E[0].toLocaleString():c.length>0?E[0]=E[0].toLocaleString(c,d):y.length>0&&(E[0]=E[0].toString().replace(".",y)),g&&!1===Number.isInteger(E[0])&&h>0){var P=y||".",G=E[0].toString().split(P),K=G[1]||"",S=K.length,Y=h-S;E[0]="".concat(G[0]).concat(P).concat(K.padEnd(S+Y,"0"))}return s&&(E[1]=l[n]?l[n]:t[m][n]+(a?"bit":"byte")+(1===E[0]?"":"s")),"array"===u?E:"object"===u?{value:E[0],symbol:E[1],exponent:n,unit:B}:E.join(M)}return o.partial=function(i){return function(t){return o(t,i)}},o})); | ||
//# sourceMappingURL=filesize.min.js.map |
{ | ||
"name": "filesize", | ||
"description": "JavaScript library to generate a human readable String describing the file size", | ||
"version": "8.0.7", | ||
"version": "9.0.0", | ||
"homepage": "https://filesizejs.com", | ||
@@ -36,11 +36,11 @@ "author": "Jason Mulligan <jason.mulligan@avoidwork.com>", | ||
"devDependencies": { | ||
"@babel/core": "^7.16.0", | ||
"@babel/preset-env": "^7.16.0", | ||
"auto-changelog": "^2.3.0", | ||
"eslint": "^8.1.0", | ||
"@babel/core": "^7.18.2", | ||
"@babel/preset-env": "^7.18.2", | ||
"auto-changelog": "^2.4.0", | ||
"eslint": "^8.16.0", | ||
"nodeunit-x": "^0.15.0", | ||
"rollup": "^2.58.3", | ||
"rollup": "^2.74.1", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"typescript": "^3.9.0" | ||
"typescript": "^4.7.2" | ||
}, | ||
@@ -47,0 +47,0 @@ "keywords": [ |
@@ -59,5 +59,2 @@ # filesize.js | ||
### unix | ||
_*(boolean)*_ Enables unix style human readable output, e.g `ls -lh`, default is `false` | ||
## Examples | ||
@@ -64,0 +61,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
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
57414
602
99