From 0e1516a721c1fec679fa20d1a884c89f499c59d0 Mon Sep 17 00:00:00 2001 From: Jason Mulligan Date: Mon, 8 Jul 2024 20:36:24 -0400 Subject: [PATCH] Fixing type def of 'partial()' --- dist/filesize.cjs | 2 +- dist/filesize.esm.js | 2 +- dist/filesize.esm.min.js | 2 +- dist/filesize.js | 2 +- dist/filesize.min.js | 2 +- package-lock.json | 4 ++-- package.json | 2 +- types/filesize.d.ts | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dist/filesize.cjs b/dist/filesize.cjs index 15febe4..bc59870 100644 --- a/dist/filesize.cjs +++ b/dist/filesize.cjs @@ -3,7 +3,7 @@ * * @copyright 2024 Jason Mulligan * @license BSD-3-Clause - * @version 10.1.3 + * @version 10.1.4 */ 'use strict'; diff --git a/dist/filesize.esm.js b/dist/filesize.esm.js index 222ec99..a3fdc3b 100644 --- a/dist/filesize.esm.js +++ b/dist/filesize.esm.js @@ -3,7 +3,7 @@ * * @copyright 2024 Jason Mulligan * @license BSD-3-Clause - * @version 10.1.3 + * @version 10.1.4 */ const ARRAY = "array"; const BIT = "bit"; diff --git a/dist/filesize.esm.min.js b/dist/filesize.esm.min.js index 2ae7c48..76b400c 100644 --- a/dist/filesize.esm.min.js +++ b/dist/filesize.esm.min.js @@ -1,5 +1,5 @@ /*! 2024 Jason Mulligan - @version 10.1.3 + @version 10.1.4 */ const t="array",i="bit",e="bits",o="byte",n="bytes",r="",b="exponent",s="function",a="iec",l="Invalid number",p="Invalid rounding method",u="jedec",c="object",d=".",f="round",m="s",g="si",B="kbit",y="kB",h=" ",M="string",x="0",w={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 E(E,{bits:N=!1,pad:T=!1,base:j=-1,round:P=2,locale:k=r,localeOptions:G={},separator:K=r,spacer:S=h,symbols:Y={},standard:Z=r,output:v=M,fullform:I=!1,fullforms:O=[],exponent:$=-1,roundingMethod:z=f,precision:L=0}={}){let q=$,A=Number(E),C=[],D=0,F=r;Z===g?(j=10,Z=u):Z===a||Z===u?j=2:2===j?Z=a:(j=10,Z=u);const H=10===j?1e3:1024,J=!0===I,Q=A<0,R=Math[z];if("bigint"!=typeof E&&isNaN(E))throw new TypeError(l);if(typeof R!==s)throw new TypeError(p);if(Q&&(A=-A),(-1===q||isNaN(q))&&(q=Math.floor(Math.log(A)/Math.log(H)),q<0&&(q=0)),q>8&&(L>0&&(L+=8-q),q=8),v===b)return q;if(0===A)C[0]=0,F=C[1]=w.symbol[Z][N?e:n][q];else{D=A/(2===j?Math.pow(2,10*q):Math.pow(1e3,q)),N&&(D*=8,D>=H&&q<8&&(D/=H,q++));const t=Math.pow(10,q>0?P:0);C[0]=R(D*t)/t,C[0]===H&&q<8&&-1===$&&(C[0]=1,q++),F=C[1]=10===j&&1===q?N?B:y:w.symbol[Z][N?e:n][q]}if(Q&&(C[0]=-C[0]),L>0&&(C[0]=C[0].toPrecision(L)),C[1]=Y[C[1]]||C[1],!0===k?C[0]=C[0].toLocaleString():k.length>0?C[0]=C[0].toLocaleString(k,G):K.length>0&&(C[0]=C[0].toString().replace(d,K)),T&&!1===Number.isInteger(C[0])&&P>0){const t=K||d,i=C[0].toString().split(t),e=i[1]||r,o=e.length,n=P-o;C[0]=`${i[0]}${t}${e.padEnd(o+n,x)}`}return J&&(C[1]=O[q]?O[q]:w.fullform[Z][q]+(N?i:o)+(1===C[0]?r:m)),v===t?C:v===c?{value:C[0],symbol:C[1],exponent:q,unit:F}:C.join(S)}function N({bits:t=!1,pad:i=!1,base:e=-1,round:o=2,locale:n=r,localeOptions:b={},separator:s=r,spacer:a=h,symbols:l={},standard:p=r,output:u=M,fullform:c=!1,fullforms:d=[],exponent:m=-1,roundingMethod:g=f,precision:B=0}={}){return r=>E(r,{bits:t,pad:i,base:e,round:o,locale:n,localeOptions:b,separator:s,spacer:a,symbols:l,standard:p,output:u,fullform:c,fullforms:d,exponent:m,roundingMethod:g,precision:B})}export{E as filesize,N as partial};//# sourceMappingURL=filesize.esm.min.js.map diff --git a/dist/filesize.js b/dist/filesize.js index 998f7b2..238e5f9 100644 --- a/dist/filesize.js +++ b/dist/filesize.js @@ -3,7 +3,7 @@ * * @copyright 2024 Jason Mulligan * @license BSD-3-Clause - * @version 10.1.3 + * @version 10.1.4 */ (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"; const BIT = "bit"; diff --git a/dist/filesize.min.js b/dist/filesize.min.js index 9b702e9..ea979a5 100644 --- a/dist/filesize.min.js +++ b/dist/filesize.min.js @@ -1,5 +1,5 @@ /*! 2024 Jason Mulligan - @version 10.1.3 + @version 10.1.4 */ !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=".",m="round",g="s",y="si",h="kbit",B="kB",M=" ",x="string",T="0",w={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 E(t,{bits:E=!1,pad:j=!1,base:N=-1,round:P=2,locale:k=s,localeOptions:z={},separator:G=s,spacer:K=M,symbols:S={},standard:Y=s,output:Z=x,fullform:v=!1,fullforms:I=[],exponent:O=-1,roundingMethod:$=m,precision:L=0}={}){let q=O,A=Number(t),C=[],D=0,F=s;Y===y?(N=10,Y=u):Y===b||Y===u?N=2:2===N?Y=b:(N=10,Y=u);const H=10===N?1e3:1024,J=!0===v,Q=A<0,R=Math[$];if("bigint"!=typeof t&&isNaN(t))throw new TypeError(p);if(typeof R!==a)throw new TypeError(f);if(Q&&(A=-A),(-1===q||isNaN(q))&&(q=Math.floor(Math.log(A)/Math.log(H)),q<0&&(q=0)),q>8&&(L>0&&(L+=8-q),q=8),Z===l)return q;if(0===A)C[0]=0,F=C[1]=w.symbol[Y][E?o:r][q];else{D=A/(2===N?Math.pow(2,10*q):Math.pow(1e3,q)),E&&(D*=8,D>=H&&q<8&&(D/=H,q++));const t=Math.pow(10,q>0?P:0);C[0]=R(D*t)/t,C[0]===H&&q<8&&-1===O&&(C[0]=1,q++),F=C[1]=10===N&&1===q?E?h:B:w.symbol[Y][E?o:r][q]}if(Q&&(C[0]=-C[0]),L>0&&(C[0]=C[0].toPrecision(L)),C[1]=S[C[1]]||C[1],!0===k?C[0]=C[0].toLocaleString():k.length>0?C[0]=C[0].toLocaleString(k,z):G.length>0&&(C[0]=C[0].toString().replace(c,G)),j&&!1===Number.isInteger(C[0])&&P>0){const t=G||c,i=C[0].toString().split(t),e=i[1]||s,o=e.length,n=P-o;C[0]=`${i[0]}${t}${e.padEnd(o+n,T)}`}return J&&(C[1]=I[q]?I[q]:w.fullform[Y][q]+(E?e:n)+(1===C[0]?s:g)),Z===i?C:Z===d?{value:C[0],symbol:C[1],exponent:q,unit:F}:C.join(K)}t.filesize=E,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=M,symbols:b={},standard:p=s,output:f=x,fullform:u=!1,fullforms:d=[],exponent:c=-1,roundingMethod:g=m,precision:y=0}={}){return s=>E(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:g,precision:y})}}));//# sourceMappingURL=filesize.min.js.map diff --git a/package-lock.json b/package-lock.json index 6917a50..05fed15 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "filesize", - "version": "10.1.3", + "version": "10.1.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "filesize", - "version": "10.1.3", + "version": "10.1.4", "license": "BSD-3-Clause", "devDependencies": { "@rollup/plugin-terser": "^0.4.4", diff --git a/package.json b/package.json index d2c5b0c..7b75ff2 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": "10.1.3", + "version": "10.1.4", "homepage": "https://filesizejs.com", "author": "Jason Mulligan ", "repository": { diff --git a/types/filesize.d.ts b/types/filesize.d.ts index 88d0fbd..91251a1 100644 --- a/types/filesize.d.ts +++ b/types/filesize.d.ts @@ -53,4 +53,4 @@ type FileSizeReturnType = : string; export function filesize(byteCount: number | string | bigint, options?: Options): FileSizeReturnType -export function partial(options?: Options): (byteCount: number) => FileSizeReturnType +export function partial(options?: Options): (byteCount: number | string | bigint) => FileSizeReturnType