From 7b75caeb951b82cbbd1d93108a61a0b478fe53b2 Mon Sep 17 00:00:00 2001 From: Jason Mulligan Date: Mon, 27 Jun 2022 19:39:04 -0400 Subject: [PATCH] Adding invaid `base 10 iec` test set, building, version bump to release --- lib/filesize.es6.js | 2 +- lib/filesize.es6.min.js | 2 +- lib/filesize.esm.js | 2 +- lib/filesize.esm.min.js | 2 +- lib/filesize.js | 2 +- lib/filesize.min.js | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/filesize.es6.js b/lib/filesize.es6.js index cbb401c..5cb0f3c 100644 --- a/lib/filesize.es6.js +++ b/lib/filesize.es6.js @@ -3,7 +3,7 @@ * * @copyright 2022 Jason Mulligan * @license BSD-3-Clause - * @version 9.0.10 + * @version 9.0.11 */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : diff --git a/lib/filesize.es6.min.js b/lib/filesize.es6.min.js index a3c0c5d..6ca4684 100644 --- a/lib/filesize.es6.min.js +++ b/lib/filesize.es6.min.js @@ -1,6 +1,6 @@ /*! 2022 Jason Mulligan - @version 9.0.10 + @version 9.0.11 */ !function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).filesize=i()}(this,(function(){"use strict";const t="bits",i="bytes",e="",o="iec",n="jedec",b={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 r(r,{bits:l=!1,pad:s=!1,base:a=-1,round:f=2,locale:u="",localeOptions:p={},separator:c="",spacer:d=" ",symbols:g={},standard:h="",output:y="string",fullform:B=!1,fullforms:m=[],exponent:M=-1,roundingMethod:T="round",precision:w=0}={}){let x=M,E=Number(r),j=[],N=0,P=e;-1===a&&0===h.length?(a=10,h=n):-1===a&&h.length>0?a=(h=h===o?o:n)===o?2:10:h=10===(a=2===a?2:10)||h===n?n:o;const k=10===a?1e3:1024,G=!0===B,K=E<0,S=Math[T];if(isNaN(r))throw new TypeError("Invalid number");if("function"!=typeof S)throw new TypeError("Invalid rounding method");if(K&&(E=-E),(-1===x||isNaN(x))&&(x=Math.floor(Math.log(E)/Math.log(k)),x<0&&(x=0)),x>8&&(w>0&&(w+=8-x),x=8),"exponent"===y)return x;if(0===E)j[0]=0,P=j[1]=b.symbol[h][l?t:i][x];else{N=E/(2===a?Math.pow(2,10*x):Math.pow(1e3,x)),l&&(N*=8,N>=k&&x<8&&(N/=k,x++));const e=Math.pow(10,x>0?f:0);j[0]=S(N*e)/e,j[0]===k&&x<8&&-1===M&&(j[0]=1,x++),P=j[1]=10===a&&1===x?l?"kbit":"kB":b.symbol[h][l?t:i][x]}if(K&&(j[0]=-j[0]),w>0&&(j[0]=j[0].toPrecision(w)),j[1]=g[j[1]]||j[1],!0===u?j[0]=j[0].toLocaleString():u.length>0?j[0]=j[0].toLocaleString(u,p):c.length>0&&(j[0]=j[0].toString().replace(".",c)),s&&!1===Number.isInteger(j[0])&&f>0){const t=c||".",i=j[0].toString().split(t),o=i[1]||e,n=o.length,b=f-n;j[0]=`${i[0]}${t}${o.padEnd(n+b,"0")}`}return G&&(j[1]=m[x]?m[x]:b.fullform[h][x]+(l?"bit":"byte")+(1===j[0]?e:"s")),"array"===y?j:"object"===y?{value:j[0],symbol:j[1],exponent:x,unit:P}:j.join(d)}return r.partial=t=>i=>r(i,t),r})); //# sourceMappingURL=filesize.es6.min.js.map diff --git a/lib/filesize.esm.js b/lib/filesize.esm.js index a80e492..d16e6c4 100644 --- a/lib/filesize.esm.js +++ b/lib/filesize.esm.js @@ -3,7 +3,7 @@ * * @copyright 2022 Jason Mulligan * @license BSD-3-Clause - * @version 9.0.10 + * @version 9.0.11 */ const ARRAY = "array"; const BIT = "bit"; diff --git a/lib/filesize.esm.min.js b/lib/filesize.esm.min.js index 4172a0e..114105c 100644 --- a/lib/filesize.esm.min.js +++ b/lib/filesize.esm.min.js @@ -1,6 +1,6 @@ /*! 2022 Jason Mulligan - @version 9.0.10 + @version 9.0.11 */ 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:b=-1,round:n=2,locale:r="",localeOptions:a={},separator:l="",spacer:s=" ",symbols:c={},standard:p="",output:d="string",fullform:u=!1,fullforms:g=[],exponent:B=-1,roundingMethod:f="round",precision:h=0}={}){let y=B,m=Number(i),M=[],j=0,w="";-1===b&&0===p.length?(b=10,p="jedec"):-1===b&&p.length>0?b="iec"===(p="iec"===p?"iec":"jedec")?2:10:p=10===(b=2===b?2:10)||"jedec"===p?"jedec":"iec";const E=10===b?1e3:1024,x=!0===u,N=m<0,T=Math[f];if(isNaN(i))throw new TypeError("Invalid number");if("function"!=typeof T)throw new TypeError("Invalid rounding method");if(N&&(m=-m),(-1===y||isNaN(y))&&(y=Math.floor(Math.log(m)/Math.log(E)),y<0&&(y=0)),y>8&&(h>0&&(h+=8-y),y=8),"exponent"===d)return y;if(0===m)M[0]=0,w=M[1]=t.symbol[p][e?"bits":"bytes"][y];else{j=m/(2===b?Math.pow(2,10*y):Math.pow(1e3,y)),e&&(j*=8,j>=E&&y<8&&(j/=E,y++));const i=Math.pow(10,y>0?n:0);M[0]=T(j*i)/i,M[0]===E&&y<8&&-1===B&&(M[0]=1,y++),w=M[1]=10===b&&1===y?e?"kbit":"kB":t.symbol[p][e?"bits":"bytes"][y]}if(N&&(M[0]=-M[0]),h>0&&(M[0]=M[0].toPrecision(h)),M[1]=c[M[1]]||M[1],!0===r?M[0]=M[0].toLocaleString():r.length>0?M[0]=M[0].toLocaleString(r,a):l.length>0&&(M[0]=M[0].toString().replace(".",l)),o&&!1===Number.isInteger(M[0])&&n>0){const t=l||".",i=M[0].toString().split(t),e=i[1]||"",o=e.length,b=n-o;M[0]=`${i[0]}${t}${e.padEnd(o+b,"0")}`}return x&&(M[1]=g[y]?g[y]:t.fullform[p][y]+(e?"bit":"byte")+(1===M[0]?"":"s")),"array"===d?M:"object"===d?{value:M[0],symbol:M[1],exponent:y,unit:w}:M.join(s)}i.partial=t=>e=>i(e,t);export{i as default}; //# sourceMappingURL=filesize.esm.min.js.map diff --git a/lib/filesize.js b/lib/filesize.js index b871944..5bb3fe2 100644 --- a/lib/filesize.js +++ b/lib/filesize.js @@ -3,7 +3,7 @@ * * @copyright 2022 Jason Mulligan * @license BSD-3-Clause - * @version 9.0.10 + * @version 9.0.11 */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : diff --git a/lib/filesize.min.js b/lib/filesize.min.js index 7e8695e..3d470e5 100644 --- a/lib/filesize.min.js +++ b/lib/filesize.min.js @@ -1,6 +1,6 @@ /*! 2022 Jason Mulligan - @version 9.0.10 + @version 9.0.11 */ !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";function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(i){return typeof i}:function(i){return i&&"function"==typeof Symbol&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},i(t)}var t="array",o="bits",e="byte",n="bytes",r="",b="exponent",l="function",a="iec",d="Invalid number",f="Invalid rounding method",u="jedec",s="object",c=".",p="round",y="kbit",m="string",v={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 g(g){var h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},B=h.bits,M=void 0!==B&&B,S=h.pad,T=void 0!==S&&S,w=h.base,x=void 0===w?-1:w,E=h.round,j=void 0===E?2:E,N=h.locale,P=void 0===N?r:N,k=h.localeOptions,G=void 0===k?{}:k,K=h.separator,Y=void 0===K?r:K,Z=h.spacer,z=void 0===Z?" ":Z,I=h.symbols,L=void 0===I?{}:I,O=h.standard,q=void 0===O?r:O,A=h.output,C=void 0===A?m:A,D=h.fullform,F=void 0!==D&&D,H=h.fullforms,J=void 0===H?[]:H,Q=h.exponent,R=void 0===Q?-1:Q,U=h.roundingMethod,V=void 0===U?p:U,W=h.precision,X=void 0===W?0:W,$=R,_=Number(g),ii=[],ti=0,oi=r;-1===x&&0===q.length?(x=10,q=u):-1===x&&q.length>0?x=(q=q===a?a:u)===a?2:10:q=10===(x=2===x?2:10)||q===u?u:a;var ei=10===x?1e3:1024,ni=!0===F,ri=_<0,bi=Math[V];if(isNaN(g))throw new TypeError(d);if(i(bi)!==l)throw new TypeError(f);if(ri&&(_=-_),(-1===$||isNaN($))&&($=Math.floor(Math.log(_)/Math.log(ei)))<0&&($=0),$>8&&(X>0&&(X+=8-$),$=8),C===b)return $;if(0===_)ii[0]=0,oi=ii[1]=v.symbol[q][M?o:n][$];else{ti=_/(2===x?Math.pow(2,10*$):Math.pow(1e3,$)),M&&(ti*=8)>=ei&&$<8&&(ti/=ei,$++);var li=Math.pow(10,$>0?j:0);ii[0]=bi(ti*li)/li,ii[0]===ei&&$<8&&-1===R&&(ii[0]=1,$++),oi=ii[1]=10===x&&1===$?M?y:"kB":v.symbol[q][M?o:n][$]}if(ri&&(ii[0]=-ii[0]),X>0&&(ii[0]=ii[0].toPrecision(X)),ii[1]=L[ii[1]]||ii[1],!0===P?ii[0]=ii[0].toLocaleString():P.length>0?ii[0]=ii[0].toLocaleString(P,G):Y.length>0&&(ii[0]=ii[0].toString().replace(c,Y)),T&&!1===Number.isInteger(ii[0])&&j>0){var ai=Y||c,di=ii[0].toString().split(ai),fi=di[1]||r,ui=fi.length,si=j-ui;ii[0]="".concat(di[0]).concat(ai).concat(fi.padEnd(ui+si,"0"))}return ni&&(ii[1]=J[$]?J[$]:v.fullform[q][$]+(M?"bit":e)+(1===ii[0]?r:"s")),C===t?ii:C===s?{value:ii[0],symbol:ii[1],exponent:$,unit:oi}:ii.join(z)}return g.partial=function(i){return function(t){return g(t,i)}},g})); //# sourceMappingURL=filesize.min.js.map diff --git a/package-lock.json b/package-lock.json index 2715887..e922b42 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "filesize", - "version": "9.0.10", + "version": "9.0.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "filesize", - "version": "9.0.10", + "version": "9.0.11", "license": "BSD-3-Clause", "devDependencies": { "@babel/core": "^7.18.5", diff --git a/package.json b/package.json index 87e2e1b..02c42ed 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "filesize", "description": "JavaScript library to generate a human readable String describing the file size", - "version": "9.0.10", + "version": "9.0.11", "homepage": "https://filesizejs.com", "author": "Jason Mulligan ", "repository": {