function toFixedFix (n,prec){ var k=Math.pow(10,prec); return''+(Math.round(n*k)/k).toFixed(prec); } export function formatNumber (number,decimals,dec_point,thousands_sep){ number=(number+'').replace(/[^0-9+\-Ee.]/g,''); const n=!isFinite(+number)?0:+number; const prec=!isFinite(+decimals)?0:Math.abs(decimals); const sep=(typeof thousands_sep==='undefined')?',':thousands_sep; const dec=(typeof dec_point==='undefined')?'.':dec_point; let s=''; s=(prec?toFixedFix(n,prec):''+Math.round(n)).split('.'); if(s[0].length>3){ s[0]=s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,sep); } if((s[1]||'').length