@acrool/js-utils
Advanced tools
@@ -1,1 +0,1 @@ | ||
| "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var k=20,_=1,D=1e6,F=1e6,d=-7,L=21,C=!1,P="[big.js] ",p=P+"Invalid ",N=p+"decimal places",T=p+"rounding mode",j=P+"Division by zero",l={},v=void 0,U=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function S(){function e(r){var t=this;if(!(t instanceof e))return r===v&&arguments.length===0?S():new e(r);if(r instanceof e)t.s=r.s,t.e=r.e,t.c=r.c.slice();else{if(typeof r!="string"){if(e.strict===!0&&typeof r!="bigint")throw TypeError(p+"value");r=r===0&&1/r<0?"-0":String(r)}V(t,r)}t.constructor=e}return e.prototype=l,e.DP=k,e.RM=_,e.NE=d,e.PE=L,e.strict=C,e.roundDown=0,e.roundHalfUp=1,e.roundHalfEven=2,e.roundUp=3,e}function V(e,r){var t,i,n;if(!U.test(r))throw Error(p+"number");for(e.s=r.charAt(0)=="-"?(r=r.slice(1),-1):1,(t=r.indexOf("."))>-1&&(r=r.replace(".","")),(i=r.search(/e/i))>0?(t<0&&(t=i),t+=+r.slice(i+1),r=r.substring(0,i)):t<0&&(t=r.length),n=r.length,i=0;i<n&&r.charAt(i)=="0";)++i;if(i==n)e.c=[e.e=0];else{for(;n>0&&r.charAt(--n)=="0";);for(e.e=t-i-1,e.c=[],t=0;i<=n;)e.c[t++]=+r.charAt(i++)}return e}function b(e,r,t,i){var n=e.c;if(t===v&&(t=e.constructor.RM),t!==0&&t!==1&&t!==2&&t!==3)throw Error(T);if(r<1)i=t===3&&(i||!!n[0])||r===0&&(t===1&&n[0]>=5||t===2&&(n[0]>5||n[0]===5&&(i||n[1]!==v))),n.length=1,i?(e.e=e.e-r+1,n[0]=1):n[0]=e.e=0;else if(r<n.length){if(i=t===1&&n[r]>=5||t===2&&(n[r]>5||n[r]===5&&(i||n[r+1]!==v||n[r-1]&1))||t===3&&(i||!!n[0]),n.length=r,i){for(;++n[--r]>9;)if(n[r]=0,r===0){++e.e,n.unshift(1);break}}for(r=n.length;!n[--r];)n.pop()}return e}function x(e,r,t){var i=e.e,n=e.c.join(""),c=n.length;if(r)n=n.charAt(0)+(c>1?"."+n.slice(1):"")+(i<0?"e":"e+")+i;else if(i<0){for(;++i;)n="0"+n;n="0."+n}else if(i>0)if(++i>c)for(i-=c;i--;)n+="0";else i<c&&(n=n.slice(0,i)+"."+n.slice(i));else c>1&&(n=n.charAt(0)+"."+n.slice(1));return e.s<0&&t?"-"+n:n}l.abs=function(){var e=new this.constructor(this);return e.s=1,e};l.cmp=function(e){var r,t=this,i=t.c,n=(e=new t.constructor(e)).c,c=t.s,u=e.s,o=t.e,s=e.e;if(!i[0]||!n[0])return i[0]?c:n[0]?-u:0;if(c!=u)return c;if(r=c<0,o!=s)return o>s^r?1:-1;for(u=(o=i.length)<(s=n.length)?o:s,c=-1;++c<u;)if(i[c]!=n[c])return i[c]>n[c]^r?1:-1;return o==s?0:o>s^r?1:-1};l.div=function(e){var r=this,t=r.constructor,i=r.c,n=(e=new t(e)).c,c=r.s==e.s?1:-1,u=t.DP;if(u!==~~u||u<0||u>D)throw Error(N);if(!n[0])throw Error(j);if(!i[0])return e.s=c,e.c=[e.e=0],e;var o,s,f,w,h,E=n.slice(),B=o=n.length,O=i.length,a=i.slice(0,o),g=a.length,m=e,A=m.c=[],R=0,M=u+(m.e=r.e-e.e)+1;for(m.s=c,c=M<0?0:M,E.unshift(0);g++<o;)a.push(0);do{for(f=0;f<10;f++){if(o!=(g=a.length))w=o>g?1:-1;else for(h=-1,w=0;++h<o;)if(n[h]!=a[h]){w=n[h]>a[h]?1:-1;break}if(w<0){for(s=g==o?n:E;g;){if(a[--g]<s[g]){for(h=g;h&&!a[--h];)a[h]=9;--a[h],a[g]+=10}a[g]-=s[g]}for(;!a[0];)a.shift()}else break}A[R++]=w?f:++f,a[0]&&w?a[g]=i[B]||0:a=[i[B]]}while((B++<O||a[0]!==v)&&c--);return!A[0]&&R!=1&&(A.shift(),m.e--,M--),R>M&&b(m,M,t.RM,a[0]!==v),m};l.eq=function(e){return this.cmp(e)===0};l.gt=function(e){return this.cmp(e)>0};l.gte=function(e){return this.cmp(e)>-1};l.lt=function(e){return this.cmp(e)<0};l.lte=function(e){return this.cmp(e)<1};l.minus=l.sub=function(e){var r,t,i,n,c=this,u=c.constructor,o=c.s,s=(e=new u(e)).s;if(o!=s)return e.s=-s,c.plus(e);var f=c.c.slice(),w=c.e,h=e.c,E=e.e;if(!f[0]||!h[0])return h[0]?e.s=-s:f[0]?e=new u(c):e.s=1,e;if(o=w-E){for((n=o<0)?(o=-o,i=f):(E=w,i=h),i.reverse(),s=o;s--;)i.push(0);i.reverse()}else for(t=((n=f.length<h.length)?f:h).length,o=s=0;s<t;s++)if(f[s]!=h[s]){n=f[s]<h[s];break}if(n&&(i=f,f=h,h=i,e.s=-e.s),(s=(t=h.length)-(r=f.length))>0)for(;s--;)f[r++]=0;for(s=r;t>o;){if(f[--t]<h[t]){for(r=t;r&&!f[--r];)f[r]=9;--f[r],f[t]+=10}f[t]-=h[t]}for(;f[--s]===0;)f.pop();for(;f[0]===0;)f.shift(),--E;return f[0]||(e.s=1,f=[E=0]),e.c=f,e.e=E,e};l.mod=function(e){var r,t=this,i=t.constructor,n=t.s,c=(e=new i(e)).s;if(!e.c[0])throw Error(j);return t.s=e.s=1,r=e.cmp(t)==1,t.s=n,e.s=c,r?new i(t):(n=i.DP,c=i.RM,i.DP=i.RM=0,t=t.div(e),i.DP=n,i.RM=c,this.minus(t.times(e)))};l.neg=function(){var e=new this.constructor(this);return e.s=-e.s,e};l.plus=l.add=function(e){var r,t,i,n=this,c=n.constructor;if(e=new c(e),n.s!=e.s)return e.s=-e.s,n.minus(e);var u=n.e,o=n.c,s=e.e,f=e.c;if(!o[0]||!f[0])return f[0]||(o[0]?e=new c(n):e.s=n.s),e;if(o=o.slice(),r=u-s){for(r>0?(s=u,i=f):(r=-r,i=o),i.reverse();r--;)i.push(0);i.reverse()}for(o.length-f.length<0&&(i=f,f=o,o=i),r=f.length,t=0;r;o[r]%=10)t=(o[--r]=o[r]+f[r]+t)/10|0;for(t&&(o.unshift(t),++s),r=o.length;o[--r]===0;)o.pop();return e.c=o,e.e=s,e};l.pow=function(e){var r=this,t=new r.constructor("1"),i=t,n=e<0;if(e!==~~e||e<-1e6||e>F)throw Error(p+"exponent");for(n&&(e=-e);e&1&&(i=i.times(r)),e>>=1,!!e;)r=r.times(r);return n?t.div(i):i};l.prec=function(e,r){if(e!==~~e||e<1||e>D)throw Error(p+"precision");return b(new this.constructor(this),e,r)};l.round=function(e,r){if(e===v)e=0;else if(e!==~~e||e<-1e6||e>D)throw Error(N);return b(new this.constructor(this),e+this.e+1,r)};l.sqrt=function(){var e,r,t,i=this,n=i.constructor,c=i.s,u=i.e,o=new n("0.5");if(!i.c[0])return new n(i);if(c<0)throw Error(P+"No square root");c=Math.sqrt(+x(i,!0,!0)),c===0||c===1/0?(r=i.c.join(""),r.length+u&1||(r+="0"),c=Math.sqrt(r),u=((u+1)/2|0)-(u<0||u&1),e=new n((c==1/0?"5e":(c=c.toExponential()).slice(0,c.indexOf("e")+1))+u)):e=new n(c+""),u=e.e+(n.DP+=4);do t=e,e=o.times(t.plus(i.div(t)));while(t.c.slice(0,u).join("")!==e.c.slice(0,u).join(""));return b(e,(n.DP-=4)+e.e+1,n.RM)};l.times=l.mul=function(e){var r,t=this,i=t.constructor,n=t.c,c=(e=new i(e)).c,u=n.length,o=c.length,s=t.e,f=e.e;if(e.s=t.s==e.s?1:-1,!n[0]||!c[0])return e.c=[e.e=0],e;for(e.e=s+f,u<o&&(r=n,n=c,c=r,f=u,u=o,o=f),r=new Array(f=u+o);f--;)r[f]=0;for(s=o;s--;){for(o=0,f=u+s;f>s;)o=r[f]+c[s]*n[f-s-1]+o,r[f--]=o%10,o=o/10|0;r[f]=o}for(o?++e.e:r.shift(),s=r.length;!r[--s];)r.pop();return e.c=r,e};l.toExponential=function(e,r){var t=this,i=t.c[0];if(e!==v){if(e!==~~e||e<0||e>D)throw Error(N);for(t=b(new t.constructor(t),++e,r);t.c.length<e;)t.c.push(0)}return x(t,!0,!!i)};l.toFixed=function(e,r){var t=this,i=t.c[0];if(e!==v){if(e!==~~e||e<0||e>D)throw Error(N);for(t=b(new t.constructor(t),e+t.e+1,r),e=e+t.e+1;t.c.length<e;)t.c.push(0)}return x(t,!1,!!i)};l.toJSON=l.toString=function(){var e=this,r=e.constructor;return x(e,e.e<=r.NE||e.e>=r.PE,!!e.c[0])};typeof Symbol<"u"&&(l[Symbol.for("nodejs.util.inspect.custom")]=l.toJSON);l.toNumber=function(){var e=+x(this,!0,!0);if(this.constructor.strict===!0&&!this.eq(e.toString()))throw Error(P+"Imprecise conversion");return e};l.toPrecision=function(e,r){var t=this,i=t.constructor,n=t.c[0];if(e!==v){if(e!==~~e||e<1||e>D)throw Error(p+"precision");for(t=b(new i(t),e,r);t.c.length<e;)t.c.push(0)}return x(t,e<=t.e||t.e<=i.NE||t.e>=i.PE,!!n)};l.valueOf=function(){var e=this,r=e.constructor;if(r.strict===!0)throw Error(P+"valueOf disallowed");return x(e,e.e<=r.NE||e.e>=r.PE,!0)};var I=S();function q(e=0,r=0){try{return new I(e).round(r,0).toFixed(r)}catch{return new I(0).toFixed(r)}}function Z(e=0,r=0){const i=q(e,r).toString().split(".");return i[0]=i[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),i.join(".")}function $(e){let r,t;return e.forEach(i=>{r=r?i[0]>r?i[0]:r:i[0],t=t?i[1]<t?i[1]:t:i[1]}),{min:r??0,max:t??0}}function z(e){return/^0\.\d+$/.test(e)?e.replace(/^0/,""):/^\d*\.?\d+$/.test(e)?e.replace(/^0+(?=\d)/,""):e}exports.formatCurrency=Z;exports.intersectionMin=$;exports.removeLeadingZero=z;exports.safeFormatDecimal=q; | ||
| "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var k=20,_=1,N=1e6,F=1e6,d=-7,L=21,C=!1,M="[big.js] ",p=M+"Invalid ",P=p+"decimal places",T=p+"rounding mode",j=M+"Division by zero",h={},w=void 0,U=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function S(){function e(r){var t=this;if(!(t instanceof e))return r===w&&arguments.length===0?S():new e(r);if(r instanceof e)t.s=r.s,t.e=r.e,t.c=r.c.slice();else{if(typeof r!="string"){if(e.strict===!0&&typeof r!="bigint")throw TypeError(p+"value");r=r===0&&1/r<0?"-0":String(r)}V(t,r)}t.constructor=e}return e.prototype=h,e.DP=k,e.RM=_,e.NE=d,e.PE=L,e.strict=C,e.roundDown=0,e.roundHalfUp=1,e.roundHalfEven=2,e.roundUp=3,e}function V(e,r){var t,i,n;if(!U.test(r))throw Error(p+"number");for(e.s=r.charAt(0)=="-"?(r=r.slice(1),-1):1,(t=r.indexOf("."))>-1&&(r=r.replace(".","")),(i=r.search(/e/i))>0?(t<0&&(t=i),t+=+r.slice(i+1),r=r.substring(0,i)):t<0&&(t=r.length),n=r.length,i=0;i<n&&r.charAt(i)=="0";)++i;if(i==n)e.c=[e.e=0];else{for(;n>0&&r.charAt(--n)=="0";);for(e.e=t-i-1,e.c=[],t=0;i<=n;)e.c[t++]=+r.charAt(i++)}return e}function b(e,r,t,i){var n=e.c;if(t===w&&(t=e.constructor.RM),t!==0&&t!==1&&t!==2&&t!==3)throw Error(T);if(r<1)i=t===3&&(i||!!n[0])||r===0&&(t===1&&n[0]>=5||t===2&&(n[0]>5||n[0]===5&&(i||n[1]!==w))),n.length=1,i?(e.e=e.e-r+1,n[0]=1):n[0]=e.e=0;else if(r<n.length){if(i=t===1&&n[r]>=5||t===2&&(n[r]>5||n[r]===5&&(i||n[r+1]!==w||n[r-1]&1))||t===3&&(i||!!n[0]),n.length=r,i){for(;++n[--r]>9;)if(n[r]=0,r===0){++e.e,n.unshift(1);break}}for(r=n.length;!n[--r];)n.pop()}return e}function m(e,r,t){var i=e.e,n=e.c.join(""),c=n.length;if(r)n=n.charAt(0)+(c>1?"."+n.slice(1):"")+(i<0?"e":"e+")+i;else if(i<0){for(;++i;)n="0"+n;n="0."+n}else if(i>0)if(++i>c)for(i-=c;i--;)n+="0";else i<c&&(n=n.slice(0,i)+"."+n.slice(i));else c>1&&(n=n.charAt(0)+"."+n.slice(1));return e.s<0&&t?"-"+n:n}h.abs=function(){var e=new this.constructor(this);return e.s=1,e};h.cmp=function(e){var r,t=this,i=t.c,n=(e=new t.constructor(e)).c,c=t.s,u=e.s,o=t.e,s=e.e;if(!i[0]||!n[0])return i[0]?c:n[0]?-u:0;if(c!=u)return c;if(r=c<0,o!=s)return o>s^r?1:-1;for(u=(o=i.length)<(s=n.length)?o:s,c=-1;++c<u;)if(i[c]!=n[c])return i[c]>n[c]^r?1:-1;return o==s?0:o>s^r?1:-1};h.div=function(e){var r=this,t=r.constructor,i=r.c,n=(e=new t(e)).c,c=r.s==e.s?1:-1,u=t.DP;if(u!==~~u||u<0||u>N)throw Error(P);if(!n[0])throw Error(j);if(!i[0])return e.s=c,e.c=[e.e=0],e;var o,s,f,v,l,E=n.slice(),B=o=n.length,O=i.length,a=i.slice(0,o),g=a.length,x=e,I=x.c=[],A=0,D=u+(x.e=r.e-e.e)+1;for(x.s=c,c=D<0?0:D,E.unshift(0);g++<o;)a.push(0);do{for(f=0;f<10;f++){if(o!=(g=a.length))v=o>g?1:-1;else for(l=-1,v=0;++l<o;)if(n[l]!=a[l]){v=n[l]>a[l]?1:-1;break}if(v<0){for(s=g==o?n:E;g;){if(a[--g]<s[g]){for(l=g;l&&!a[--l];)a[l]=9;--a[l],a[g]+=10}a[g]-=s[g]}for(;!a[0];)a.shift()}else break}I[A++]=v?f:++f,a[0]&&v?a[g]=i[B]||0:a=[i[B]]}while((B++<O||a[0]!==w)&&c--);return!I[0]&&A!=1&&(I.shift(),x.e--,D--),A>D&&b(x,D,t.RM,a[0]!==w),x};h.eq=function(e){return this.cmp(e)===0};h.gt=function(e){return this.cmp(e)>0};h.gte=function(e){return this.cmp(e)>-1};h.lt=function(e){return this.cmp(e)<0};h.lte=function(e){return this.cmp(e)<1};h.minus=h.sub=function(e){var r,t,i,n,c=this,u=c.constructor,o=c.s,s=(e=new u(e)).s;if(o!=s)return e.s=-s,c.plus(e);var f=c.c.slice(),v=c.e,l=e.c,E=e.e;if(!f[0]||!l[0])return l[0]?e.s=-s:f[0]?e=new u(c):e.s=1,e;if(o=v-E){for((n=o<0)?(o=-o,i=f):(E=v,i=l),i.reverse(),s=o;s--;)i.push(0);i.reverse()}else for(t=((n=f.length<l.length)?f:l).length,o=s=0;s<t;s++)if(f[s]!=l[s]){n=f[s]<l[s];break}if(n&&(i=f,f=l,l=i,e.s=-e.s),(s=(t=l.length)-(r=f.length))>0)for(;s--;)f[r++]=0;for(s=r;t>o;){if(f[--t]<l[t]){for(r=t;r&&!f[--r];)f[r]=9;--f[r],f[t]+=10}f[t]-=l[t]}for(;f[--s]===0;)f.pop();for(;f[0]===0;)f.shift(),--E;return f[0]||(e.s=1,f=[E=0]),e.c=f,e.e=E,e};h.mod=function(e){var r,t=this,i=t.constructor,n=t.s,c=(e=new i(e)).s;if(!e.c[0])throw Error(j);return t.s=e.s=1,r=e.cmp(t)==1,t.s=n,e.s=c,r?new i(t):(n=i.DP,c=i.RM,i.DP=i.RM=0,t=t.div(e),i.DP=n,i.RM=c,this.minus(t.times(e)))};h.neg=function(){var e=new this.constructor(this);return e.s=-e.s,e};h.plus=h.add=function(e){var r,t,i,n=this,c=n.constructor;if(e=new c(e),n.s!=e.s)return e.s=-e.s,n.minus(e);var u=n.e,o=n.c,s=e.e,f=e.c;if(!o[0]||!f[0])return f[0]||(o[0]?e=new c(n):e.s=n.s),e;if(o=o.slice(),r=u-s){for(r>0?(s=u,i=f):(r=-r,i=o),i.reverse();r--;)i.push(0);i.reverse()}for(o.length-f.length<0&&(i=f,f=o,o=i),r=f.length,t=0;r;o[r]%=10)t=(o[--r]=o[r]+f[r]+t)/10|0;for(t&&(o.unshift(t),++s),r=o.length;o[--r]===0;)o.pop();return e.c=o,e.e=s,e};h.pow=function(e){var r=this,t=new r.constructor("1"),i=t,n=e<0;if(e!==~~e||e<-1e6||e>F)throw Error(p+"exponent");for(n&&(e=-e);e&1&&(i=i.times(r)),e>>=1,!!e;)r=r.times(r);return n?t.div(i):i};h.prec=function(e,r){if(e!==~~e||e<1||e>N)throw Error(p+"precision");return b(new this.constructor(this),e,r)};h.round=function(e,r){if(e===w)e=0;else if(e!==~~e||e<-1e6||e>N)throw Error(P);return b(new this.constructor(this),e+this.e+1,r)};h.sqrt=function(){var e,r,t,i=this,n=i.constructor,c=i.s,u=i.e,o=new n("0.5");if(!i.c[0])return new n(i);if(c<0)throw Error(M+"No square root");c=Math.sqrt(+m(i,!0,!0)),c===0||c===1/0?(r=i.c.join(""),r.length+u&1||(r+="0"),c=Math.sqrt(r),u=((u+1)/2|0)-(u<0||u&1),e=new n((c==1/0?"5e":(c=c.toExponential()).slice(0,c.indexOf("e")+1))+u)):e=new n(c+""),u=e.e+(n.DP+=4);do t=e,e=o.times(t.plus(i.div(t)));while(t.c.slice(0,u).join("")!==e.c.slice(0,u).join(""));return b(e,(n.DP-=4)+e.e+1,n.RM)};h.times=h.mul=function(e){var r,t=this,i=t.constructor,n=t.c,c=(e=new i(e)).c,u=n.length,o=c.length,s=t.e,f=e.e;if(e.s=t.s==e.s?1:-1,!n[0]||!c[0])return e.c=[e.e=0],e;for(e.e=s+f,u<o&&(r=n,n=c,c=r,f=u,u=o,o=f),r=new Array(f=u+o);f--;)r[f]=0;for(s=o;s--;){for(o=0,f=u+s;f>s;)o=r[f]+c[s]*n[f-s-1]+o,r[f--]=o%10,o=o/10|0;r[f]=o}for(o?++e.e:r.shift(),s=r.length;!r[--s];)r.pop();return e.c=r,e};h.toExponential=function(e,r){var t=this,i=t.c[0];if(e!==w){if(e!==~~e||e<0||e>N)throw Error(P);for(t=b(new t.constructor(t),++e,r);t.c.length<e;)t.c.push(0)}return m(t,!0,!!i)};h.toFixed=function(e,r){var t=this,i=t.c[0];if(e!==w){if(e!==~~e||e<0||e>N)throw Error(P);for(t=b(new t.constructor(t),e+t.e+1,r),e=e+t.e+1;t.c.length<e;)t.c.push(0)}return m(t,!1,!!i)};h.toJSON=h.toString=function(){var e=this,r=e.constructor;return m(e,e.e<=r.NE||e.e>=r.PE,!!e.c[0])};typeof Symbol<"u"&&(h[Symbol.for("nodejs.util.inspect.custom")]=h.toJSON);h.toNumber=function(){var e=+m(this,!0,!0);if(this.constructor.strict===!0&&!this.eq(e.toString()))throw Error(M+"Imprecise conversion");return e};h.toPrecision=function(e,r){var t=this,i=t.constructor,n=t.c[0];if(e!==w){if(e!==~~e||e<1||e>N)throw Error(p+"precision");for(t=b(new i(t),e,r);t.c.length<e;)t.c.push(0)}return m(t,e<=t.e||t.e<=i.NE||t.e>=i.PE,!!n)};h.valueOf=function(){var e=this,r=e.constructor;if(r.strict===!0)throw Error(M+"valueOf disallowed");return m(e,e.e<=r.NE||e.e>=r.PE,!0)};var R=S();function q(e=0,r=0){try{return new R(e).round(r,0).toFixed(r)}catch{return new R(0).toFixed(r)}}function Z(e=0,r=0){const i=q(e,r).toString().split(".");return i[0]=i[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),i.join(".")}function $(e){if(!e.length)return{min:NaN,max:NaN};let r=-1/0,t=1/0;return e.forEach(([i,n])=>{r=Math.max(r,i),t=Math.min(t,n)}),r>t?{min:NaN,max:NaN}:{min:r,max:t}}function z(e){return/^0\.\d+$/.test(e)?e.replace(/^0/,""):/^\d*\.?\d+$/.test(e)?e.replace(/^0+(?=\d)/,""):e}exports.formatCurrency=Z;exports.intersectionMin=$;exports.removeLeadingZero=z;exports.safeFormatDecimal=q; |
+164
-163
@@ -1,55 +0,55 @@ | ||
| var k = 20, O = 1, M = 1e6, _ = 1e6, F = -7, L = 21, U = !1, P = "[big.js] ", p = P + "Invalid ", m = p + "decimal places", V = p + "rounding mode", j = P + "Division by zero", h = {}, v = void 0, C = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i; | ||
| var k = 20, O = 1, D = 1e6, _ = 1e6, F = -7, L = 21, U = !1, M = "[big.js] ", p = M + "Invalid ", P = p + "decimal places", V = p + "rounding mode", j = M + "Division by zero", h = {}, w = void 0, C = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i; | ||
| function q() { | ||
| function e(r) { | ||
| function r(e) { | ||
| var t = this; | ||
| if (!(t instanceof e)) | ||
| return r === v && arguments.length === 0 ? q() : new e(r); | ||
| if (r instanceof e) | ||
| t.s = r.s, t.e = r.e, t.c = r.c.slice(); | ||
| if (!(t instanceof r)) | ||
| return e === w && arguments.length === 0 ? q() : new r(e); | ||
| if (e instanceof r) | ||
| t.s = e.s, t.e = e.e, t.c = e.c.slice(); | ||
| else { | ||
| if (typeof r != "string") { | ||
| if (e.strict === !0 && typeof r != "bigint") | ||
| if (typeof e != "string") { | ||
| if (r.strict === !0 && typeof e != "bigint") | ||
| throw TypeError(p + "value"); | ||
| r = r === 0 && 1 / r < 0 ? "-0" : String(r); | ||
| e = e === 0 && 1 / e < 0 ? "-0" : String(e); | ||
| } | ||
| T(t, r); | ||
| T(t, e); | ||
| } | ||
| t.constructor = e; | ||
| t.constructor = r; | ||
| } | ||
| return e.prototype = h, e.DP = k, e.RM = O, e.NE = F, e.PE = L, e.strict = U, e.roundDown = 0, e.roundHalfUp = 1, e.roundHalfEven = 2, e.roundUp = 3, e; | ||
| return r.prototype = h, r.DP = k, r.RM = O, r.NE = F, r.PE = L, r.strict = U, r.roundDown = 0, r.roundHalfUp = 1, r.roundHalfEven = 2, r.roundUp = 3, r; | ||
| } | ||
| function T(e, r) { | ||
| function T(r, e) { | ||
| var t, i, n; | ||
| if (!C.test(r)) | ||
| if (!C.test(e)) | ||
| throw Error(p + "number"); | ||
| for (e.s = r.charAt(0) == "-" ? (r = r.slice(1), -1) : 1, (t = r.indexOf(".")) > -1 && (r = r.replace(".", "")), (i = r.search(/e/i)) > 0 ? (t < 0 && (t = i), t += +r.slice(i + 1), r = r.substring(0, i)) : t < 0 && (t = r.length), n = r.length, i = 0; i < n && r.charAt(i) == "0"; ) ++i; | ||
| for (r.s = e.charAt(0) == "-" ? (e = e.slice(1), -1) : 1, (t = e.indexOf(".")) > -1 && (e = e.replace(".", "")), (i = e.search(/e/i)) > 0 ? (t < 0 && (t = i), t += +e.slice(i + 1), e = e.substring(0, i)) : t < 0 && (t = e.length), n = e.length, i = 0; i < n && e.charAt(i) == "0"; ) ++i; | ||
| if (i == n) | ||
| e.c = [e.e = 0]; | ||
| r.c = [r.e = 0]; | ||
| else { | ||
| for (; n > 0 && r.charAt(--n) == "0"; ) ; | ||
| for (e.e = t - i - 1, e.c = [], t = 0; i <= n; ) e.c[t++] = +r.charAt(i++); | ||
| for (; n > 0 && e.charAt(--n) == "0"; ) ; | ||
| for (r.e = t - i - 1, r.c = [], t = 0; i <= n; ) r.c[t++] = +e.charAt(i++); | ||
| } | ||
| return e; | ||
| return r; | ||
| } | ||
| function b(e, r, t, i) { | ||
| var n = e.c; | ||
| if (t === v && (t = e.constructor.RM), t !== 0 && t !== 1 && t !== 2 && t !== 3) | ||
| function x(r, e, t, i) { | ||
| var n = r.c; | ||
| if (t === w && (t = r.constructor.RM), t !== 0 && t !== 1 && t !== 2 && t !== 3) | ||
| throw Error(V); | ||
| if (r < 1) | ||
| i = t === 3 && (i || !!n[0]) || r === 0 && (t === 1 && n[0] >= 5 || t === 2 && (n[0] > 5 || n[0] === 5 && (i || n[1] !== v))), n.length = 1, i ? (e.e = e.e - r + 1, n[0] = 1) : n[0] = e.e = 0; | ||
| else if (r < n.length) { | ||
| if (i = t === 1 && n[r] >= 5 || t === 2 && (n[r] > 5 || n[r] === 5 && (i || n[r + 1] !== v || n[r - 1] & 1)) || t === 3 && (i || !!n[0]), n.length = r, i) { | ||
| for (; ++n[--r] > 9; ) | ||
| if (n[r] = 0, r === 0) { | ||
| ++e.e, n.unshift(1); | ||
| if (e < 1) | ||
| i = t === 3 && (i || !!n[0]) || e === 0 && (t === 1 && n[0] >= 5 || t === 2 && (n[0] > 5 || n[0] === 5 && (i || n[1] !== w))), n.length = 1, i ? (r.e = r.e - e + 1, n[0] = 1) : n[0] = r.e = 0; | ||
| else if (e < n.length) { | ||
| if (i = t === 1 && n[e] >= 5 || t === 2 && (n[e] > 5 || n[e] === 5 && (i || n[e + 1] !== w || n[e - 1] & 1)) || t === 3 && (i || !!n[0]), n.length = e, i) { | ||
| for (; ++n[--e] > 9; ) | ||
| if (n[e] = 0, e === 0) { | ||
| ++r.e, n.unshift(1); | ||
| break; | ||
| } | ||
| } | ||
| for (r = n.length; !n[--r]; ) n.pop(); | ||
| for (e = n.length; !n[--e]; ) n.pop(); | ||
| } | ||
| return e; | ||
| return r; | ||
| } | ||
| function x(e, r, t) { | ||
| var i = e.e, n = e.c.join(""), c = n.length; | ||
| if (r) | ||
| function N(r, e, t) { | ||
| var i = r.e, n = r.c.join(""), c = n.length; | ||
| if (e) | ||
| n = n.charAt(0) + (c > 1 ? "." + n.slice(1) : "") + (i < 0 ? "e" : "e+") + i; | ||
@@ -64,38 +64,38 @@ else if (i < 0) { | ||
| else c > 1 && (n = n.charAt(0) + "." + n.slice(1)); | ||
| return e.s < 0 && t ? "-" + n : n; | ||
| return r.s < 0 && t ? "-" + n : n; | ||
| } | ||
| h.abs = function() { | ||
| var e = new this.constructor(this); | ||
| return e.s = 1, e; | ||
| var r = new this.constructor(this); | ||
| return r.s = 1, r; | ||
| }; | ||
| h.cmp = function(e) { | ||
| var r, t = this, i = t.c, n = (e = new t.constructor(e)).c, c = t.s, u = e.s, o = t.e, s = e.e; | ||
| h.cmp = function(r) { | ||
| var e, t = this, i = t.c, n = (r = new t.constructor(r)).c, c = t.s, u = r.s, o = t.e, s = r.e; | ||
| if (!i[0] || !n[0]) return i[0] ? c : n[0] ? -u : 0; | ||
| if (c != u) return c; | ||
| if (r = c < 0, o != s) return o > s ^ r ? 1 : -1; | ||
| if (e = c < 0, o != s) return o > s ^ e ? 1 : -1; | ||
| for (u = (o = i.length) < (s = n.length) ? o : s, c = -1; ++c < u; ) | ||
| if (i[c] != n[c]) return i[c] > n[c] ^ r ? 1 : -1; | ||
| return o == s ? 0 : o > s ^ r ? 1 : -1; | ||
| if (i[c] != n[c]) return i[c] > n[c] ^ e ? 1 : -1; | ||
| return o == s ? 0 : o > s ^ e ? 1 : -1; | ||
| }; | ||
| h.div = function(e) { | ||
| var r = this, t = r.constructor, i = r.c, n = (e = new t(e)).c, c = r.s == e.s ? 1 : -1, u = t.DP; | ||
| if (u !== ~~u || u < 0 || u > M) | ||
| throw Error(m); | ||
| h.div = function(r) { | ||
| var e = this, t = e.constructor, i = e.c, n = (r = new t(r)).c, c = e.s == r.s ? 1 : -1, u = t.DP; | ||
| if (u !== ~~u || u < 0 || u > D) | ||
| throw Error(P); | ||
| if (!n[0]) | ||
| throw Error(j); | ||
| if (!i[0]) | ||
| return e.s = c, e.c = [e.e = 0], e; | ||
| var o, s, f, w, l, E = n.slice(), B = o = n.length, S = i.length, a = i.slice(0, o), g = a.length, D = e, A = D.c = [], R = 0, N = u + (D.e = r.e - e.e) + 1; | ||
| for (D.s = c, c = N < 0 ? 0 : N, E.unshift(0); g++ < o; ) a.push(0); | ||
| return r.s = c, r.c = [r.e = 0], r; | ||
| var o, s, f, v, l, E = n.slice(), B = o = n.length, S = i.length, a = i.slice(0, o), g = a.length, b = r, I = b.c = [], A = 0, m = u + (b.e = e.e - r.e) + 1; | ||
| for (b.s = c, c = m < 0 ? 0 : m, E.unshift(0); g++ < o; ) a.push(0); | ||
| do { | ||
| for (f = 0; f < 10; f++) { | ||
| if (o != (g = a.length)) | ||
| w = o > g ? 1 : -1; | ||
| v = o > g ? 1 : -1; | ||
| else | ||
| for (l = -1, w = 0; ++l < o; ) | ||
| for (l = -1, v = 0; ++l < o; ) | ||
| if (n[l] != a[l]) { | ||
| w = n[l] > a[l] ? 1 : -1; | ||
| v = n[l] > a[l] ? 1 : -1; | ||
| break; | ||
| } | ||
| if (w < 0) { | ||
| if (v < 0) { | ||
| for (s = g == o ? n : E; g; ) { | ||
@@ -112,30 +112,30 @@ if (a[--g] < s[g]) { | ||
| } | ||
| A[R++] = w ? f : ++f, a[0] && w ? a[g] = i[B] || 0 : a = [i[B]]; | ||
| } while ((B++ < S || a[0] !== v) && c--); | ||
| return !A[0] && R != 1 && (A.shift(), D.e--, N--), R > N && b(D, N, t.RM, a[0] !== v), D; | ||
| I[A++] = v ? f : ++f, a[0] && v ? a[g] = i[B] || 0 : a = [i[B]]; | ||
| } while ((B++ < S || a[0] !== w) && c--); | ||
| return !I[0] && A != 1 && (I.shift(), b.e--, m--), A > m && x(b, m, t.RM, a[0] !== w), b; | ||
| }; | ||
| h.eq = function(e) { | ||
| return this.cmp(e) === 0; | ||
| h.eq = function(r) { | ||
| return this.cmp(r) === 0; | ||
| }; | ||
| h.gt = function(e) { | ||
| return this.cmp(e) > 0; | ||
| h.gt = function(r) { | ||
| return this.cmp(r) > 0; | ||
| }; | ||
| h.gte = function(e) { | ||
| return this.cmp(e) > -1; | ||
| h.gte = function(r) { | ||
| return this.cmp(r) > -1; | ||
| }; | ||
| h.lt = function(e) { | ||
| return this.cmp(e) < 0; | ||
| h.lt = function(r) { | ||
| return this.cmp(r) < 0; | ||
| }; | ||
| h.lte = function(e) { | ||
| return this.cmp(e) < 1; | ||
| h.lte = function(r) { | ||
| return this.cmp(r) < 1; | ||
| }; | ||
| h.minus = h.sub = function(e) { | ||
| var r, t, i, n, c = this, u = c.constructor, o = c.s, s = (e = new u(e)).s; | ||
| h.minus = h.sub = function(r) { | ||
| var e, t, i, n, c = this, u = c.constructor, o = c.s, s = (r = new u(r)).s; | ||
| if (o != s) | ||
| return e.s = -s, c.plus(e); | ||
| var f = c.c.slice(), w = c.e, l = e.c, E = e.e; | ||
| return r.s = -s, c.plus(r); | ||
| var f = c.c.slice(), v = c.e, l = r.c, E = r.e; | ||
| if (!f[0] || !l[0]) | ||
| return l[0] ? e.s = -s : f[0] ? e = new u(c) : e.s = 1, e; | ||
| if (o = w - E) { | ||
| for ((n = o < 0) ? (o = -o, i = f) : (E = w, i = l), i.reverse(), s = o; s--; ) i.push(0); | ||
| return l[0] ? r.s = -s : f[0] ? r = new u(c) : r.s = 1, r; | ||
| if (o = v - E) { | ||
| for ((n = o < 0) ? (o = -o, i = f) : (E = v, i = l), i.reverse(), s = o; s--; ) i.push(0); | ||
| i.reverse(); | ||
@@ -148,7 +148,7 @@ } else | ||
| } | ||
| if (n && (i = f, f = l, l = i, e.s = -e.s), (s = (t = l.length) - (r = f.length)) > 0) for (; s--; ) f[r++] = 0; | ||
| for (s = r; t > o; ) { | ||
| if (n && (i = f, f = l, l = i, r.s = -r.s), (s = (t = l.length) - (e = f.length)) > 0) for (; s--; ) f[e++] = 0; | ||
| for (s = e; t > o; ) { | ||
| if (f[--t] < l[t]) { | ||
| for (r = t; r && !f[--r]; ) f[r] = 9; | ||
| --f[r], f[t] += 10; | ||
| for (e = t; e && !f[--e]; ) f[e] = 9; | ||
| --f[e], f[t] += 10; | ||
| } | ||
@@ -160,136 +160,137 @@ f[t] -= l[t]; | ||
| f.shift(), --E; | ||
| return f[0] || (e.s = 1, f = [E = 0]), e.c = f, e.e = E, e; | ||
| return f[0] || (r.s = 1, f = [E = 0]), r.c = f, r.e = E, r; | ||
| }; | ||
| h.mod = function(e) { | ||
| var r, t = this, i = t.constructor, n = t.s, c = (e = new i(e)).s; | ||
| if (!e.c[0]) | ||
| h.mod = function(r) { | ||
| var e, t = this, i = t.constructor, n = t.s, c = (r = new i(r)).s; | ||
| if (!r.c[0]) | ||
| throw Error(j); | ||
| return t.s = e.s = 1, r = e.cmp(t) == 1, t.s = n, e.s = c, r ? new i(t) : (n = i.DP, c = i.RM, i.DP = i.RM = 0, t = t.div(e), i.DP = n, i.RM = c, this.minus(t.times(e))); | ||
| return t.s = r.s = 1, e = r.cmp(t) == 1, t.s = n, r.s = c, e ? new i(t) : (n = i.DP, c = i.RM, i.DP = i.RM = 0, t = t.div(r), i.DP = n, i.RM = c, this.minus(t.times(r))); | ||
| }; | ||
| h.neg = function() { | ||
| var e = new this.constructor(this); | ||
| return e.s = -e.s, e; | ||
| var r = new this.constructor(this); | ||
| return r.s = -r.s, r; | ||
| }; | ||
| h.plus = h.add = function(e) { | ||
| var r, t, i, n = this, c = n.constructor; | ||
| if (e = new c(e), n.s != e.s) | ||
| return e.s = -e.s, n.minus(e); | ||
| var u = n.e, o = n.c, s = e.e, f = e.c; | ||
| h.plus = h.add = function(r) { | ||
| var e, t, i, n = this, c = n.constructor; | ||
| if (r = new c(r), n.s != r.s) | ||
| return r.s = -r.s, n.minus(r); | ||
| var u = n.e, o = n.c, s = r.e, f = r.c; | ||
| if (!o[0] || !f[0]) | ||
| return f[0] || (o[0] ? e = new c(n) : e.s = n.s), e; | ||
| if (o = o.slice(), r = u - s) { | ||
| for (r > 0 ? (s = u, i = f) : (r = -r, i = o), i.reverse(); r--; ) i.push(0); | ||
| return f[0] || (o[0] ? r = new c(n) : r.s = n.s), r; | ||
| if (o = o.slice(), e = u - s) { | ||
| for (e > 0 ? (s = u, i = f) : (e = -e, i = o), i.reverse(); e--; ) i.push(0); | ||
| i.reverse(); | ||
| } | ||
| for (o.length - f.length < 0 && (i = f, f = o, o = i), r = f.length, t = 0; r; o[r] %= 10) t = (o[--r] = o[r] + f[r] + t) / 10 | 0; | ||
| for (t && (o.unshift(t), ++s), r = o.length; o[--r] === 0; ) o.pop(); | ||
| return e.c = o, e.e = s, e; | ||
| for (o.length - f.length < 0 && (i = f, f = o, o = i), e = f.length, t = 0; e; o[e] %= 10) t = (o[--e] = o[e] + f[e] + t) / 10 | 0; | ||
| for (t && (o.unshift(t), ++s), e = o.length; o[--e] === 0; ) o.pop(); | ||
| return r.c = o, r.e = s, r; | ||
| }; | ||
| h.pow = function(e) { | ||
| var r = this, t = new r.constructor("1"), i = t, n = e < 0; | ||
| if (e !== ~~e || e < -1e6 || e > _) | ||
| h.pow = function(r) { | ||
| var e = this, t = new e.constructor("1"), i = t, n = r < 0; | ||
| if (r !== ~~r || r < -1e6 || r > _) | ||
| throw Error(p + "exponent"); | ||
| for (n && (e = -e); e & 1 && (i = i.times(r)), e >>= 1, !!e; ) | ||
| r = r.times(r); | ||
| for (n && (r = -r); r & 1 && (i = i.times(e)), r >>= 1, !!r; ) | ||
| e = e.times(e); | ||
| return n ? t.div(i) : i; | ||
| }; | ||
| h.prec = function(e, r) { | ||
| if (e !== ~~e || e < 1 || e > M) | ||
| h.prec = function(r, e) { | ||
| if (r !== ~~r || r < 1 || r > D) | ||
| throw Error(p + "precision"); | ||
| return b(new this.constructor(this), e, r); | ||
| return x(new this.constructor(this), r, e); | ||
| }; | ||
| h.round = function(e, r) { | ||
| if (e === v) e = 0; | ||
| else if (e !== ~~e || e < -1e6 || e > M) | ||
| throw Error(m); | ||
| return b(new this.constructor(this), e + this.e + 1, r); | ||
| h.round = function(r, e) { | ||
| if (r === w) r = 0; | ||
| else if (r !== ~~r || r < -1e6 || r > D) | ||
| throw Error(P); | ||
| return x(new this.constructor(this), r + this.e + 1, e); | ||
| }; | ||
| h.sqrt = function() { | ||
| var e, r, t, i = this, n = i.constructor, c = i.s, u = i.e, o = new n("0.5"); | ||
| var r, e, t, i = this, n = i.constructor, c = i.s, u = i.e, o = new n("0.5"); | ||
| if (!i.c[0]) return new n(i); | ||
| if (c < 0) | ||
| throw Error(P + "No square root"); | ||
| c = Math.sqrt(+x(i, !0, !0)), c === 0 || c === 1 / 0 ? (r = i.c.join(""), r.length + u & 1 || (r += "0"), c = Math.sqrt(r), u = ((u + 1) / 2 | 0) - (u < 0 || u & 1), e = new n((c == 1 / 0 ? "5e" : (c = c.toExponential()).slice(0, c.indexOf("e") + 1)) + u)) : e = new n(c + ""), u = e.e + (n.DP += 4); | ||
| throw Error(M + "No square root"); | ||
| c = Math.sqrt(+N(i, !0, !0)), c === 0 || c === 1 / 0 ? (e = i.c.join(""), e.length + u & 1 || (e += "0"), c = Math.sqrt(e), u = ((u + 1) / 2 | 0) - (u < 0 || u & 1), r = new n((c == 1 / 0 ? "5e" : (c = c.toExponential()).slice(0, c.indexOf("e") + 1)) + u)) : r = new n(c + ""), u = r.e + (n.DP += 4); | ||
| do | ||
| t = e, e = o.times(t.plus(i.div(t))); | ||
| while (t.c.slice(0, u).join("") !== e.c.slice(0, u).join("")); | ||
| return b(e, (n.DP -= 4) + e.e + 1, n.RM); | ||
| t = r, r = o.times(t.plus(i.div(t))); | ||
| while (t.c.slice(0, u).join("") !== r.c.slice(0, u).join("")); | ||
| return x(r, (n.DP -= 4) + r.e + 1, n.RM); | ||
| }; | ||
| h.times = h.mul = function(e) { | ||
| var r, t = this, i = t.constructor, n = t.c, c = (e = new i(e)).c, u = n.length, o = c.length, s = t.e, f = e.e; | ||
| if (e.s = t.s == e.s ? 1 : -1, !n[0] || !c[0]) | ||
| return e.c = [e.e = 0], e; | ||
| for (e.e = s + f, u < o && (r = n, n = c, c = r, f = u, u = o, o = f), r = new Array(f = u + o); f--; ) r[f] = 0; | ||
| h.times = h.mul = function(r) { | ||
| var e, t = this, i = t.constructor, n = t.c, c = (r = new i(r)).c, u = n.length, o = c.length, s = t.e, f = r.e; | ||
| if (r.s = t.s == r.s ? 1 : -1, !n[0] || !c[0]) | ||
| return r.c = [r.e = 0], r; | ||
| for (r.e = s + f, u < o && (e = n, n = c, c = e, f = u, u = o, o = f), e = new Array(f = u + o); f--; ) e[f] = 0; | ||
| for (s = o; s--; ) { | ||
| for (o = 0, f = u + s; f > s; ) | ||
| o = r[f] + c[s] * n[f - s - 1] + o, r[f--] = o % 10, o = o / 10 | 0; | ||
| r[f] = o; | ||
| o = e[f] + c[s] * n[f - s - 1] + o, e[f--] = o % 10, o = o / 10 | 0; | ||
| e[f] = o; | ||
| } | ||
| for (o ? ++e.e : r.shift(), s = r.length; !r[--s]; ) r.pop(); | ||
| return e.c = r, e; | ||
| for (o ? ++r.e : e.shift(), s = e.length; !e[--s]; ) e.pop(); | ||
| return r.c = e, r; | ||
| }; | ||
| h.toExponential = function(e, r) { | ||
| h.toExponential = function(r, e) { | ||
| var t = this, i = t.c[0]; | ||
| if (e !== v) { | ||
| if (e !== ~~e || e < 0 || e > M) | ||
| throw Error(m); | ||
| for (t = b(new t.constructor(t), ++e, r); t.c.length < e; ) t.c.push(0); | ||
| if (r !== w) { | ||
| if (r !== ~~r || r < 0 || r > D) | ||
| throw Error(P); | ||
| for (t = x(new t.constructor(t), ++r, e); t.c.length < r; ) t.c.push(0); | ||
| } | ||
| return x(t, !0, !!i); | ||
| return N(t, !0, !!i); | ||
| }; | ||
| h.toFixed = function(e, r) { | ||
| h.toFixed = function(r, e) { | ||
| var t = this, i = t.c[0]; | ||
| if (e !== v) { | ||
| if (e !== ~~e || e < 0 || e > M) | ||
| throw Error(m); | ||
| for (t = b(new t.constructor(t), e + t.e + 1, r), e = e + t.e + 1; t.c.length < e; ) t.c.push(0); | ||
| if (r !== w) { | ||
| if (r !== ~~r || r < 0 || r > D) | ||
| throw Error(P); | ||
| for (t = x(new t.constructor(t), r + t.e + 1, e), r = r + t.e + 1; t.c.length < r; ) t.c.push(0); | ||
| } | ||
| return x(t, !1, !!i); | ||
| return N(t, !1, !!i); | ||
| }; | ||
| h.toJSON = h.toString = function() { | ||
| var e = this, r = e.constructor; | ||
| return x(e, e.e <= r.NE || e.e >= r.PE, !!e.c[0]); | ||
| var r = this, e = r.constructor; | ||
| return N(r, r.e <= e.NE || r.e >= e.PE, !!r.c[0]); | ||
| }; | ||
| typeof Symbol < "u" && (h[Symbol.for("nodejs.util.inspect.custom")] = h.toJSON); | ||
| h.toNumber = function() { | ||
| var e = +x(this, !0, !0); | ||
| if (this.constructor.strict === !0 && !this.eq(e.toString())) | ||
| throw Error(P + "Imprecise conversion"); | ||
| return e; | ||
| var r = +N(this, !0, !0); | ||
| if (this.constructor.strict === !0 && !this.eq(r.toString())) | ||
| throw Error(M + "Imprecise conversion"); | ||
| return r; | ||
| }; | ||
| h.toPrecision = function(e, r) { | ||
| h.toPrecision = function(r, e) { | ||
| var t = this, i = t.constructor, n = t.c[0]; | ||
| if (e !== v) { | ||
| if (e !== ~~e || e < 1 || e > M) | ||
| if (r !== w) { | ||
| if (r !== ~~r || r < 1 || r > D) | ||
| throw Error(p + "precision"); | ||
| for (t = b(new i(t), e, r); t.c.length < e; ) t.c.push(0); | ||
| for (t = x(new i(t), r, e); t.c.length < r; ) t.c.push(0); | ||
| } | ||
| return x(t, e <= t.e || t.e <= i.NE || t.e >= i.PE, !!n); | ||
| return N(t, r <= t.e || t.e <= i.NE || t.e >= i.PE, !!n); | ||
| }; | ||
| h.valueOf = function() { | ||
| var e = this, r = e.constructor; | ||
| if (r.strict === !0) | ||
| throw Error(P + "valueOf disallowed"); | ||
| return x(e, e.e <= r.NE || e.e >= r.PE, !0); | ||
| var r = this, e = r.constructor; | ||
| if (e.strict === !0) | ||
| throw Error(M + "valueOf disallowed"); | ||
| return N(r, r.e <= e.NE || r.e >= e.PE, !0); | ||
| }; | ||
| var I = q(); | ||
| function $(e = 0, r = 0) { | ||
| var R = q(); | ||
| function $(r = 0, e = 0) { | ||
| try { | ||
| return new I(e).round(r, 0).toFixed(r); | ||
| return new R(r).round(e, 0).toFixed(e); | ||
| } catch { | ||
| return new I(0).toFixed(r); | ||
| return new R(0).toFixed(e); | ||
| } | ||
| } | ||
| function d(e = 0, r = 0) { | ||
| const i = $(e, r).toString().split("."); | ||
| function d(r = 0, e = 0) { | ||
| const i = $(r, e).toString().split("."); | ||
| return i[0] = i[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","), i.join("."); | ||
| } | ||
| function z(e) { | ||
| let r, t; | ||
| return e.forEach((i) => { | ||
| r = r ? i[0] > r ? i[0] : r : i[0], t = t ? i[1] < t ? i[1] : t : i[1]; | ||
| }), { min: r ?? 0, max: t ?? 0 }; | ||
| function z(r) { | ||
| if (!r.length) return { min: NaN, max: NaN }; | ||
| let e = -1 / 0, t = 1 / 0; | ||
| return r.forEach(([i, n]) => { | ||
| e = Math.max(e, i), t = Math.min(t, n); | ||
| }), e > t ? { min: NaN, max: NaN } : { min: e, max: t }; | ||
| } | ||
| function H(e) { | ||
| return /^0\.\d+$/.test(e) ? e.replace(/^0/, "") : /^\d*\.?\d+$/.test(e) ? e.replace(/^0+(?=\d)/, "") : e; | ||
| function H(r) { | ||
| return /^0\.\d+$/.test(r) ? r.replace(/^0/, "") : /^\d*\.?\d+$/.test(r) ? r.replace(/^0+(?=\d)/, "") : r; | ||
| } | ||
@@ -296,0 +297,0 @@ export { |
+1
-1
| { | ||
| "name": "@acrool/js-utils", | ||
| "version": "3.2.23", | ||
| "version": "3.2.24", | ||
| "description": "Common javascript utils methods for project development", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
104672
0.11%2300
0.04%