filesize
Advanced tools
Comparing version 6.2.4 to 6.2.5
@@ -7,4 +7,11 @@ ### Changelog | ||
#### [6.2.4](https://github.com//avoidwork/filesize.js.git/compare/6.2.4...6.2.4) | ||
#### [6.2.5](https://github.com//avoidwork/filesize.js.git/compare/6.2.5...6.2.5) | ||
#### [6.2.5](https://github.com//avoidwork/filesize.js.git/compare/6.2.4...6.2.5) | ||
> 15 April 2021 | ||
- Removing the multiple `return` statements from the end of `filesize()`, tweaking order of final changes [`1d19261`](https://github.com//avoidwork/filesize.js.git/commit/1d19261d2e89d97262efdc27ce3618b9ffa6197f) | ||
- Updating CHANGELOG.md [`ae2c8f9`](https://github.com//avoidwork/filesize.js.git/commit/ae2c8f9ffb90074ba4308662ba4786fe7d9062d5) | ||
#### [6.2.4](https://github.com//avoidwork/filesize.js.git/compare/6.2.3...6.2.4) | ||
@@ -11,0 +18,0 @@ |
@@ -6,3 +6,3 @@ /** | ||
* @license BSD-3-Clause | ||
* @version 6.2.4 | ||
* @version 6.2.5 | ||
*/ | ||
@@ -141,6 +141,2 @@ (function (global, factory) { | ||
if (full) { | ||
result[1] = fullforms[e] ? fullforms[e] : fullform[standard][e] + (bits ? "bit" : "byte") + (result[0] === 1 ? "" : "s"); | ||
} | ||
if (pad && Number.isInteger(result[0]) === false && round > 0) { | ||
@@ -156,12 +152,8 @@ const x = separator || ".", | ||
// Returning Array, Object, or String (default) | ||
if (output === "array") { | ||
return result; | ||
if (full) { | ||
result[1] = fullforms[e] ? fullforms[e] : fullform[standard][e] + (bits ? "bit" : "byte") + (result[0] === 1 ? "" : "s"); | ||
} | ||
if (output === "object") { | ||
return {value: result[0], symbol: result[1], exponent: e, unit: u}; | ||
} | ||
return result.join(spacer); | ||
// Returning Array, Object, or String (default) | ||
return output === "array" ? result : output === "object" ? {value: result[0], symbol: result[1], exponent: e, unit: u} : result.join(spacer); | ||
} | ||
@@ -168,0 +160,0 @@ |
/*! | ||
2020 Jason Mulligan <jason.mulligan@avoidwork.com> | ||
@version 6.2.4 | ||
@version 6.2.5 | ||
*/ | ||
!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)),l&&(N[1]=d[b]?d[b]:i[v][b]+(a?"bit":"byte")+(1===N[0]?"":"s")),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"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,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.4 | ||
* @version 6.2.5 | ||
*/ | ||
@@ -159,6 +159,2 @@ (function (global, factory) { | ||
if (full) { | ||
result[1] = fullforms[e] ? fullforms[e] : fullform[standard][e] + (bits ? "bit" : "byte") + (result[0] === 1 ? "" : "s"); | ||
} | ||
if (pad && Number.isInteger(result[0]) === false && round > 0) { | ||
@@ -171,19 +167,15 @@ var x = separator || ".", | ||
result[0] = "".concat(tmp[0]).concat(x).concat(s.padEnd(l + n, "0")); | ||
} | ||
if (full) { | ||
result[1] = fullforms[e] ? fullforms[e] : fullform[standard][e] + (bits ? "bit" : "byte") + (result[0] === 1 ? "" : "s"); | ||
} // Returning Array, Object, or String (default) | ||
if (output === "array") { | ||
return result; | ||
} | ||
if (output === "object") { | ||
return { | ||
value: result[0], | ||
symbol: result[1], | ||
exponent: e, | ||
unit: u | ||
}; | ||
} | ||
return result.join(spacer); | ||
return output === "array" ? result : output === "object" ? { | ||
value: result[0], | ||
symbol: result[1], | ||
exponent: e, | ||
unit: u | ||
} : result.join(spacer); | ||
} // Partial application for functional programming | ||
@@ -190,0 +182,0 @@ |
/*! | ||
2020 Jason Mulligan <jason.mulligan@avoidwork.com> | ||
@version 6.2.4 | ||
@version 6.2.5 | ||
*/ | ||
!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)),l&&(N[1]=s[n]?s[n]:i[x][n]+(a?"bit":"byte")+(1===N[0]?"":"s")),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"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,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.4", | ||
"version": "6.2.5", | ||
"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
77681
416