js-big-decimal
Advanced tools
Comparing version 1.3.6 to 1.3.7
@@ -6,3 +6,3 @@ import { RoundingModes as Modes } from './roundingModes'; | ||
private static validate; | ||
constructor(number?: (number | string)); | ||
constructor(number?: (number | string | bigint)); | ||
getValue(): string; | ||
@@ -27,4 +27,4 @@ static getPrettyValue(number: any, digits: any, separator: any): string; | ||
modulus(number: bigDecimal): bigDecimal; | ||
static compareTo(number1: any, number2: any): 1 | 0 | -1; | ||
compareTo(number: bigDecimal): 1 | 0 | -1; | ||
static compareTo(number1: any, number2: any): 1 | -1 | 0; | ||
compareTo(number: bigDecimal): 1 | -1 | 0; | ||
static negate(number: any): string; | ||
@@ -31,0 +31,0 @@ negate(): bigDecimal; |
@@ -10,3 +10,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
root["bigDecimal"] = factory(); | ||
})(global, function() { | ||
})(global, () => { | ||
return /******/ (() => { // webpackBootstrap | ||
@@ -162,3 +162,3 @@ /******/ "use strict"; | ||
var _a = number.split(/[eE]/), mantisa = _a[0], exponent = _a[1]; | ||
mantisa = add_1.trim(mantisa); | ||
mantisa = (0, add_1.trim)(mantisa); | ||
var sign = ''; | ||
@@ -180,3 +180,3 @@ if (mantisa[0] == '-') { | ||
else if (mantisa.length >= exponent && exponent > 0) { | ||
number = sign + add_1.trim(mantisa.substring(0, exponent)) + | ||
number = sign + (0, add_1.trim)(mantisa.substring(0, exponent)) + | ||
((mantisa.length > exponent) ? ('.' + mantisa.substring(exponent)) : ''); | ||
@@ -229,3 +229,3 @@ } | ||
throw Error("Precision is not a number: " + precision); | ||
return round_1.roundOff(number, precision, mode); | ||
return (0, round_1.roundOff)(number, precision, mode); | ||
}; | ||
@@ -237,3 +237,3 @@ bigDecimal.prototype.round = function (precision, mode) { | ||
throw Error("Precision is not a number: " + precision); | ||
return new bigDecimal(round_1.roundOff(this.value, precision, mode)); | ||
return new bigDecimal((0, round_1.roundOff)(this.value, precision, mode)); | ||
}; | ||
@@ -265,6 +265,6 @@ bigDecimal.floor = function (number) { | ||
number2 = bigDecimal.validate(number2); | ||
return add_1.add(number1, number2); | ||
return (0, add_1.add)(number1, number2); | ||
}; | ||
bigDecimal.prototype.add = function (number) { | ||
return new bigDecimal(add_1.add(this.value, number.getValue())); | ||
return new bigDecimal((0, add_1.add)(this.value, number.getValue())); | ||
}; | ||
@@ -274,6 +274,6 @@ bigDecimal.subtract = function (number1, number2) { | ||
number2 = bigDecimal.validate(number2); | ||
return subtract_1.subtract(number1, number2); | ||
return (0, subtract_1.subtract)(number1, number2); | ||
}; | ||
bigDecimal.prototype.subtract = function (number) { | ||
return new bigDecimal(subtract_1.subtract(this.value, number.getValue())); | ||
return new bigDecimal((0, subtract_1.subtract)(this.value, number.getValue())); | ||
}; | ||
@@ -283,6 +283,6 @@ bigDecimal.multiply = function (number1, number2) { | ||
number2 = bigDecimal.validate(number2); | ||
return multiply_1.multiply(number1, number2); | ||
return (0, multiply_1.multiply)(number1, number2); | ||
}; | ||
bigDecimal.prototype.multiply = function (number) { | ||
return new bigDecimal(multiply_1.multiply(this.value, number.getValue())); | ||
return new bigDecimal((0, multiply_1.multiply)(this.value, number.getValue())); | ||
}; | ||
@@ -292,6 +292,6 @@ bigDecimal.divide = function (number1, number2, precision) { | ||
number2 = bigDecimal.validate(number2); | ||
return divide_1.divide(number1, number2, precision); | ||
return (0, divide_1.divide)(number1, number2, precision); | ||
}; | ||
bigDecimal.prototype.divide = function (number, precision) { | ||
return new bigDecimal(divide_1.divide(this.value, number.getValue(), precision)); | ||
return new bigDecimal((0, divide_1.divide)(this.value, number.getValue(), precision)); | ||
}; | ||
@@ -301,6 +301,6 @@ bigDecimal.modulus = function (number1, number2) { | ||
number2 = bigDecimal.validate(number2); | ||
return modulus_1.modulus(number1, number2); | ||
return (0, modulus_1.modulus)(number1, number2); | ||
}; | ||
bigDecimal.prototype.modulus = function (number) { | ||
return new bigDecimal(modulus_1.modulus(this.value, number.getValue())); | ||
return new bigDecimal((0, modulus_1.modulus)(this.value, number.getValue())); | ||
}; | ||
@@ -310,13 +310,13 @@ bigDecimal.compareTo = function (number1, number2) { | ||
number2 = bigDecimal.validate(number2); | ||
return compareTo_1.compareTo(number1, number2); | ||
return (0, compareTo_1.compareTo)(number1, number2); | ||
}; | ||
bigDecimal.prototype.compareTo = function (number) { | ||
return compareTo_1.compareTo(this.value, number.getValue()); | ||
return (0, compareTo_1.compareTo)(this.value, number.getValue()); | ||
}; | ||
bigDecimal.negate = function (number) { | ||
number = bigDecimal.validate(number); | ||
return subtract_1.negate(number); | ||
return (0, subtract_1.negate)(number); | ||
}; | ||
bigDecimal.prototype.negate = function () { | ||
return new bigDecimal(subtract_1.negate(this.value)); | ||
return new bigDecimal((0, subtract_1.negate)(this.value)); | ||
}; | ||
@@ -352,3 +352,3 @@ bigDecimal.RoundingModes = roundingModes_1.RoundingModes; | ||
} | ||
_a = add_1.pad(number1, number2), number1 = _a[0], number2 = _a[1]; | ||
_a = (0, add_1.pad)(number1, number2), number1 = _a[0], number2 = _a[1]; | ||
if (number1.localeCompare(number2) == 0) { | ||
@@ -415,7 +415,7 @@ return 0; | ||
var pt_dvsr = divisor.indexOf('.') > 0 ? divisor.length - divisor.indexOf('.') - 1 : -1; | ||
divisor = add_1.trim(divisor.replace('.', '')); | ||
divisor = (0, add_1.trim)(divisor.replace('.', '')); | ||
if (pt_dvsr >= 0) { | ||
var pt_dvnd = dividend.indexOf('.') > 0 ? dividend.length - dividend.indexOf('.') - 1 : -1; | ||
if (pt_dvnd == -1) { | ||
dividend = add_1.trim(dividend + (new Array(pt_dvsr + 1)).join('0')); | ||
dividend = (0, add_1.trim)(dividend + (new Array(pt_dvsr + 1)).join('0')); | ||
} | ||
@@ -425,3 +425,3 @@ else { | ||
dividend = dividend.replace('.', ''); | ||
dividend = add_1.trim(dividend + (new Array(pt_dvsr - pt_dvnd + 1)).join('0')); | ||
dividend = (0, add_1.trim)(dividend + (new Array(pt_dvsr - pt_dvnd + 1)).join('0')); | ||
} | ||
@@ -431,6 +431,6 @@ else if (pt_dvsr < pt_dvnd) { | ||
var loc = dividend.length - pt_dvnd + pt_dvsr; | ||
dividend = add_1.trim(dividend.substring(0, loc) + '.' + dividend.substring(loc)); | ||
dividend = (0, add_1.trim)(dividend.substring(0, loc) + '.' + dividend.substring(loc)); | ||
} | ||
else if (pt_dvsr == pt_dvnd) { | ||
dividend = add_1.trim(dividend.replace('.', '')); | ||
dividend = (0, add_1.trim)(dividend.replace('.', '')); | ||
} | ||
@@ -456,3 +456,3 @@ } | ||
while (parseInt(dvnd) >= parseInt(divisor)) { | ||
dvnd = add_1.add(dvnd, '-' + divisor); | ||
dvnd = (0, add_1.add)(dvnd, '-' + divisor); | ||
qt++; | ||
@@ -477,3 +477,3 @@ } | ||
} | ||
return ((neg == 1) ? '-' : '') + add_1.trim(round_1.roundOff(quotent, precission - 2)); | ||
return ((neg == 1) ? '-' : '') + (0, add_1.trim)((0, round_1.roundOff)(quotent, precission - 2)); | ||
} | ||
@@ -512,3 +512,3 @@ exports.divide = divide; | ||
} | ||
var result = subtract_1.subtract(dividend, multiply_1.multiply(divisor, round_1.roundOff(divide_1.divide(dividend, divisor), 0, roundingModes_1.RoundingModes.FLOOR))); | ||
var result = (0, subtract_1.subtract)(dividend, (0, multiply_1.multiply)(divisor, (0, round_1.roundOff)((0, divide_1.divide)(dividend, divisor), 0, roundingModes_1.RoundingModes.FLOOR))); | ||
return sign + result; | ||
@@ -655,3 +655,3 @@ } | ||
} | ||
if (typeof (input) == 'number') | ||
if (typeof (input) == 'number' || typeof (input) == 'bigint') | ||
input = input.toString(); | ||
@@ -813,3 +813,3 @@ var neg = false; | ||
number2 = negate(number2); | ||
return add_1.add(number1, number2); | ||
return (0, add_1.add)(number1, number2); | ||
} | ||
@@ -816,0 +816,0 @@ exports.subtract = subtract; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.bigDecimal=t():e.bigDecimal=t()}(global,(function(){return(()=>{"use strict";var e={217:(e,t)=>{function n(e){for(var t="",n=e.length,r=e.split(".")[1],i=r?r.length:0,u=0;u<n;u++)e[u]>="0"&&e[u]<="9"?t+=9-parseInt(e[u]):t+=e[u];return o(t,i>0?"0."+new Array(i).join("0")+"1":"1")}function r(e){var t=e.split(".");for(t[0]||(t[0]="0");"0"==t[0][0]&&t[0].length>1;)t[0]=t[0].substring(1);return t[0]+(t[1]?"."+t[1]:"")}function i(e,t){var n=e.split("."),r=t.split("."),i=n[0].length,o=r[0].length;return i>o?r[0]=new Array(Math.abs(i-o)+1).join("0")+(r[0]?r[0]:""):n[0]=new Array(Math.abs(i-o)+1).join("0")+(n[0]?n[0]:""),i=n[1]?n[1].length:0,o=r[1]?r[1].length:0,(i||o)&&(i>o?r[1]=(r[1]?r[1]:"")+new Array(Math.abs(i-o)+1).join("0"):n[1]=(n[1]?n[1]:"")+new Array(Math.abs(i-o)+1).join("0")),[e=n[0]+(n[1]?"."+n[1]:""),t=r[0]+(r[1]?"."+r[1]:"")]}function o(e,t){var n;e=(n=i(e,t))[0],t=n[1];for(var r="",o=0,u=e.length-1;u>=0;u--)if("."!==e[u]){var a=parseInt(e[u])+parseInt(t[u])+o;r=a%10+r,o=Math.floor(a/10)}else r="."+r;return o?o.toString()+r:r}Object.defineProperty(t,"__esModule",{value:!0}),t.pad=t.trim=t.add=void 0,t.add=function(e,t){var u;void 0===t&&(t="0");var a=0,s=-1;"-"==e[0]&&(a++,s=1,(e=e.substring(1)).length),"-"==t[0]&&(a++,s=2,(t=t.substring(1)).length),e=r(e),t=r(t),e=(u=i(r(e),r(t)))[0],t=u[1],1==a&&(1==s?e=n(e):t=n(t));var d=o(e,t);return a?2==a?"-"+r(d):e.length<d.length?r(d.substring(1)):"-"+r(n(d)):r(d)},t.trim=r,t.pad=i},423:(e,t,n)=>{var r=n(217),i=n(350),o=n(182),u=n(415),a=n(213),s=n(664),d=n(26),l=n(916),f=function(){function e(t){void 0===t&&(t="0"),this.value=e.validate(t)}return e.validate=function(e){if(e){if(e=e.toString(),isNaN(e))throw Error("Parameter is not a number: "+e);"+"==e[0]&&(e=e.substring(1))}else e="0";if(e.startsWith(".")?e="0"+e:e.startsWith("-.")&&(e="-0"+e.substr(1)),/e/i.test(e)){var t=e.split(/[eE]/),n=t[0],i=t[1],o="";"-"==(n=r.trim(n))[0]&&(o="-",n=n.substring(1)),n.indexOf(".")>=0?(i=parseInt(i)+n.indexOf("."),n=n.replace(".","")):i=parseInt(i)+n.length,e=n.length<i?o+n+new Array(i-n.length+1).join("0"):n.length>=i&&i>0?o+r.trim(n.substring(0,i))+(n.length>i?"."+n.substring(i):""):o+"0."+new Array(1-i).join("0")+n}return e},e.prototype.getValue=function(){return this.value},e.getPrettyValue=function(t,n,r){if(n||r){if(!n||!r)throw Error("Illegal Arguments. Should pass both digits and separator or pass none")}else n=3,r=",";var i="-"==(t=e.validate(t)).charAt(0);i&&(t=t.substring(1));for(var o=t.indexOf("."),u="",a=o=o>0?o:t.length;a>0;)a<n?(n=a,a=0):a-=n,u=t.substring(a,a+n)+(a<o-n&&a>=0?r:"")+u;return(i?"-":"")+u+t.substring(o)},e.prototype.getPrettyValue=function(t,n){return e.getPrettyValue(this.value,t,n)},e.round=function(t,n,r){if(void 0===n&&(n=0),void 0===r&&(r=l.RoundingModes.HALF_EVEN),t=e.validate(t),isNaN(n))throw Error("Precision is not a number: "+n);return i.roundOff(t,n,r)},e.prototype.round=function(t,n){if(void 0===t&&(t=0),void 0===n&&(n=l.RoundingModes.HALF_EVEN),isNaN(t))throw Error("Precision is not a number: "+t);return new e(i.roundOff(this.value,t,n))},e.floor=function(t){return-1===(t=e.validate(t)).indexOf(".")?t:e.round(t,0,l.RoundingModes.FLOOR)},e.prototype.floor=function(){return-1===this.value.indexOf(".")?new e(this.value):new e(this.value).round(0,l.RoundingModes.FLOOR)},e.ceil=function(t){return-1===(t=e.validate(t)).indexOf(".")?t:e.round(t,0,l.RoundingModes.CEILING)},e.prototype.ceil=function(){return-1===this.value.indexOf(".")?new e(this.value):new e(this.value).round(0,l.RoundingModes.CEILING)},e.add=function(t,n){return t=e.validate(t),n=e.validate(n),r.add(t,n)},e.prototype.add=function(t){return new e(r.add(this.value,t.getValue()))},e.subtract=function(t,n){return t=e.validate(t),n=e.validate(n),d.subtract(t,n)},e.prototype.subtract=function(t){return new e(d.subtract(this.value,t.getValue()))},e.multiply=function(t,n){return t=e.validate(t),n=e.validate(n),o.multiply(t,n)},e.prototype.multiply=function(t){return new e(o.multiply(this.value,t.getValue()))},e.divide=function(t,n,r){return t=e.validate(t),n=e.validate(n),u.divide(t,n,r)},e.prototype.divide=function(t,n){return new e(u.divide(this.value,t.getValue(),n))},e.modulus=function(t,n){return t=e.validate(t),n=e.validate(n),a.modulus(t,n)},e.prototype.modulus=function(t){return new e(a.modulus(this.value,t.getValue()))},e.compareTo=function(t,n){return t=e.validate(t),n=e.validate(n),s.compareTo(t,n)},e.prototype.compareTo=function(e){return s.compareTo(this.value,e.getValue())},e.negate=function(t){return t=e.validate(t),d.negate(t)},e.prototype.negate=function(){return new e(d.negate(this.value))},e.RoundingModes=l.RoundingModes,e}();e.exports=f},664:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.compareTo=void 0;var r=n(217);t.compareTo=function(e,t){var n,i=!1;if("-"==e[0]&&"-"!=t[0])return-1;if("-"!=e[0]&&"-"==t[0])return 1;if("-"==e[0]&&"-"==t[0]&&(e=e.substr(1),t=t.substr(1),i=!0),e=(n=r.pad(e,t))[0],t=n[1],0==e.localeCompare(t))return 0;for(var o=0;o<e.length;o++)if(e[o]!=t[o])return e[o]>t[o]?i?-1:1:i?1:-1;return 0}},415:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.divide=void 0;var r=n(217),i=n(350);t.divide=function(e,t,n){if(void 0===n&&(n=8),0==t)throw new Error("Cannot divide by 0");if(e=e.toString(),t=t.toString(),e=e.replace(/(\.\d*?[1-9])0+$/g,"$1").replace(/\.0+$/,""),t=t.replace(/(\.\d*?[1-9])0+$/g,"$1").replace(/\.0+$/,""),0==e)return"0";var o=0;"-"==t[0]&&(t=t.substring(1),o++),"-"==e[0]&&(e=e.substring(1),o++);var u=t.indexOf(".")>0?t.length-t.indexOf(".")-1:-1;if(t=r.trim(t.replace(".","")),u>=0){var a=e.indexOf(".")>0?e.length-e.indexOf(".")-1:-1;if(-1==a)e=r.trim(e+new Array(u+1).join("0"));else if(u>a)e=e.replace(".",""),e=r.trim(e+new Array(u-a+1).join("0"));else if(u<a){var s=(e=e.replace(".","")).length-a+u;e=r.trim(e.substring(0,s)+"."+e.substring(s))}else u==a&&(e=r.trim(e.replace(".","")))}var d=0,l=t.length,f="",g=e.indexOf(".")>-1&&e.indexOf(".")<l?e.substring(0,l+1):e.substring(0,l);if(e=e.indexOf(".")>-1&&e.indexOf(".")<l?e.substring(l+1):e.substring(l),g.indexOf(".")>-1){var v=g.length-g.indexOf(".")-1;l>(g=g.replace(".","")).length&&(v+=l-g.length,g+=new Array(l-g.length+1).join("0")),d=v,f="0."+new Array(v).join("0")}for(n+=2;d<=n;){for(var p=0;parseInt(g)>=parseInt(t);)g=r.add(g,"-"+t),p++;f+=p,e?("."==e[0]&&(f+=".",d++,e=e.substring(1)),g+=e.substring(0,1),e=e.substring(1)):(d||(f+="."),d++,g+="0")}return(1==o?"-":"")+r.trim(i.roundOff(f,n-2))}},213:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.modulus=void 0;var r=n(415),i=n(350),o=n(182),u=n(26),a=n(916);function s(e){if(-1!=e.indexOf("."))throw new Error("Modulus of non-integers not supported")}t.modulus=function(e,t){if(0==t)throw new Error("Cannot divide by 0");e=e.toString(),t=t.toString(),s(e),s(t);var n="";return"-"==e[0]&&(n="-",e=e.substr(1)),"-"==t[0]&&(t=t.substr(1)),n+u.subtract(e,o.multiply(t,i.roundOff(r.divide(e,t),0,a.RoundingModes.FLOOR)))}},182:(e,t)=>{function n(e){for(;"0"==e[0];)e=e.substr(1);if(-1!=e.indexOf("."))for(;"0"==e[e.length-1];)e=e.substr(0,e.length-1);return""==e||"."==e?e="0":"."==e[e.length-1]&&(e=e.substr(0,e.length-1)),"."==e[0]&&(e="0"+e),e}Object.defineProperty(t,"__esModule",{value:!0}),t.multiply=void 0,t.multiply=function(e,t){e=e.toString(),t=t.toString();var r=0;"-"==e[0]&&(r++,e=e.substr(1)),"-"==t[0]&&(r++,t=t.substr(1)),e=n(e),t=n(t);var i=0,o=0;-1!=e.indexOf(".")&&(i=e.length-e.indexOf(".")-1),-1!=t.indexOf(".")&&(o=t.length-t.indexOf(".")-1);var u=i+o;if(e=n(e.replace(".","")),t=n(t.replace(".","")),e.length<t.length){var a=e;e=t,t=a}if("0"==t)return"0";for(var s,d,l=t.length,f=0,g=[],v=l-1,p="",c=0;c<l;c++)g[c]=e.length-1;for(c=0;c<2*e.length;c++){for(var h=0,b=t.length-1;b>=v&&b>=0;b--)g[b]>-1&&g[b]<e.length&&(h+=parseInt(e[g[b]--])*parseInt(t[b]));h+=f,f=Math.floor(h/10),p=h%10+p,v--}return p=n((s=p,0==(d=u)?s:(s=d>=s.length?new Array(d-s.length+1).join("0")+s:s).substr(0,s.length-d)+"."+s.substr(s.length-d,d))),1==r&&(p="-"+p),p}},350:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.roundOff=void 0;var r=n(916);function i(e,t,n,i){if(!e||e===new Array(e.length+1).join("0"))return!1;if(i===r.RoundingModes.DOWN||!n&&i===r.RoundingModes.FLOOR||n&&i===r.RoundingModes.CEILING)return!1;if(i===r.RoundingModes.UP||n&&i===r.RoundingModes.FLOOR||!n&&i===r.RoundingModes.CEILING)return!0;var o="5"+new Array(e.length).join("0");if(e>o)return!0;if(e<o)return!1;switch(i){case r.RoundingModes.HALF_DOWN:return!1;case r.RoundingModes.HALF_UP:return!0;case r.RoundingModes.HALF_EVEN:default:return parseInt(t[t.length-1])%2==1}}function o(e,t){void 0===t&&(t=0),t||(t=1),"number"==typeof e&&e.toString();for(var n="",r=e.length-1;r>=0;r--){var i=parseInt(e[r])+t;10==i?(t=1,i=0):t=0,n+=i}return t&&(n+=t),n.split("").reverse().join("")}t.roundOff=function e(t,n,u){if(void 0===n&&(n=0),void 0===u&&(u=r.RoundingModes.HALF_EVEN),u===r.RoundingModes.UNNECESSARY)throw new Error("UNNECESSARY Rounding Mode has not yet been implemented");"number"==typeof t&&(t=t.toString());var a=!1;"-"===t[0]&&(a=!0,t=t.substring(1));var s=t.split("."),d=s[0],l=s[1];if(n<0){if(n=-n,d.length<=n)return"0";var f=d.substr(0,d.length-n);return(a?"-":"")+(f=e(t=f+"."+d.substr(d.length-n)+l,0,u))+new Array(n+1).join("0")}if(0==n){d.length;return i(s[1],d,a,u)?(a?"-":"")+o(d):(a?"-":"")+d}if(!s[1])return(a?"-":"")+d+"."+new Array(n+1).join("0");if(s[1].length<n)return(a?"-":"")+d+"."+s[1]+new Array(n-s[1].length+1).join("0");l=s[1].substring(0,n);var g=s[1].substring(n);return g&&i(g,l,a,u)&&(l=o(l)).length>n?(a?"-":"")+o(d,parseInt(l[0]))+"."+l.substring(1):(a?"-":"")+d+"."+l}},916:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RoundingModes=void 0,function(e){e[e.CEILING=0]="CEILING",e[e.DOWN=1]="DOWN",e[e.FLOOR=2]="FLOOR",e[e.HALF_DOWN=3]="HALF_DOWN",e[e.HALF_EVEN=4]="HALF_EVEN",e[e.HALF_UP=5]="HALF_UP",e[e.UNNECESSARY=6]="UNNECESSARY",e[e.UP=7]="UP"}(t.RoundingModes||(t.RoundingModes={}))},26:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.negate=t.subtract=void 0;var r=n(217);function i(e){return e="-"==e[0]?e.substr(1):"-"+e}t.subtract=function(e,t){return e=e.toString(),t=i(t=t.toString()),r.add(e,t)},t.negate=i}},t={};return function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}(423)})()})); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.bigDecimal=t():e.bigDecimal=t()}(global,(()=>(()=>{"use strict";var e={217:(e,t)=>{function n(e){for(var t="",n=e.length,r=e.split(".")[1],i=r?r.length:0,u=0;u<n;u++)e[u]>="0"&&e[u]<="9"?t+=9-parseInt(e[u]):t+=e[u];return o(t,i>0?"0."+new Array(i).join("0")+"1":"1")}function r(e){var t=e.split(".");for(t[0]||(t[0]="0");"0"==t[0][0]&&t[0].length>1;)t[0]=t[0].substring(1);return t[0]+(t[1]?"."+t[1]:"")}function i(e,t){var n=e.split("."),r=t.split("."),i=n[0].length,o=r[0].length;return i>o?r[0]=new Array(Math.abs(i-o)+1).join("0")+(r[0]?r[0]:""):n[0]=new Array(Math.abs(i-o)+1).join("0")+(n[0]?n[0]:""),i=n[1]?n[1].length:0,o=r[1]?r[1].length:0,(i||o)&&(i>o?r[1]=(r[1]?r[1]:"")+new Array(Math.abs(i-o)+1).join("0"):n[1]=(n[1]?n[1]:"")+new Array(Math.abs(i-o)+1).join("0")),[e=n[0]+(n[1]?"."+n[1]:""),t=r[0]+(r[1]?"."+r[1]:"")]}function o(e,t){var n;e=(n=i(e,t))[0],t=n[1];for(var r="",o=0,u=e.length-1;u>=0;u--)if("."!==e[u]){var a=parseInt(e[u])+parseInt(t[u])+o;r=a%10+r,o=Math.floor(a/10)}else r="."+r;return o?o.toString()+r:r}Object.defineProperty(t,"__esModule",{value:!0}),t.pad=t.trim=t.add=void 0,t.add=function(e,t){var u;void 0===t&&(t="0");var a=0,s=-1;"-"==e[0]&&(a++,s=1,(e=e.substring(1)).length),"-"==t[0]&&(a++,s=2,(t=t.substring(1)).length),e=r(e),t=r(t),e=(u=i(r(e),r(t)))[0],t=u[1],1==a&&(1==s?e=n(e):t=n(t));var d=o(e,t);return a?2==a?"-"+r(d):e.length<d.length?r(d.substring(1)):"-"+r(n(d)):r(d)},t.trim=r,t.pad=i},423:(e,t,n)=>{var r=n(217),i=n(350),o=n(182),u=n(415),a=n(213),s=n(664),d=n(26),l=n(916),f=function(){function e(t){void 0===t&&(t="0"),this.value=e.validate(t)}return e.validate=function(e){if(e){if(e=e.toString(),isNaN(e))throw Error("Parameter is not a number: "+e);"+"==e[0]&&(e=e.substring(1))}else e="0";if(e.startsWith(".")?e="0"+e:e.startsWith("-.")&&(e="-0"+e.substr(1)),/e/i.test(e)){var t=e.split(/[eE]/),n=t[0],i=t[1],o="";"-"==(n=(0,r.trim)(n))[0]&&(o="-",n=n.substring(1)),n.indexOf(".")>=0?(i=parseInt(i)+n.indexOf("."),n=n.replace(".","")):i=parseInt(i)+n.length,e=n.length<i?o+n+new Array(i-n.length+1).join("0"):n.length>=i&&i>0?o+(0,r.trim)(n.substring(0,i))+(n.length>i?"."+n.substring(i):""):o+"0."+new Array(1-i).join("0")+n}return e},e.prototype.getValue=function(){return this.value},e.getPrettyValue=function(t,n,r){if(n||r){if(!n||!r)throw Error("Illegal Arguments. Should pass both digits and separator or pass none")}else n=3,r=",";var i="-"==(t=e.validate(t)).charAt(0);i&&(t=t.substring(1));for(var o=t.indexOf("."),u="",a=o=o>0?o:t.length;a>0;)a<n?(n=a,a=0):a-=n,u=t.substring(a,a+n)+(a<o-n&&a>=0?r:"")+u;return(i?"-":"")+u+t.substring(o)},e.prototype.getPrettyValue=function(t,n){return e.getPrettyValue(this.value,t,n)},e.round=function(t,n,r){if(void 0===n&&(n=0),void 0===r&&(r=l.RoundingModes.HALF_EVEN),t=e.validate(t),isNaN(n))throw Error("Precision is not a number: "+n);return(0,i.roundOff)(t,n,r)},e.prototype.round=function(t,n){if(void 0===t&&(t=0),void 0===n&&(n=l.RoundingModes.HALF_EVEN),isNaN(t))throw Error("Precision is not a number: "+t);return new e((0,i.roundOff)(this.value,t,n))},e.floor=function(t){return-1===(t=e.validate(t)).indexOf(".")?t:e.round(t,0,l.RoundingModes.FLOOR)},e.prototype.floor=function(){return-1===this.value.indexOf(".")?new e(this.value):new e(this.value).round(0,l.RoundingModes.FLOOR)},e.ceil=function(t){return-1===(t=e.validate(t)).indexOf(".")?t:e.round(t,0,l.RoundingModes.CEILING)},e.prototype.ceil=function(){return-1===this.value.indexOf(".")?new e(this.value):new e(this.value).round(0,l.RoundingModes.CEILING)},e.add=function(t,n){return t=e.validate(t),n=e.validate(n),(0,r.add)(t,n)},e.prototype.add=function(t){return new e((0,r.add)(this.value,t.getValue()))},e.subtract=function(t,n){return t=e.validate(t),n=e.validate(n),(0,d.subtract)(t,n)},e.prototype.subtract=function(t){return new e((0,d.subtract)(this.value,t.getValue()))},e.multiply=function(t,n){return t=e.validate(t),n=e.validate(n),(0,o.multiply)(t,n)},e.prototype.multiply=function(t){return new e((0,o.multiply)(this.value,t.getValue()))},e.divide=function(t,n,r){return t=e.validate(t),n=e.validate(n),(0,u.divide)(t,n,r)},e.prototype.divide=function(t,n){return new e((0,u.divide)(this.value,t.getValue(),n))},e.modulus=function(t,n){return t=e.validate(t),n=e.validate(n),(0,a.modulus)(t,n)},e.prototype.modulus=function(t){return new e((0,a.modulus)(this.value,t.getValue()))},e.compareTo=function(t,n){return t=e.validate(t),n=e.validate(n),(0,s.compareTo)(t,n)},e.prototype.compareTo=function(e){return(0,s.compareTo)(this.value,e.getValue())},e.negate=function(t){return t=e.validate(t),(0,d.negate)(t)},e.prototype.negate=function(){return new e((0,d.negate)(this.value))},e.RoundingModes=l.RoundingModes,e}();e.exports=f},664:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.compareTo=void 0;var r=n(217);t.compareTo=function(e,t){var n,i=!1;if("-"==e[0]&&"-"!=t[0])return-1;if("-"!=e[0]&&"-"==t[0])return 1;if("-"==e[0]&&"-"==t[0]&&(e=e.substr(1),t=t.substr(1),i=!0),e=(n=(0,r.pad)(e,t))[0],t=n[1],0==e.localeCompare(t))return 0;for(var o=0;o<e.length;o++)if(e[o]!=t[o])return e[o]>t[o]?i?-1:1:i?1:-1;return 0}},415:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.divide=void 0;var r=n(217),i=n(350);t.divide=function(e,t,n){if(void 0===n&&(n=8),0==t)throw new Error("Cannot divide by 0");if(e=e.toString(),t=t.toString(),e=e.replace(/(\.\d*?[1-9])0+$/g,"$1").replace(/\.0+$/,""),t=t.replace(/(\.\d*?[1-9])0+$/g,"$1").replace(/\.0+$/,""),0==e)return"0";var o=0;"-"==t[0]&&(t=t.substring(1),o++),"-"==e[0]&&(e=e.substring(1),o++);var u=t.indexOf(".")>0?t.length-t.indexOf(".")-1:-1;if(t=(0,r.trim)(t.replace(".","")),u>=0){var a=e.indexOf(".")>0?e.length-e.indexOf(".")-1:-1;if(-1==a)e=(0,r.trim)(e+new Array(u+1).join("0"));else if(u>a)e=e.replace(".",""),e=(0,r.trim)(e+new Array(u-a+1).join("0"));else if(u<a){var s=(e=e.replace(".","")).length-a+u;e=(0,r.trim)(e.substring(0,s)+"."+e.substring(s))}else u==a&&(e=(0,r.trim)(e.replace(".","")))}var d=0,l=t.length,f="",g=e.indexOf(".")>-1&&e.indexOf(".")<l?e.substring(0,l+1):e.substring(0,l);if(e=e.indexOf(".")>-1&&e.indexOf(".")<l?e.substring(l+1):e.substring(l),g.indexOf(".")>-1){var v=g.length-g.indexOf(".")-1;l>(g=g.replace(".","")).length&&(v+=l-g.length,g+=new Array(l-g.length+1).join("0")),d=v,f="0."+new Array(v).join("0")}for(n+=2;d<=n;){for(var p=0;parseInt(g)>=parseInt(t);)g=(0,r.add)(g,"-"+t),p++;f+=p,e?("."==e[0]&&(f+=".",d++,e=e.substring(1)),g+=e.substring(0,1),e=e.substring(1)):(d||(f+="."),d++,g+="0")}return(1==o?"-":"")+(0,r.trim)((0,i.roundOff)(f,n-2))}},213:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.modulus=void 0;var r=n(415),i=n(350),o=n(182),u=n(26),a=n(916);function s(e){if(-1!=e.indexOf("."))throw new Error("Modulus of non-integers not supported")}t.modulus=function(e,t){if(0==t)throw new Error("Cannot divide by 0");e=e.toString(),t=t.toString(),s(e),s(t);var n="";return"-"==e[0]&&(n="-",e=e.substr(1)),"-"==t[0]&&(t=t.substr(1)),n+(0,u.subtract)(e,(0,o.multiply)(t,(0,i.roundOff)((0,r.divide)(e,t),0,a.RoundingModes.FLOOR)))}},182:(e,t)=>{function n(e){for(;"0"==e[0];)e=e.substr(1);if(-1!=e.indexOf("."))for(;"0"==e[e.length-1];)e=e.substr(0,e.length-1);return""==e||"."==e?e="0":"."==e[e.length-1]&&(e=e.substr(0,e.length-1)),"."==e[0]&&(e="0"+e),e}Object.defineProperty(t,"__esModule",{value:!0}),t.multiply=void 0,t.multiply=function(e,t){e=e.toString(),t=t.toString();var r=0;"-"==e[0]&&(r++,e=e.substr(1)),"-"==t[0]&&(r++,t=t.substr(1)),e=n(e),t=n(t);var i=0,o=0;-1!=e.indexOf(".")&&(i=e.length-e.indexOf(".")-1),-1!=t.indexOf(".")&&(o=t.length-t.indexOf(".")-1);var u=i+o;if(e=n(e.replace(".","")),t=n(t.replace(".","")),e.length<t.length){var a=e;e=t,t=a}if("0"==t)return"0";for(var s,d,l=t.length,f=0,g=[],v=l-1,p="",c=0;c<l;c++)g[c]=e.length-1;for(c=0;c<2*e.length;c++){for(var h=0,b=t.length-1;b>=v&&b>=0;b--)g[b]>-1&&g[b]<e.length&&(h+=parseInt(e[g[b]--])*parseInt(t[b]));h+=f,f=Math.floor(h/10),p=h%10+p,v--}return p=n((s=p,0==(d=u)?s:(s=d>=s.length?new Array(d-s.length+1).join("0")+s:s).substr(0,s.length-d)+"."+s.substr(s.length-d,d))),1==r&&(p="-"+p),p}},350:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.roundOff=void 0;var r=n(916);function i(e,t,n,i){if(!e||e===new Array(e.length+1).join("0"))return!1;if(i===r.RoundingModes.DOWN||!n&&i===r.RoundingModes.FLOOR||n&&i===r.RoundingModes.CEILING)return!1;if(i===r.RoundingModes.UP||n&&i===r.RoundingModes.FLOOR||!n&&i===r.RoundingModes.CEILING)return!0;var o="5"+new Array(e.length).join("0");if(e>o)return!0;if(e<o)return!1;switch(i){case r.RoundingModes.HALF_DOWN:return!1;case r.RoundingModes.HALF_UP:return!0;case r.RoundingModes.HALF_EVEN:default:return parseInt(t[t.length-1])%2==1}}function o(e,t){void 0===t&&(t=0),t||(t=1),"number"==typeof e&&e.toString();for(var n="",r=e.length-1;r>=0;r--){var i=parseInt(e[r])+t;10==i?(t=1,i=0):t=0,n+=i}return t&&(n+=t),n.split("").reverse().join("")}t.roundOff=function e(t,n,u){if(void 0===n&&(n=0),void 0===u&&(u=r.RoundingModes.HALF_EVEN),u===r.RoundingModes.UNNECESSARY)throw new Error("UNNECESSARY Rounding Mode has not yet been implemented");"number"!=typeof t&&"bigint"!=typeof t||(t=t.toString());var a=!1;"-"===t[0]&&(a=!0,t=t.substring(1));var s=t.split("."),d=s[0],l=s[1];if(n<0){if(n=-n,d.length<=n)return"0";var f=d.substr(0,d.length-n);return(a?"-":"")+(f=e(t=f+"."+d.substr(d.length-n)+l,0,u))+new Array(n+1).join("0")}if(0==n){d.length;return i(s[1],d,a,u)?(a?"-":"")+o(d):(a?"-":"")+d}if(!s[1])return(a?"-":"")+d+"."+new Array(n+1).join("0");if(s[1].length<n)return(a?"-":"")+d+"."+s[1]+new Array(n-s[1].length+1).join("0");l=s[1].substring(0,n);var g=s[1].substring(n);return g&&i(g,l,a,u)&&(l=o(l)).length>n?(a?"-":"")+o(d,parseInt(l[0]))+"."+l.substring(1):(a?"-":"")+d+"."+l}},916:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RoundingModes=void 0,function(e){e[e.CEILING=0]="CEILING",e[e.DOWN=1]="DOWN",e[e.FLOOR=2]="FLOOR",e[e.HALF_DOWN=3]="HALF_DOWN",e[e.HALF_EVEN=4]="HALF_EVEN",e[e.HALF_UP=5]="HALF_UP",e[e.UNNECESSARY=6]="UNNECESSARY",e[e.UP=7]="UP"}(t.RoundingModes||(t.RoundingModes={}))},26:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.negate=t.subtract=void 0;var r=n(217);function i(e){return e="-"==e[0]?e.substr(1):"-"+e}t.subtract=function(e,t){return e=e.toString(),t=i(t=t.toString()),(0,r.add)(e,t)},t.negate=i}},t={};var n=function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}(423);return n})())); |
@@ -152,3 +152,3 @@ var bigDecimal; | ||
var _a = number.split(/[eE]/), mantisa = _a[0], exponent = _a[1]; | ||
mantisa = add_1.trim(mantisa); | ||
mantisa = (0, add_1.trim)(mantisa); | ||
var sign = ''; | ||
@@ -170,3 +170,3 @@ if (mantisa[0] == '-') { | ||
else if (mantisa.length >= exponent && exponent > 0) { | ||
number = sign + add_1.trim(mantisa.substring(0, exponent)) + | ||
number = sign + (0, add_1.trim)(mantisa.substring(0, exponent)) + | ||
((mantisa.length > exponent) ? ('.' + mantisa.substring(exponent)) : ''); | ||
@@ -219,3 +219,3 @@ } | ||
throw Error("Precision is not a number: " + precision); | ||
return round_1.roundOff(number, precision, mode); | ||
return (0, round_1.roundOff)(number, precision, mode); | ||
}; | ||
@@ -227,3 +227,3 @@ bigDecimal.prototype.round = function (precision, mode) { | ||
throw Error("Precision is not a number: " + precision); | ||
return new bigDecimal(round_1.roundOff(this.value, precision, mode)); | ||
return new bigDecimal((0, round_1.roundOff)(this.value, precision, mode)); | ||
}; | ||
@@ -255,6 +255,6 @@ bigDecimal.floor = function (number) { | ||
number2 = bigDecimal.validate(number2); | ||
return add_1.add(number1, number2); | ||
return (0, add_1.add)(number1, number2); | ||
}; | ||
bigDecimal.prototype.add = function (number) { | ||
return new bigDecimal(add_1.add(this.value, number.getValue())); | ||
return new bigDecimal((0, add_1.add)(this.value, number.getValue())); | ||
}; | ||
@@ -264,6 +264,6 @@ bigDecimal.subtract = function (number1, number2) { | ||
number2 = bigDecimal.validate(number2); | ||
return subtract_1.subtract(number1, number2); | ||
return (0, subtract_1.subtract)(number1, number2); | ||
}; | ||
bigDecimal.prototype.subtract = function (number) { | ||
return new bigDecimal(subtract_1.subtract(this.value, number.getValue())); | ||
return new bigDecimal((0, subtract_1.subtract)(this.value, number.getValue())); | ||
}; | ||
@@ -273,6 +273,6 @@ bigDecimal.multiply = function (number1, number2) { | ||
number2 = bigDecimal.validate(number2); | ||
return multiply_1.multiply(number1, number2); | ||
return (0, multiply_1.multiply)(number1, number2); | ||
}; | ||
bigDecimal.prototype.multiply = function (number) { | ||
return new bigDecimal(multiply_1.multiply(this.value, number.getValue())); | ||
return new bigDecimal((0, multiply_1.multiply)(this.value, number.getValue())); | ||
}; | ||
@@ -282,6 +282,6 @@ bigDecimal.divide = function (number1, number2, precision) { | ||
number2 = bigDecimal.validate(number2); | ||
return divide_1.divide(number1, number2, precision); | ||
return (0, divide_1.divide)(number1, number2, precision); | ||
}; | ||
bigDecimal.prototype.divide = function (number, precision) { | ||
return new bigDecimal(divide_1.divide(this.value, number.getValue(), precision)); | ||
return new bigDecimal((0, divide_1.divide)(this.value, number.getValue(), precision)); | ||
}; | ||
@@ -291,6 +291,6 @@ bigDecimal.modulus = function (number1, number2) { | ||
number2 = bigDecimal.validate(number2); | ||
return modulus_1.modulus(number1, number2); | ||
return (0, modulus_1.modulus)(number1, number2); | ||
}; | ||
bigDecimal.prototype.modulus = function (number) { | ||
return new bigDecimal(modulus_1.modulus(this.value, number.getValue())); | ||
return new bigDecimal((0, modulus_1.modulus)(this.value, number.getValue())); | ||
}; | ||
@@ -300,13 +300,13 @@ bigDecimal.compareTo = function (number1, number2) { | ||
number2 = bigDecimal.validate(number2); | ||
return compareTo_1.compareTo(number1, number2); | ||
return (0, compareTo_1.compareTo)(number1, number2); | ||
}; | ||
bigDecimal.prototype.compareTo = function (number) { | ||
return compareTo_1.compareTo(this.value, number.getValue()); | ||
return (0, compareTo_1.compareTo)(this.value, number.getValue()); | ||
}; | ||
bigDecimal.negate = function (number) { | ||
number = bigDecimal.validate(number); | ||
return subtract_1.negate(number); | ||
return (0, subtract_1.negate)(number); | ||
}; | ||
bigDecimal.prototype.negate = function () { | ||
return new bigDecimal(subtract_1.negate(this.value)); | ||
return new bigDecimal((0, subtract_1.negate)(this.value)); | ||
}; | ||
@@ -342,3 +342,3 @@ bigDecimal.RoundingModes = roundingModes_1.RoundingModes; | ||
} | ||
_a = add_1.pad(number1, number2), number1 = _a[0], number2 = _a[1]; | ||
_a = (0, add_1.pad)(number1, number2), number1 = _a[0], number2 = _a[1]; | ||
if (number1.localeCompare(number2) == 0) { | ||
@@ -405,7 +405,7 @@ return 0; | ||
var pt_dvsr = divisor.indexOf('.') > 0 ? divisor.length - divisor.indexOf('.') - 1 : -1; | ||
divisor = add_1.trim(divisor.replace('.', '')); | ||
divisor = (0, add_1.trim)(divisor.replace('.', '')); | ||
if (pt_dvsr >= 0) { | ||
var pt_dvnd = dividend.indexOf('.') > 0 ? dividend.length - dividend.indexOf('.') - 1 : -1; | ||
if (pt_dvnd == -1) { | ||
dividend = add_1.trim(dividend + (new Array(pt_dvsr + 1)).join('0')); | ||
dividend = (0, add_1.trim)(dividend + (new Array(pt_dvsr + 1)).join('0')); | ||
} | ||
@@ -415,3 +415,3 @@ else { | ||
dividend = dividend.replace('.', ''); | ||
dividend = add_1.trim(dividend + (new Array(pt_dvsr - pt_dvnd + 1)).join('0')); | ||
dividend = (0, add_1.trim)(dividend + (new Array(pt_dvsr - pt_dvnd + 1)).join('0')); | ||
} | ||
@@ -421,6 +421,6 @@ else if (pt_dvsr < pt_dvnd) { | ||
var loc = dividend.length - pt_dvnd + pt_dvsr; | ||
dividend = add_1.trim(dividend.substring(0, loc) + '.' + dividend.substring(loc)); | ||
dividend = (0, add_1.trim)(dividend.substring(0, loc) + '.' + dividend.substring(loc)); | ||
} | ||
else if (pt_dvsr == pt_dvnd) { | ||
dividend = add_1.trim(dividend.replace('.', '')); | ||
dividend = (0, add_1.trim)(dividend.replace('.', '')); | ||
} | ||
@@ -446,3 +446,3 @@ } | ||
while (parseInt(dvnd) >= parseInt(divisor)) { | ||
dvnd = add_1.add(dvnd, '-' + divisor); | ||
dvnd = (0, add_1.add)(dvnd, '-' + divisor); | ||
qt++; | ||
@@ -467,3 +467,3 @@ } | ||
} | ||
return ((neg == 1) ? '-' : '') + add_1.trim(round_1.roundOff(quotent, precission - 2)); | ||
return ((neg == 1) ? '-' : '') + (0, add_1.trim)((0, round_1.roundOff)(quotent, precission - 2)); | ||
} | ||
@@ -502,3 +502,3 @@ exports.divide = divide; | ||
} | ||
var result = subtract_1.subtract(dividend, multiply_1.multiply(divisor, round_1.roundOff(divide_1.divide(dividend, divisor), 0, roundingModes_1.RoundingModes.FLOOR))); | ||
var result = (0, subtract_1.subtract)(dividend, (0, multiply_1.multiply)(divisor, (0, round_1.roundOff)((0, divide_1.divide)(dividend, divisor), 0, roundingModes_1.RoundingModes.FLOOR))); | ||
return sign + result; | ||
@@ -645,3 +645,3 @@ } | ||
} | ||
if (typeof (input) == 'number') | ||
if (typeof (input) == 'number' || typeof (input) == 'bigint') | ||
input = input.toString(); | ||
@@ -803,3 +803,3 @@ var neg = false; | ||
number2 = negate(number2); | ||
return add_1.add(number1, number2); | ||
return (0, add_1.add)(number1, number2); | ||
} | ||
@@ -806,0 +806,0 @@ exports.subtract = subtract; |
@@ -1,1 +0,1 @@ | ||
var bigDecimal;(()=>{"use strict";var e={217:(e,n)=>{function t(e){for(var n="",t=e.length,r=e.split(".")[1],i=r?r.length:0,u=0;u<t;u++)e[u]>="0"&&e[u]<="9"?n+=9-parseInt(e[u]):n+=e[u];return o(n,i>0?"0."+new Array(i).join("0")+"1":"1")}function r(e){var n=e.split(".");for(n[0]||(n[0]="0");"0"==n[0][0]&&n[0].length>1;)n[0]=n[0].substring(1);return n[0]+(n[1]?"."+n[1]:"")}function i(e,n){var t=e.split("."),r=n.split("."),i=t[0].length,o=r[0].length;return i>o?r[0]=new Array(Math.abs(i-o)+1).join("0")+(r[0]?r[0]:""):t[0]=new Array(Math.abs(i-o)+1).join("0")+(t[0]?t[0]:""),i=t[1]?t[1].length:0,o=r[1]?r[1].length:0,(i||o)&&(i>o?r[1]=(r[1]?r[1]:"")+new Array(Math.abs(i-o)+1).join("0"):t[1]=(t[1]?t[1]:"")+new Array(Math.abs(i-o)+1).join("0")),[e=t[0]+(t[1]?"."+t[1]:""),n=r[0]+(r[1]?"."+r[1]:"")]}function o(e,n){var t;e=(t=i(e,n))[0],n=t[1];for(var r="",o=0,u=e.length-1;u>=0;u--)if("."!==e[u]){var a=parseInt(e[u])+parseInt(n[u])+o;r=a%10+r,o=Math.floor(a/10)}else r="."+r;return o?o.toString()+r:r}Object.defineProperty(n,"__esModule",{value:!0}),n.pad=n.trim=n.add=void 0,n.add=function(e,n){var u;void 0===n&&(n="0");var a=0,s=-1;"-"==e[0]&&(a++,s=1,(e=e.substring(1)).length),"-"==n[0]&&(a++,s=2,(n=n.substring(1)).length),e=r(e),n=r(n),e=(u=i(r(e),r(n)))[0],n=u[1],1==a&&(1==s?e=t(e):n=t(n));var d=o(e,n);return a?2==a?"-"+r(d):e.length<d.length?r(d.substring(1)):"-"+r(t(d)):r(d)},n.trim=r,n.pad=i},423:(e,n,t)=>{var r=t(217),i=t(350),o=t(182),u=t(415),a=t(213),s=t(664),d=t(26),l=t(916),f=function(){function e(n){void 0===n&&(n="0"),this.value=e.validate(n)}return e.validate=function(e){if(e){if(e=e.toString(),isNaN(e))throw Error("Parameter is not a number: "+e);"+"==e[0]&&(e=e.substring(1))}else e="0";if(e.startsWith(".")?e="0"+e:e.startsWith("-.")&&(e="-0"+e.substr(1)),/e/i.test(e)){var n=e.split(/[eE]/),t=n[0],i=n[1],o="";"-"==(t=r.trim(t))[0]&&(o="-",t=t.substring(1)),t.indexOf(".")>=0?(i=parseInt(i)+t.indexOf("."),t=t.replace(".","")):i=parseInt(i)+t.length,e=t.length<i?o+t+new Array(i-t.length+1).join("0"):t.length>=i&&i>0?o+r.trim(t.substring(0,i))+(t.length>i?"."+t.substring(i):""):o+"0."+new Array(1-i).join("0")+t}return e},e.prototype.getValue=function(){return this.value},e.getPrettyValue=function(n,t,r){if(t||r){if(!t||!r)throw Error("Illegal Arguments. Should pass both digits and separator or pass none")}else t=3,r=",";var i="-"==(n=e.validate(n)).charAt(0);i&&(n=n.substring(1));for(var o=n.indexOf("."),u="",a=o=o>0?o:n.length;a>0;)a<t?(t=a,a=0):a-=t,u=n.substring(a,a+t)+(a<o-t&&a>=0?r:"")+u;return(i?"-":"")+u+n.substring(o)},e.prototype.getPrettyValue=function(n,t){return e.getPrettyValue(this.value,n,t)},e.round=function(n,t,r){if(void 0===t&&(t=0),void 0===r&&(r=l.RoundingModes.HALF_EVEN),n=e.validate(n),isNaN(t))throw Error("Precision is not a number: "+t);return i.roundOff(n,t,r)},e.prototype.round=function(n,t){if(void 0===n&&(n=0),void 0===t&&(t=l.RoundingModes.HALF_EVEN),isNaN(n))throw Error("Precision is not a number: "+n);return new e(i.roundOff(this.value,n,t))},e.floor=function(n){return-1===(n=e.validate(n)).indexOf(".")?n:e.round(n,0,l.RoundingModes.FLOOR)},e.prototype.floor=function(){return-1===this.value.indexOf(".")?new e(this.value):new e(this.value).round(0,l.RoundingModes.FLOOR)},e.ceil=function(n){return-1===(n=e.validate(n)).indexOf(".")?n:e.round(n,0,l.RoundingModes.CEILING)},e.prototype.ceil=function(){return-1===this.value.indexOf(".")?new e(this.value):new e(this.value).round(0,l.RoundingModes.CEILING)},e.add=function(n,t){return n=e.validate(n),t=e.validate(t),r.add(n,t)},e.prototype.add=function(n){return new e(r.add(this.value,n.getValue()))},e.subtract=function(n,t){return n=e.validate(n),t=e.validate(t),d.subtract(n,t)},e.prototype.subtract=function(n){return new e(d.subtract(this.value,n.getValue()))},e.multiply=function(n,t){return n=e.validate(n),t=e.validate(t),o.multiply(n,t)},e.prototype.multiply=function(n){return new e(o.multiply(this.value,n.getValue()))},e.divide=function(n,t,r){return n=e.validate(n),t=e.validate(t),u.divide(n,t,r)},e.prototype.divide=function(n,t){return new e(u.divide(this.value,n.getValue(),t))},e.modulus=function(n,t){return n=e.validate(n),t=e.validate(t),a.modulus(n,t)},e.prototype.modulus=function(n){return new e(a.modulus(this.value,n.getValue()))},e.compareTo=function(n,t){return n=e.validate(n),t=e.validate(t),s.compareTo(n,t)},e.prototype.compareTo=function(e){return s.compareTo(this.value,e.getValue())},e.negate=function(n){return n=e.validate(n),d.negate(n)},e.prototype.negate=function(){return new e(d.negate(this.value))},e.RoundingModes=l.RoundingModes,e}();e.exports=f},664:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.compareTo=void 0;var r=t(217);n.compareTo=function(e,n){var t,i=!1;if("-"==e[0]&&"-"!=n[0])return-1;if("-"!=e[0]&&"-"==n[0])return 1;if("-"==e[0]&&"-"==n[0]&&(e=e.substr(1),n=n.substr(1),i=!0),e=(t=r.pad(e,n))[0],n=t[1],0==e.localeCompare(n))return 0;for(var o=0;o<e.length;o++)if(e[o]!=n[o])return e[o]>n[o]?i?-1:1:i?1:-1;return 0}},415:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.divide=void 0;var r=t(217),i=t(350);n.divide=function(e,n,t){if(void 0===t&&(t=8),0==n)throw new Error("Cannot divide by 0");if(e=e.toString(),n=n.toString(),e=e.replace(/(\.\d*?[1-9])0+$/g,"$1").replace(/\.0+$/,""),n=n.replace(/(\.\d*?[1-9])0+$/g,"$1").replace(/\.0+$/,""),0==e)return"0";var o=0;"-"==n[0]&&(n=n.substring(1),o++),"-"==e[0]&&(e=e.substring(1),o++);var u=n.indexOf(".")>0?n.length-n.indexOf(".")-1:-1;if(n=r.trim(n.replace(".","")),u>=0){var a=e.indexOf(".")>0?e.length-e.indexOf(".")-1:-1;if(-1==a)e=r.trim(e+new Array(u+1).join("0"));else if(u>a)e=e.replace(".",""),e=r.trim(e+new Array(u-a+1).join("0"));else if(u<a){var s=(e=e.replace(".","")).length-a+u;e=r.trim(e.substring(0,s)+"."+e.substring(s))}else u==a&&(e=r.trim(e.replace(".","")))}var d=0,l=n.length,f="",g=e.indexOf(".")>-1&&e.indexOf(".")<l?e.substring(0,l+1):e.substring(0,l);if(e=e.indexOf(".")>-1&&e.indexOf(".")<l?e.substring(l+1):e.substring(l),g.indexOf(".")>-1){var v=g.length-g.indexOf(".")-1;l>(g=g.replace(".","")).length&&(v+=l-g.length,g+=new Array(l-g.length+1).join("0")),d=v,f="0."+new Array(v).join("0")}for(t+=2;d<=t;){for(var h=0;parseInt(g)>=parseInt(n);)g=r.add(g,"-"+n),h++;f+=h,e?("."==e[0]&&(f+=".",d++,e=e.substring(1)),g+=e.substring(0,1),e=e.substring(1)):(d||(f+="."),d++,g+="0")}return(1==o?"-":"")+r.trim(i.roundOff(f,t-2))}},213:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.modulus=void 0;var r=t(415),i=t(350),o=t(182),u=t(26),a=t(916);function s(e){if(-1!=e.indexOf("."))throw new Error("Modulus of non-integers not supported")}n.modulus=function(e,n){if(0==n)throw new Error("Cannot divide by 0");e=e.toString(),n=n.toString(),s(e),s(n);var t="";return"-"==e[0]&&(t="-",e=e.substr(1)),"-"==n[0]&&(n=n.substr(1)),t+u.subtract(e,o.multiply(n,i.roundOff(r.divide(e,n),0,a.RoundingModes.FLOOR)))}},182:(e,n)=>{function t(e){for(;"0"==e[0];)e=e.substr(1);if(-1!=e.indexOf("."))for(;"0"==e[e.length-1];)e=e.substr(0,e.length-1);return""==e||"."==e?e="0":"."==e[e.length-1]&&(e=e.substr(0,e.length-1)),"."==e[0]&&(e="0"+e),e}Object.defineProperty(n,"__esModule",{value:!0}),n.multiply=void 0,n.multiply=function(e,n){e=e.toString(),n=n.toString();var r=0;"-"==e[0]&&(r++,e=e.substr(1)),"-"==n[0]&&(r++,n=n.substr(1)),e=t(e),n=t(n);var i=0,o=0;-1!=e.indexOf(".")&&(i=e.length-e.indexOf(".")-1),-1!=n.indexOf(".")&&(o=n.length-n.indexOf(".")-1);var u=i+o;if(e=t(e.replace(".","")),n=t(n.replace(".","")),e.length<n.length){var a=e;e=n,n=a}if("0"==n)return"0";for(var s,d,l=n.length,f=0,g=[],v=l-1,h="",p=0;p<l;p++)g[p]=e.length-1;for(p=0;p<2*e.length;p++){for(var c=0,b=n.length-1;b>=v&&b>=0;b--)g[b]>-1&&g[b]<e.length&&(c+=parseInt(e[g[b]--])*parseInt(n[b]));c+=f,f=Math.floor(c/10),h=c%10+h,v--}return h=t((s=h,0==(d=u)?s:(s=d>=s.length?new Array(d-s.length+1).join("0")+s:s).substr(0,s.length-d)+"."+s.substr(s.length-d,d))),1==r&&(h="-"+h),h}},350:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.roundOff=void 0;var r=t(916);function i(e,n,t,i){if(!e||e===new Array(e.length+1).join("0"))return!1;if(i===r.RoundingModes.DOWN||!t&&i===r.RoundingModes.FLOOR||t&&i===r.RoundingModes.CEILING)return!1;if(i===r.RoundingModes.UP||t&&i===r.RoundingModes.FLOOR||!t&&i===r.RoundingModes.CEILING)return!0;var o="5"+new Array(e.length).join("0");if(e>o)return!0;if(e<o)return!1;switch(i){case r.RoundingModes.HALF_DOWN:return!1;case r.RoundingModes.HALF_UP:return!0;case r.RoundingModes.HALF_EVEN:default:return parseInt(n[n.length-1])%2==1}}function o(e,n){void 0===n&&(n=0),n||(n=1),"number"==typeof e&&e.toString();for(var t="",r=e.length-1;r>=0;r--){var i=parseInt(e[r])+n;10==i?(n=1,i=0):n=0,t+=i}return n&&(t+=n),t.split("").reverse().join("")}n.roundOff=function e(n,t,u){if(void 0===t&&(t=0),void 0===u&&(u=r.RoundingModes.HALF_EVEN),u===r.RoundingModes.UNNECESSARY)throw new Error("UNNECESSARY Rounding Mode has not yet been implemented");"number"==typeof n&&(n=n.toString());var a=!1;"-"===n[0]&&(a=!0,n=n.substring(1));var s=n.split("."),d=s[0],l=s[1];if(t<0){if(t=-t,d.length<=t)return"0";var f=d.substr(0,d.length-t);return(a?"-":"")+(f=e(n=f+"."+d.substr(d.length-t)+l,0,u))+new Array(t+1).join("0")}if(0==t){d.length;return i(s[1],d,a,u)?(a?"-":"")+o(d):(a?"-":"")+d}if(!s[1])return(a?"-":"")+d+"."+new Array(t+1).join("0");if(s[1].length<t)return(a?"-":"")+d+"."+s[1]+new Array(t-s[1].length+1).join("0");l=s[1].substring(0,t);var g=s[1].substring(t);return g&&i(g,l,a,u)&&(l=o(l)).length>t?(a?"-":"")+o(d,parseInt(l[0]))+"."+l.substring(1):(a?"-":"")+d+"."+l}},916:(e,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.RoundingModes=void 0,function(e){e[e.CEILING=0]="CEILING",e[e.DOWN=1]="DOWN",e[e.FLOOR=2]="FLOOR",e[e.HALF_DOWN=3]="HALF_DOWN",e[e.HALF_EVEN=4]="HALF_EVEN",e[e.HALF_UP=5]="HALF_UP",e[e.UNNECESSARY=6]="UNNECESSARY",e[e.UP=7]="UP"}(n.RoundingModes||(n.RoundingModes={}))},26:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.negate=n.subtract=void 0;var r=t(217);function i(e){return e="-"==e[0]?e.substr(1):"-"+e}n.subtract=function(e,n){return e=e.toString(),n=i(n=n.toString()),r.add(e,n)},n.negate=i}},n={};var t=function t(r){var i=n[r];if(void 0!==i)return i.exports;var o=n[r]={exports:{}};return e[r](o,o.exports,t),o.exports}(423);bigDecimal=t})(); | ||
var bigDecimal;(()=>{"use strict";var e={217:(e,n)=>{function t(e){for(var n="",t=e.length,r=e.split(".")[1],i=r?r.length:0,u=0;u<t;u++)e[u]>="0"&&e[u]<="9"?n+=9-parseInt(e[u]):n+=e[u];return o(n,i>0?"0."+new Array(i).join("0")+"1":"1")}function r(e){var n=e.split(".");for(n[0]||(n[0]="0");"0"==n[0][0]&&n[0].length>1;)n[0]=n[0].substring(1);return n[0]+(n[1]?"."+n[1]:"")}function i(e,n){var t=e.split("."),r=n.split("."),i=t[0].length,o=r[0].length;return i>o?r[0]=new Array(Math.abs(i-o)+1).join("0")+(r[0]?r[0]:""):t[0]=new Array(Math.abs(i-o)+1).join("0")+(t[0]?t[0]:""),i=t[1]?t[1].length:0,o=r[1]?r[1].length:0,(i||o)&&(i>o?r[1]=(r[1]?r[1]:"")+new Array(Math.abs(i-o)+1).join("0"):t[1]=(t[1]?t[1]:"")+new Array(Math.abs(i-o)+1).join("0")),[e=t[0]+(t[1]?"."+t[1]:""),n=r[0]+(r[1]?"."+r[1]:"")]}function o(e,n){var t;e=(t=i(e,n))[0],n=t[1];for(var r="",o=0,u=e.length-1;u>=0;u--)if("."!==e[u]){var a=parseInt(e[u])+parseInt(n[u])+o;r=a%10+r,o=Math.floor(a/10)}else r="."+r;return o?o.toString()+r:r}Object.defineProperty(n,"__esModule",{value:!0}),n.pad=n.trim=n.add=void 0,n.add=function(e,n){var u;void 0===n&&(n="0");var a=0,s=-1;"-"==e[0]&&(a++,s=1,(e=e.substring(1)).length),"-"==n[0]&&(a++,s=2,(n=n.substring(1)).length),e=r(e),n=r(n),e=(u=i(r(e),r(n)))[0],n=u[1],1==a&&(1==s?e=t(e):n=t(n));var d=o(e,n);return a?2==a?"-"+r(d):e.length<d.length?r(d.substring(1)):"-"+r(t(d)):r(d)},n.trim=r,n.pad=i},423:(e,n,t)=>{var r=t(217),i=t(350),o=t(182),u=t(415),a=t(213),s=t(664),d=t(26),l=t(916),f=function(){function e(n){void 0===n&&(n="0"),this.value=e.validate(n)}return e.validate=function(e){if(e){if(e=e.toString(),isNaN(e))throw Error("Parameter is not a number: "+e);"+"==e[0]&&(e=e.substring(1))}else e="0";if(e.startsWith(".")?e="0"+e:e.startsWith("-.")&&(e="-0"+e.substr(1)),/e/i.test(e)){var n=e.split(/[eE]/),t=n[0],i=n[1],o="";"-"==(t=(0,r.trim)(t))[0]&&(o="-",t=t.substring(1)),t.indexOf(".")>=0?(i=parseInt(i)+t.indexOf("."),t=t.replace(".","")):i=parseInt(i)+t.length,e=t.length<i?o+t+new Array(i-t.length+1).join("0"):t.length>=i&&i>0?o+(0,r.trim)(t.substring(0,i))+(t.length>i?"."+t.substring(i):""):o+"0."+new Array(1-i).join("0")+t}return e},e.prototype.getValue=function(){return this.value},e.getPrettyValue=function(n,t,r){if(t||r){if(!t||!r)throw Error("Illegal Arguments. Should pass both digits and separator or pass none")}else t=3,r=",";var i="-"==(n=e.validate(n)).charAt(0);i&&(n=n.substring(1));for(var o=n.indexOf("."),u="",a=o=o>0?o:n.length;a>0;)a<t?(t=a,a=0):a-=t,u=n.substring(a,a+t)+(a<o-t&&a>=0?r:"")+u;return(i?"-":"")+u+n.substring(o)},e.prototype.getPrettyValue=function(n,t){return e.getPrettyValue(this.value,n,t)},e.round=function(n,t,r){if(void 0===t&&(t=0),void 0===r&&(r=l.RoundingModes.HALF_EVEN),n=e.validate(n),isNaN(t))throw Error("Precision is not a number: "+t);return(0,i.roundOff)(n,t,r)},e.prototype.round=function(n,t){if(void 0===n&&(n=0),void 0===t&&(t=l.RoundingModes.HALF_EVEN),isNaN(n))throw Error("Precision is not a number: "+n);return new e((0,i.roundOff)(this.value,n,t))},e.floor=function(n){return-1===(n=e.validate(n)).indexOf(".")?n:e.round(n,0,l.RoundingModes.FLOOR)},e.prototype.floor=function(){return-1===this.value.indexOf(".")?new e(this.value):new e(this.value).round(0,l.RoundingModes.FLOOR)},e.ceil=function(n){return-1===(n=e.validate(n)).indexOf(".")?n:e.round(n,0,l.RoundingModes.CEILING)},e.prototype.ceil=function(){return-1===this.value.indexOf(".")?new e(this.value):new e(this.value).round(0,l.RoundingModes.CEILING)},e.add=function(n,t){return n=e.validate(n),t=e.validate(t),(0,r.add)(n,t)},e.prototype.add=function(n){return new e((0,r.add)(this.value,n.getValue()))},e.subtract=function(n,t){return n=e.validate(n),t=e.validate(t),(0,d.subtract)(n,t)},e.prototype.subtract=function(n){return new e((0,d.subtract)(this.value,n.getValue()))},e.multiply=function(n,t){return n=e.validate(n),t=e.validate(t),(0,o.multiply)(n,t)},e.prototype.multiply=function(n){return new e((0,o.multiply)(this.value,n.getValue()))},e.divide=function(n,t,r){return n=e.validate(n),t=e.validate(t),(0,u.divide)(n,t,r)},e.prototype.divide=function(n,t){return new e((0,u.divide)(this.value,n.getValue(),t))},e.modulus=function(n,t){return n=e.validate(n),t=e.validate(t),(0,a.modulus)(n,t)},e.prototype.modulus=function(n){return new e((0,a.modulus)(this.value,n.getValue()))},e.compareTo=function(n,t){return n=e.validate(n),t=e.validate(t),(0,s.compareTo)(n,t)},e.prototype.compareTo=function(e){return(0,s.compareTo)(this.value,e.getValue())},e.negate=function(n){return n=e.validate(n),(0,d.negate)(n)},e.prototype.negate=function(){return new e((0,d.negate)(this.value))},e.RoundingModes=l.RoundingModes,e}();e.exports=f},664:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.compareTo=void 0;var r=t(217);n.compareTo=function(e,n){var t,i=!1;if("-"==e[0]&&"-"!=n[0])return-1;if("-"!=e[0]&&"-"==n[0])return 1;if("-"==e[0]&&"-"==n[0]&&(e=e.substr(1),n=n.substr(1),i=!0),e=(t=(0,r.pad)(e,n))[0],n=t[1],0==e.localeCompare(n))return 0;for(var o=0;o<e.length;o++)if(e[o]!=n[o])return e[o]>n[o]?i?-1:1:i?1:-1;return 0}},415:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.divide=void 0;var r=t(217),i=t(350);n.divide=function(e,n,t){if(void 0===t&&(t=8),0==n)throw new Error("Cannot divide by 0");if(e=e.toString(),n=n.toString(),e=e.replace(/(\.\d*?[1-9])0+$/g,"$1").replace(/\.0+$/,""),n=n.replace(/(\.\d*?[1-9])0+$/g,"$1").replace(/\.0+$/,""),0==e)return"0";var o=0;"-"==n[0]&&(n=n.substring(1),o++),"-"==e[0]&&(e=e.substring(1),o++);var u=n.indexOf(".")>0?n.length-n.indexOf(".")-1:-1;if(n=(0,r.trim)(n.replace(".","")),u>=0){var a=e.indexOf(".")>0?e.length-e.indexOf(".")-1:-1;if(-1==a)e=(0,r.trim)(e+new Array(u+1).join("0"));else if(u>a)e=e.replace(".",""),e=(0,r.trim)(e+new Array(u-a+1).join("0"));else if(u<a){var s=(e=e.replace(".","")).length-a+u;e=(0,r.trim)(e.substring(0,s)+"."+e.substring(s))}else u==a&&(e=(0,r.trim)(e.replace(".","")))}var d=0,l=n.length,f="",g=e.indexOf(".")>-1&&e.indexOf(".")<l?e.substring(0,l+1):e.substring(0,l);if(e=e.indexOf(".")>-1&&e.indexOf(".")<l?e.substring(l+1):e.substring(l),g.indexOf(".")>-1){var v=g.length-g.indexOf(".")-1;l>(g=g.replace(".","")).length&&(v+=l-g.length,g+=new Array(l-g.length+1).join("0")),d=v,f="0."+new Array(v).join("0")}for(t+=2;d<=t;){for(var p=0;parseInt(g)>=parseInt(n);)g=(0,r.add)(g,"-"+n),p++;f+=p,e?("."==e[0]&&(f+=".",d++,e=e.substring(1)),g+=e.substring(0,1),e=e.substring(1)):(d||(f+="."),d++,g+="0")}return(1==o?"-":"")+(0,r.trim)((0,i.roundOff)(f,t-2))}},213:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.modulus=void 0;var r=t(415),i=t(350),o=t(182),u=t(26),a=t(916);function s(e){if(-1!=e.indexOf("."))throw new Error("Modulus of non-integers not supported")}n.modulus=function(e,n){if(0==n)throw new Error("Cannot divide by 0");e=e.toString(),n=n.toString(),s(e),s(n);var t="";return"-"==e[0]&&(t="-",e=e.substr(1)),"-"==n[0]&&(n=n.substr(1)),t+(0,u.subtract)(e,(0,o.multiply)(n,(0,i.roundOff)((0,r.divide)(e,n),0,a.RoundingModes.FLOOR)))}},182:(e,n)=>{function t(e){for(;"0"==e[0];)e=e.substr(1);if(-1!=e.indexOf("."))for(;"0"==e[e.length-1];)e=e.substr(0,e.length-1);return""==e||"."==e?e="0":"."==e[e.length-1]&&(e=e.substr(0,e.length-1)),"."==e[0]&&(e="0"+e),e}Object.defineProperty(n,"__esModule",{value:!0}),n.multiply=void 0,n.multiply=function(e,n){e=e.toString(),n=n.toString();var r=0;"-"==e[0]&&(r++,e=e.substr(1)),"-"==n[0]&&(r++,n=n.substr(1)),e=t(e),n=t(n);var i=0,o=0;-1!=e.indexOf(".")&&(i=e.length-e.indexOf(".")-1),-1!=n.indexOf(".")&&(o=n.length-n.indexOf(".")-1);var u=i+o;if(e=t(e.replace(".","")),n=t(n.replace(".","")),e.length<n.length){var a=e;e=n,n=a}if("0"==n)return"0";for(var s,d,l=n.length,f=0,g=[],v=l-1,p="",h=0;h<l;h++)g[h]=e.length-1;for(h=0;h<2*e.length;h++){for(var c=0,b=n.length-1;b>=v&&b>=0;b--)g[b]>-1&&g[b]<e.length&&(c+=parseInt(e[g[b]--])*parseInt(n[b]));c+=f,f=Math.floor(c/10),p=c%10+p,v--}return p=t((s=p,0==(d=u)?s:(s=d>=s.length?new Array(d-s.length+1).join("0")+s:s).substr(0,s.length-d)+"."+s.substr(s.length-d,d))),1==r&&(p="-"+p),p}},350:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.roundOff=void 0;var r=t(916);function i(e,n,t,i){if(!e||e===new Array(e.length+1).join("0"))return!1;if(i===r.RoundingModes.DOWN||!t&&i===r.RoundingModes.FLOOR||t&&i===r.RoundingModes.CEILING)return!1;if(i===r.RoundingModes.UP||t&&i===r.RoundingModes.FLOOR||!t&&i===r.RoundingModes.CEILING)return!0;var o="5"+new Array(e.length).join("0");if(e>o)return!0;if(e<o)return!1;switch(i){case r.RoundingModes.HALF_DOWN:return!1;case r.RoundingModes.HALF_UP:return!0;case r.RoundingModes.HALF_EVEN:default:return parseInt(n[n.length-1])%2==1}}function o(e,n){void 0===n&&(n=0),n||(n=1),"number"==typeof e&&e.toString();for(var t="",r=e.length-1;r>=0;r--){var i=parseInt(e[r])+n;10==i?(n=1,i=0):n=0,t+=i}return n&&(t+=n),t.split("").reverse().join("")}n.roundOff=function e(n,t,u){if(void 0===t&&(t=0),void 0===u&&(u=r.RoundingModes.HALF_EVEN),u===r.RoundingModes.UNNECESSARY)throw new Error("UNNECESSARY Rounding Mode has not yet been implemented");"number"!=typeof n&&"bigint"!=typeof n||(n=n.toString());var a=!1;"-"===n[0]&&(a=!0,n=n.substring(1));var s=n.split("."),d=s[0],l=s[1];if(t<0){if(t=-t,d.length<=t)return"0";var f=d.substr(0,d.length-t);return(a?"-":"")+(f=e(n=f+"."+d.substr(d.length-t)+l,0,u))+new Array(t+1).join("0")}if(0==t){d.length;return i(s[1],d,a,u)?(a?"-":"")+o(d):(a?"-":"")+d}if(!s[1])return(a?"-":"")+d+"."+new Array(t+1).join("0");if(s[1].length<t)return(a?"-":"")+d+"."+s[1]+new Array(t-s[1].length+1).join("0");l=s[1].substring(0,t);var g=s[1].substring(t);return g&&i(g,l,a,u)&&(l=o(l)).length>t?(a?"-":"")+o(d,parseInt(l[0]))+"."+l.substring(1):(a?"-":"")+d+"."+l}},916:(e,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.RoundingModes=void 0,function(e){e[e.CEILING=0]="CEILING",e[e.DOWN=1]="DOWN",e[e.FLOOR=2]="FLOOR",e[e.HALF_DOWN=3]="HALF_DOWN",e[e.HALF_EVEN=4]="HALF_EVEN",e[e.HALF_UP=5]="HALF_UP",e[e.UNNECESSARY=6]="UNNECESSARY",e[e.UP=7]="UP"}(n.RoundingModes||(n.RoundingModes={}))},26:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.negate=n.subtract=void 0;var r=t(217);function i(e){return e="-"==e[0]?e.substr(1):"-"+e}n.subtract=function(e,n){return e=e.toString(),n=i(n=n.toString()),(0,r.add)(e,n)},n.negate=i}},n={};var t=function t(r){var i=n[r];if(void 0!==i)return i.exports;var o=n[r]={exports:{}};return e[r](o,o.exports,t),o.exports}(423);bigDecimal=t})(); |
{ | ||
"name": "js-big-decimal", | ||
"version": "1.3.6", | ||
"version": "1.3.7", | ||
"description": "Work with large numbers on the client side. Round them off to any required precission.", | ||
@@ -49,22 +49,22 @@ "main": "dist/node/js-big-decimal", | ||
"devDependencies": { | ||
"@types/jasmine": "^3.7.4", | ||
"@types/node": "^15.3.0", | ||
"chokidar-cli": "^2.1.0", | ||
"coveralls": "^3.1.0", | ||
"@types/jasmine": "^4.3.0", | ||
"@types/node": "^18.7.23", | ||
"chokidar-cli": "^3.0.0", | ||
"coveralls": "^3.1.1", | ||
"cross-env": "^7.0.3", | ||
"del": "^6.0.0", | ||
"doctoc": "^2.2.0", | ||
"glob": "^7.1.7", | ||
"del": "^6.1.1", | ||
"doctoc": "^2.2.1", | ||
"glob": "^8.0.3", | ||
"gulp": "^4.0.2", | ||
"gulp-run": "^1.7.1", | ||
"jasmine": "^3.7.0", | ||
"jasmine": "^4.4.0", | ||
"jasmine-spec-reporter": "^7.0.0", | ||
"npm-run-all": "^4.1.5", | ||
"nyc": "^15.1.0", | ||
"ts-node": "^9.1.1", | ||
"typescript": "^4.2.4", | ||
"webpack": "^5.37.0", | ||
"webpack-cli": "^4.7.0" | ||
"ts-node": "^10.9.1", | ||
"typescript": "^4.8.4", | ||
"webpack": "^5.74.0", | ||
"webpack-cli": "^4.10.0" | ||
}, | ||
"false": {}, | ||
"dependencies": {} | ||
"false": {} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
106132
18