1 |
- function u(t,i){let r,e,n;try{r=t.toString().split(".")[1].length}catch{r=0}try{e=i.toString().split(".")[1].length}catch{e=0}return n=Math.pow(10,Math.max(r,e)),(t*n+i*n)/n}function s(t,i){let r=0,e=0,n,o;try{r=t.toString().split(".")[1].length}catch{}try{e=i.toString().split(".")[1].length}catch{}return n=Number(t.toString().replace(".","")),o=Number(i.toString().replace(".","")),h(n/o,Math.pow(10,e-r))}function h(t,i){let r=0,e=t.toString(),n=i.toString();try{r+=e.split(".")[1].length}catch{}try{r+=n.split(".")[1].length}catch{}return Number(e.replace(".",""))*Number(n.replace(".",""))/Math.pow(10,r)}function a(t,i){let r,e,n,o;try{r=t.toString().split(".")[1].length}catch{r=0}try{e=i.toString().split(".")[1].length}catch{e=0}return n=Math.pow(10,Math.max(r,e)),o=r>=e?r:e,((t*n-i*n)/n).toFixed(o)}function p(t,i=!0){return i?t==="NaN"||Number(t)===0?"0":t<1e3&&t>0||t<0&&t>-1e3?t:s(t,1e4).toFixed(2)+"W":t}function l(t){return t==="NaN"||Number(t)===0?"0W":s(t,1e4).toFixed(2)+"W"}function f(t=[]){const i=Object.keys(t[0]);return t.reduce((r,e)=>i.reduce((n,o)=>({...n,[o]:u(r[o]||0,e[o])}),{}),{})}function m(t){return t?Number(t).toFixed(2):0}export{u as a,l as b,f as c,s as d,m as f,h as m,a as s,p as u};
|