forked from Richienb/ros-data-waster
-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathfilesize.min.js
More file actions
6 lines (6 loc) · 2.01 KB
/
Copy pathfilesize.min.js
File metadata and controls
6 lines (6 loc) · 2.01 KB
1
2
3
4
5
6
/*
2019 Jason Mulligan <jason.mulligan@avoidwork.com>
@version 4.1.2
*/
"use strict";!function(e){var h=/^(b|B)$/,M={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"]}},x={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]};function t(e){var i,t,o,n,b,r,a,l,s,d,u,f,c,p,B=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},y=[],g=0,v=void 0,m=void 0;if(isNaN(e))throw new TypeError("Invalid number");return t=!0===B.bits,d=!0===B.unix,i=B.base||2,s=void 0!==B.round?B.round:d?1:2,r=void 0!==B.locale?B.locale:"",u=void 0!==B.separator?B.separator:"",f=void 0!==B.spacer?B.spacer:d?"":" ",p=B.symbols||{},c=2===i&&B.standard||"jedec",l=B.output||"string",n=!0===B.fullform,b=B.fullforms instanceof Array?B.fullforms:[],v=void 0!==B.exponent?B.exponent:-1,o=2<i?1e3:1024,(a=(m=Number(e))<0)&&(m=-m),(-1===v||isNaN(v))&&(v=Math.floor(Math.log(m)/Math.log(o)))<0&&(v=0),8<v&&(v=8),"exponent"===l?v:(0===m?(y[0]=0,y[1]=d?"":M[c][t?"bits":"bytes"][v]):(g=m/(2===i?Math.pow(2,10*v):Math.pow(1e3,v)),t&&o<=(g*=8)&&v<8&&(g/=o,v++),y[0]=Number(g.toFixed(0<v?s:0)),y[1]=10===i&&1===v?t?"kb":"kB":M[c][t?"bits":"bytes"][v],d&&(y[1]="jedec"===c?y[1].charAt(0):0<v?y[1].replace(/B$/,""):y[1],h.test(y[1])&&(y[0]=Math.floor(y[0]),y[1]=""))),a&&(y[0]=-y[0]),y[1]=p[y[1]]||y[1],!0===r?y[0]=y[0].toLocaleString():0<r.length?y[0]=y[0].toLocaleString(r):0<u.length&&(y[0]=y[0].toString().replace(".",u)),"array"===l?y:(n&&(y[1]=b[v]?b[v]:x[c][v]+(t?"bit":"byte")+(1===y[0]?"":"s")),"object"===l?{value:y[0],symbol:y[1]}:y.join(f)))}t.partial=function(i){return function(e){return t(e,i)}},"undefined"!=typeof exports?module.exports=t:"function"==typeof define&&void 0!==define.amd?define(function(){return t}):e.filesize=t}("undefined"!=typeof window?window:global);
//# sourceMappingURL=filesize.min.js.map