dinero.js 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /*! dinero.js 2.0.0 (UNRELEASED 8667862) | MIT License | © Sarah Dayan and contributors | https://dinerojs.com */
1
+ /*! dinero.js 2.0.1 (UNRELEASED 3a2dfb4) | MIT License | © Sarah Dayan and contributors | https://dinerojs.com */
2
2
  (function(global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
4
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -1,3 +1,3 @@
1
- /*! dinero.js 2.0.0 (UNRELEASED 8667862) | MIT License | © Sarah Dayan and contributors | https://dinerojs.com */
1
+ /*! dinero.js 2.0.1 (UNRELEASED 3a2dfb4) | MIT License | © Sarah Dayan and contributors | https://dinerojs.com */
2
2
  (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.dinerojs={}))})(this,function(e){let t=`Objects must have the same currency.`;function n(e,t){if(!e)throw Error(`[Dinero.js] ${t}`)}function r({calculator:e,onCreate:t,formatter:n={toNumber:Number,toString:String}}){return function r({amount:i,currency:{code:a,base:o,exponent:s},scale:c=s}){let l={code:a,base:o,exponent:s};return t?.({amount:i,currency:l,scale:c}),{calculator:e,formatter:n,create:r,toJSON(){return{amount:i,currency:l,scale:c}}}}}let i=function(e){return e[e.LT=-1]=`LT`,e[e.EQ=0]=`EQ`,e[e.GT=1]=`GT`,e}({});function a(e){return(t,n)=>e.compare(t,n)===i.EQ}function o(e){return(t,n)=>e.compare(t,n)===i.LT}function s(e){let t=a(e),n=o(e),r=e.zero();return i=>{if(t(i,r))return r;if(n(i,r)){let t=e.decrement(r);return e.multiply(t,i)}return i}}function c(e){return(t,n)=>e.compare(t,n)}function l(e){return Array.isArray(e)}function u(e){return t=>l(t)?t.reduce((t,n)=>e.multiply(t,n)):t}function d(e){let t=a(e);return(n,r)=>{let i=e.zero();if(t(i,n))return e.zero();let a=i,o=n;for(;t(e.modulo(o,r),i);)o=e.integerDivide(o,r),a=e.increment(a);return a}}function f(e){return(t,n)=>e.compare(t,n)===i.GT}function p(e){return(t,n)=>f(e)(t,n)||a(e)(t,n)}function m(e){return(t,n)=>{let r=a(e),i=f(e),s=o(e),c=p(e),l=e.zero(),u=e.increment(l),d=n.reduce((t,n)=>e.add(t,n),l);if(r(d,l))return n;let m=t,h=n.map(n=>{let r=e.integerDivide(e.multiply(t,n),d)||l;return m=e.subtract(m,r),r}),g=c(t,l),_=g?i:s,v=g?u:e.decrement(l),y=n.map((e,t)=>({ratio:e,index:t})).filter(({ratio:e})=>!r(e,l)).sort((e,t)=>i(e.ratio,t.ratio)?-1:1).map(({index:e})=>e),b=0;for(;_(m,l);){let t=y[b%y.length];h[t]=e.add(h[t],v);let n=e.subtract(m,v);if(r(n,m))break;m=n,b++}return h}}function h(e){return e?.hasOwnProperty(`amount`)}function g(e,t){return h(e)?{amount:e.amount,scale:e?.scale??t}:{amount:e,scale:t}}function _(e){let{multiply:t}=e;return e=>e.reduce((n,r,i)=>{let a=e.slice(i).reduce((e,n)=>t(e,n));return[...n,a]},[])}function v(e){let t=a(e),n=e.zero(),r=e.increment(e.increment(n));return i=>t(e.modulo(i,r),n)}function y(e){let t=a(e),n=s(e);return(r,i)=>{let a=n(e.modulo(r,i));return t(e.subtract(i,a),a)}}function b(e){return(t,n)=>o(e)(t,n)||a(e)(t,n)}function x(e){let t=o(e);return e=>e.reduce((e,n)=>t(e,n)?n:e)}function ee(e){let t=f(e);return e=>e.reduce((e,n)=>t(e,n)?n:e)}function S(e){let t=a(e),n=o(e),r=e.zero();return i=>{if(t(i,r))return r;let a=e.increment(r),o=e.decrement(r);return n(i,r)?o:a}}function C(e){let[t,...n]=e,r=u(t.calculator),{currency:i}=t.toJSON(),o=a(t.calculator),s=r(i.base);return n.every(e=>{let{currency:t}=e.toJSON(),n=r(t.base);return t.code===i.code&&o(n,s)&&o(t.exponent,i.exponent)})}let w=(e,t,n)=>{let r=f(n),i=a(n),o=n.zero(),s=r(e,o),c=n.integerDivide(e,t),l=i(n.modulo(e,t),o);return s||l?c:n.decrement(c)},te=(e,t,n)=>{let r=S(n),i=y(n),a=s(n);return i(e,t)?n.multiply(r(e),O(a(e),t,n)):D(e,t,n)},ne=(e,t,n)=>y(n)(e,t)?w(e,t,n):D(e,t,n),T=(e,t,n)=>{let r=v(n),i=y(n),a=D(e,t,n);return i(e,t)?r(a)?a:n.decrement(a):a},E=(e,t,n)=>{let r=v(n),i=y(n),a=D(e,t,n);return i(e,t)&&r(a)?n.decrement(a):a},re=(e,t,n)=>{let r=S(n),i=y(n),a=s(n);return i(e,t)?n.multiply(r(e),w(a(e),t,n)):D(e,t,n)},D=(e,t,n)=>{let r=f(n),i=y(n),a=s(n),o=n.zero(),c=a(n.modulo(e,t)),l=r(n.subtract(t,c),c),u=r(e,o);return i(e,t)||u&&!l||!u&&l?O(e,t,n):w(e,t,n)},O=(e,t,n)=>{let r=f(n),i=a(n),o=n.zero(),s=r(e,o),c=n.integerDivide(e,t);return!i(n.modulo(e,t),o)&&s?n.increment(c):c};function k(e){let t=f(e),n=u(e);return function(...[r,i,a=w]){let{amount:o,currency:s,scale:c}=r.toJSON(),l=t(i,c),u=l?e.multiply:a,[d,f]=l?[i,c]:[c,i],p=n(s.base),m=e.power(p,e.subtract(d,f));return r.create({amount:u(o,m,e),currency:s,scale:i})}}function A(e){let t=x(e),n=k(e),r=a(e);return function(...[i]){let a=i.reduce((e,n)=>{let{scale:r}=n.toJSON();return t([e,r])},e.zero());return i.map(e=>{let{scale:t}=e.toJSON();return r(t,a)?e:n(e,a)})}}function j(e){return function(...[t,n]){let{amount:r,currency:i,scale:a}=t.toJSON(),{amount:o}=n.toJSON(),s=e.add(r,o);return t.create({amount:s,currency:i,scale:a})}}function M(e){let r=A(e),i=j(e);return function(...[e,a]){n(C([e,a]),t);let[o,s]=r([e,a]);return i(o,s)}}function N(e){return function(...[t,n]){let{amount:r,currency:i,scale:a}=t.toJSON();return m(e)(r,n.map(e=>e.amount)).map(e=>t.create({amount:e,currency:i,scale:a}))}}function P(e){let t=N(e),r=p(e),i=f(e),o=k(e),s=x(e),c=a(e),l=e.zero(),u=Array(10).fill(null).reduce(e.increment,l);return function(...[a,d]){let f=d.length>0,p=d.map(e=>g(e,l)),m=f?s(p.map(({scale:e})=>e)):l,h=p.map(({amount:t,scale:n})=>{let r=c(n,m)?l:e.subtract(m,n);return{amount:e.multiply(t,e.power(u,r)),scale:n}}),_=h.every(({amount:e})=>r(e,l)),v=h.some(({amount:e})=>i(e,l));n(f&&_&&v,`Ratios are invalid.`);let{scale:y}=a.toJSON();return t(o(a,e.add(y,m)),h)}}function F(e){let t=c(e);return function(...[e,n]){let[r,i]=[e,n].map(e=>{let{amount:t}=e.toJSON();return t});return t(r,i)}}function I(e){let r=A(e),i=F(e);return function(...[e,a]){n(C([e,a]),t);let[o,s]=r([e,a]);return i(o,s)}}function L(e){let t=k(e),r=x(e),i=u(e),o=a(e),s=e.zero();return function(...[a,c,l]){let u=l[c.code],{amount:d,currency:f,scale:p}=a.toJSON();n(o(i(f.base),i(c.base)),`Objects must have the same currency base.`);let{amount:m,scale:h}=g(u,s),_=e.add(p,h);return t(a.create({amount:e.multiply(d,m),currency:c,scale:_}),r([_,c.exponent]))}}function R(e){let t=A(e),n=a(e);return function(...[e]){let[r,...i]=t(e),{amount:a}=r.toJSON();return i.every(e=>{let{amount:t}=e.toJSON();return n(t,a)})}}function z(e){return function(...[t,n]){return R(e)([t,n])&&C([t,n])}}function B(e){let t=f(e);return function(...[e,n]){let[r,i]=[e,n].map(e=>{let{amount:t}=e.toJSON();return t});return t(r,i)}}function V(e){let r=A(e),i=B(e);return function(...[e,a]){n(C([e,a]),t);let[o,s]=r([e,a]);return i(o,s)}}function H(e){let t=p(e);return function(...[e,n]){let[r,i]=[e,n].map(e=>{let{amount:t}=e.toJSON();return t});return t(r,i)}}function U(e){let r=A(e),i=H(e);return function(...[e,a]){n(C([e,a]),t);let[o,s]=r([e,a]);return i(o,s)}}function W(e){let t=a(e),n=u(e);return function(...[r]){let{amount:i,currency:a,scale:o}=r.toJSON(),s=n(a.base);return!t(e.modulo(i,e.power(s,o)),e.zero())}}function G(e){let t=o(e);return function(...[n]){let{amount:r}=n.toJSON();return t(r,e.zero())}}function K(e){let t=f(e);return function(...[n]){let{amount:r}=n.toJSON();return t(r,e.zero())}}function q(e){let t=a(e);return function(...[n]){let{amount:r}=n.toJSON();return t(r,e.zero())}}function J(e){let t=o(e);return function(...[e,n]){let[r,i]=[e,n].map(e=>{let{amount:t}=e.toJSON();return t});return t(r,i)}}function Y(e){let r=A(e),i=J(e);return function(...[e,a]){n(C([e,a]),t);let[o,s]=r([e,a]);return i(o,s)}}function X(e){let t=b(e);return function(...[e,n]){let[r,i]=[e,n].map(e=>{let{amount:t}=e.toJSON();return t});return t(r,i)}}function ie(e){let r=A(e),i=X(e);return function(...[e,a]){n(C([e,a]),t);let[o,s]=r([e,a]);return i(o,s)}}function ae(e){let t=x(e);return function(e){let[n]=e,{currency:r,scale:i}=n.toJSON(),a=t(e.map(e=>{let{amount:t}=e.toJSON();return t}));return n.create({amount:a,currency:r,scale:i})}}function oe(e){let r=A(e),i=ae(e);return function(...[e]){return n(C(e),t),i(r([...e]))}}function se(e){let t=ee(e);return function(e){let[n]=e,{currency:r,scale:i}=n.toJSON(),a=t(e.map(e=>{let{amount:t}=e.toJSON();return t}));return n.create({amount:a,currency:r,scale:i})}}function ce(e){let r=A(e),i=se(e);return function(...[e]){return n(C(e),t),i(r([...e]))}}function le(e){let t=k(e),n=e.zero();return function(...[r,i]){let{amount:a,currency:o,scale:s}=r.toJSON(),{amount:c,scale:l}=g(i,n),u=e.add(s,l);return t(r.create({amount:e.multiply(a,c),currency:o,scale:u}),u)}}function ue(e){return function(...[t,n]){let{amount:r,currency:i,scale:a}=t.toJSON(),{amount:o}=n.toJSON(),s=e.subtract(r,o);return t.create({amount:s,currency:i,scale:a})}}function de(e){let r=A(e),i=ue(e);return function(...[e,a]){n(C([e,a]),t);let[o,s]=r([e,a]);return i(o,s)}}function Z(e){let t=_(e);return function(...[n,r]){let{amount:i,currency:a,scale:o}=n.toJSON(),{power:s,integerDivide:c,modulo:u}=e,d=t((l(a.base)?a.base:[a.base]).map(e=>s(e,o))).reduce((e,t,n)=>{let r=e[n],i=c(r,t),a=u(r,t);return[...e.filter((e,t)=>t!==n),i,a]},[i]);return r?r({value:d,currency:a}):d}}function fe(e){let t=Z(e),r=u(e),i=a(e);return function(...[a,o]){let{currency:s,scale:c}=a.toJSON(),u=r(s.base),d=e.zero(),f=Array(10).fill(null).reduce(e.increment,d),p=l(s.base),m=i(e.modulo(u,f),d);n(!p&&m,`Currency is not decimal.`);let h=t(a),g=pe(e,a.formatter)(h,c);return o?o({value:g,currency:s}):g}}function pe(e,t){let n=s(e),r=a(e),i=o(e),c=e.zero();return(e,a)=>{let o=t.toString(e[0]),s=t.toString(n(e[1])),l=t.toNumber(a),u=`${o}${l>0?`.${s.padStart(l,`0`)}`:``}`,d=r(e[0],c),f=i(e[1],c);return d&&f?`-${u}`:u}}function me(e){return e.toJSON()}function he(e){let t=d(e),n=a(e),r=x(e),i=k(e),o=u(e);return function(...[a]){let{amount:s,currency:c,scale:l}=a.toJSON(),u=t(s,o(c.base)),d=r([e.subtract(l,u),c.exponent]);return n(d,l)?a:i(a,d)}}function ge(...[e,t]){let{calculator:n}=e;return M(n)(e,t)}function _e(...[e,t]){let{calculator:n}=e;return P(n)(e,t)}function ve(...[e,t]){let{calculator:n}=e;return I(n)(e,t)}function ye(...[e,t,n]){let{calculator:r}=e;return L(r)(e,t,n)}function be(...[e,t]){let{calculator:n}=e;return z(n)(e,t)}function xe(...[e,t]){let{calculator:n}=e;return V(n)(e,t)}function Se(...[e,t]){let{calculator:n}=e;return U(n)(e,t)}function Ce(...[e]){let{calculator:t}=e;return W(t)(e)}function we(...[e]){let{calculator:t}=e[0];return R(t)(e)}let Te=C;function Ee(...[e]){let{calculator:t}=e;return G(t)(e)}function De(...[e]){let{calculator:t}=e;return K(t)(e)}function Oe(...[e]){let{calculator:t}=e;return q(t)(e)}function ke(...[e,t]){let{calculator:n}=e;return Y(n)(e,t)}function Ae(...[e,t]){let{calculator:n}=e;return ie(n)(e,t)}function je(...[e]){let{calculator:t}=e[0];return oe(t)(e)}function Me(...[e]){let{calculator:t}=e[0];return ce(t)(e)}function Ne(...[e,t]){let{calculator:n}=e;return le(n)(e,t)}function Pe(...[e]){let{calculator:t}=e[0];return A(t)(e)}function Fe(...[e,t]){let{calculator:n}=e;return de(n)(e,t)}function Ie(...[e,t]){let{calculator:n}=e;return fe(n)(e,t)}let Le=me;function Re(...[e,t]){let{calculator:n}=e;return Z(n)(e,t)}function ze(...[e,t,n]){let{calculator:r}=e;return k(r)(e,t,n)}function Be(...[e]){let{calculator:t}=e;return he(t)(e)}let Ve={code:`AED`,base:10n,exponent:2n},He={code:`AFN`,base:10n,exponent:2n},Ue={code:`ALL`,base:10n,exponent:2n},We={code:`AMD`,base:10n,exponent:2n},Ge={code:`AOA`,base:10n,exponent:2n},Ke={code:`ARS`,base:10n,exponent:2n},qe={code:`AUD`,base:10n,exponent:2n},Je={code:`AWG`,base:10n,exponent:2n},Ye={code:`AZN`,base:10n,exponent:2n},Xe={code:`BAM`,base:10n,exponent:2n},Ze={code:`BBD`,base:10n,exponent:2n},Qe={code:`BDT`,base:10n,exponent:2n},$e={code:`BGN`,base:10n,exponent:2n},et={code:`BHD`,base:10n,exponent:3n},tt={code:`BIF`,base:10n,exponent:0n},nt={code:`BMD`,base:10n,exponent:2n},rt={code:`BND`,base:10n,exponent:2n},it={code:`BOB`,base:10n,exponent:2n},at={code:`BOV`,base:10n,exponent:2n},ot={code:`BRL`,base:10n,exponent:2n},st={code:`BSD`,base:10n,exponent:2n},ct={code:`BTN`,base:10n,exponent:2n},lt={code:`BWP`,base:10n,exponent:2n},ut={code:`BYN`,base:10n,exponent:2n},dt={code:`BZD`,base:10n,exponent:2n},ft={code:`CAD`,base:10n,exponent:2n},pt={code:`CDF`,base:10n,exponent:2n},mt={code:`CHE`,base:10n,exponent:2n},ht={code:`CHF`,base:10n,exponent:2n},gt={code:`CHW`,base:10n,exponent:2n},_t={code:`CLF`,base:10n,exponent:4n},vt={code:`CLP`,base:10n,exponent:0n},yt={code:`CNY`,base:10n,exponent:2n},bt={code:`COP`,base:10n,exponent:2n},xt={code:`COU`,base:10n,exponent:2n},St={code:`CRC`,base:10n,exponent:2n},Ct={code:`CUP`,base:10n,exponent:2n},wt={code:`CVE`,base:10n,exponent:2n},Tt={code:`CZK`,base:10n,exponent:2n},Et={code:`DJF`,base:10n,exponent:0n},Dt={code:`DKK`,base:10n,exponent:2n},Ot={code:`DOP`,base:10n,exponent:2n},kt={code:`DZD`,base:10n,exponent:2n},At={code:`EGP`,base:10n,exponent:2n},jt={code:`ERN`,base:10n,exponent:2n},Mt={code:`ETB`,base:10n,exponent:2n},Nt={code:`EUR`,base:10n,exponent:2n},Pt={code:`FJD`,base:10n,exponent:2n},Ft={code:`FKP`,base:10n,exponent:2n},It={code:`GBP`,base:10n,exponent:2n},Lt={code:`GEL`,base:10n,exponent:2n},Rt={code:`GHS`,base:10n,exponent:2n},zt={code:`GIP`,base:10n,exponent:2n},Bt={code:`GMD`,base:10n,exponent:2n},Vt={code:`GNF`,base:10n,exponent:0n},Ht={code:`GTQ`,base:10n,exponent:2n},Ut={code:`GYD`,base:10n,exponent:2n},Wt={code:`HKD`,base:10n,exponent:2n},Gt={code:`HNL`,base:10n,exponent:2n},Kt={code:`HTG`,base:10n,exponent:2n},qt={code:`HUF`,base:10n,exponent:2n},Jt={code:`IDR`,base:10n,exponent:2n},Yt={code:`ILS`,base:10n,exponent:2n},Xt={code:`INR`,base:10n,exponent:2n},Zt={code:`IQD`,base:10n,exponent:3n},Qt={code:`IRR`,base:10n,exponent:2n},$t={code:`ISK`,base:10n,exponent:0n},en={code:`JMD`,base:10n,exponent:2n},tn={code:`JOD`,base:10n,exponent:3n},nn={code:`JPY`,base:10n,exponent:0n},rn={code:`KES`,base:10n,exponent:2n},an={code:`KGS`,base:10n,exponent:2n},on={code:`KHR`,base:10n,exponent:2n},sn={code:`KMF`,base:10n,exponent:0n},cn={code:`KPW`,base:10n,exponent:2n},ln={code:`KRW`,base:10n,exponent:0n},un={code:`KWD`,base:10n,exponent:3n},dn={code:`KYD`,base:10n,exponent:2n},fn={code:`KZT`,base:10n,exponent:2n},pn={code:`LAK`,base:10n,exponent:2n},mn={code:`LBP`,base:10n,exponent:2n},hn={code:`LKR`,base:10n,exponent:2n},gn={code:`LRD`,base:10n,exponent:2n},_n={code:`LSL`,base:10n,exponent:2n},vn={code:`LYD`,base:10n,exponent:3n},yn={code:`MAD`,base:10n,exponent:2n},bn={code:`MDL`,base:10n,exponent:2n},xn={code:`MGA`,base:5n,exponent:1n},Sn={code:`MKD`,base:10n,exponent:2n},Cn={code:`MMK`,base:10n,exponent:2n},wn={code:`MNT`,base:10n,exponent:2n},Tn={code:`MOP`,base:10n,exponent:2n},En={code:`MRU`,base:5n,exponent:1n},Dn={code:`MUR`,base:10n,exponent:2n},On={code:`MVR`,base:10n,exponent:2n},kn={code:`MWK`,base:10n,exponent:2n},An={code:`MXN`,base:10n,exponent:2n},jn={code:`MXV`,base:10n,exponent:2n},Mn={code:`MYR`,base:10n,exponent:2n},Nn={code:`MZN`,base:10n,exponent:2n},Pn={code:`NAD`,base:10n,exponent:2n},Fn={code:`NGN`,base:10n,exponent:2n},In={code:`NIO`,base:10n,exponent:2n},Ln={code:`NOK`,base:10n,exponent:2n},Rn={code:`NPR`,base:10n,exponent:2n},zn={code:`NZD`,base:10n,exponent:2n},Bn={code:`OMR`,base:10n,exponent:3n},Vn={code:`PAB`,base:10n,exponent:2n},Hn={code:`PEN`,base:10n,exponent:2n},Un={code:`PGK`,base:10n,exponent:2n},Wn={code:`PHP`,base:10n,exponent:2n},Gn={code:`PKR`,base:10n,exponent:2n},Kn={code:`PLN`,base:10n,exponent:2n},qn={code:`PYG`,base:10n,exponent:0n},Jn={code:`QAR`,base:10n,exponent:2n},Yn={code:`RON`,base:10n,exponent:2n},Xn={code:`RSD`,base:10n,exponent:2n},Zn={code:`RUB`,base:10n,exponent:2n},Qn={code:`RWF`,base:10n,exponent:0n},$n={code:`SAR`,base:10n,exponent:2n},er={code:`SBD`,base:10n,exponent:2n},tr={code:`SCR`,base:10n,exponent:2n},nr={code:`SDG`,base:10n,exponent:2n},rr={code:`SEK`,base:10n,exponent:2n},ir={code:`SGD`,base:10n,exponent:2n},ar={code:`SHP`,base:10n,exponent:2n},or={code:`SLE`,base:10n,exponent:2n},sr={code:`SOS`,base:10n,exponent:2n},cr={code:`SRD`,base:10n,exponent:2n},lr={code:`SSP`,base:10n,exponent:2n},ur={code:`STN`,base:10n,exponent:2n},dr={code:`SVC`,base:10n,exponent:2n},fr={code:`SYP`,base:10n,exponent:2n},pr={code:`SZL`,base:10n,exponent:2n},mr={code:`THB`,base:10n,exponent:2n},hr={code:`TJS`,base:10n,exponent:2n},gr={code:`TMT`,base:10n,exponent:2n},_r={code:`TND`,base:10n,exponent:3n},vr={code:`TOP`,base:10n,exponent:2n},yr={code:`TRY`,base:10n,exponent:2n},br={code:`TTD`,base:10n,exponent:2n},xr={code:`TWD`,base:10n,exponent:2n},Sr={code:`TZS`,base:10n,exponent:2n},Cr={code:`UAH`,base:10n,exponent:2n},wr={code:`UGX`,base:10n,exponent:0n},Tr={code:`USD`,base:10n,exponent:2n},Er={code:`USN`,base:10n,exponent:2n},Dr={code:`UYI`,base:10n,exponent:0n},Or={code:`UYU`,base:10n,exponent:2n},kr={code:`UYW`,base:10n,exponent:4n},Ar={code:`UZS`,base:10n,exponent:2n},jr={code:`VED`,base:10n,exponent:2n},Mr={code:`VES`,base:10n,exponent:2n},Nr={code:`VND`,base:10n,exponent:0n},Q={code:`VUV`,base:10n,exponent:0n},Pr={code:`WST`,base:10n,exponent:2n},Fr={code:`XAD`,base:10n,exponent:2n},Ir={code:`XAF`,base:10n,exponent:0n},Lr={code:`XCD`,base:10n,exponent:2n},Rr={code:`XCG`,base:10n,exponent:2n},zr={code:`XOF`,base:10n,exponent:0n},Br={code:`XPF`,base:10n,exponent:0n},Vr={code:`YER`,base:10n,exponent:2n},Hr={code:`ZAR`,base:10n,exponent:2n},Ur={code:`ZMW`,base:10n,exponent:2n},Wr={code:`ZWG`,base:10n,exponent:2n},Gr=(e,t)=>e+t,Kr=(e,t)=>e<t?i.LT:e>t?i.GT:i.EQ,qr=e=>e-1n,Jr=e=>e+1n,Yr=(e,t)=>e/t,Xr=(e,t)=>e%t,Zr=(e,t)=>e*t,Qr=(e,t)=>e**t,$r=(e,t)=>e-t;function ei(){return 0n}let $={add:Gr,compare:Kr,decrement:qr,increment:Jr,integerDivide:Yr,modulo:Xr,multiply:Zr,power:Qr,subtract:$r,zero:ei},ti=r({calculator:$});e.AED=Ve,e.AFN=He,e.ALL=Ue,e.AMD=We,e.AOA=Ge,e.ARS=Ke,e.AUD=qe,e.AWG=Je,e.AZN=Ye,e.BAM=Xe,e.BBD=Ze,e.BDT=Qe,e.BGN=$e,e.BHD=et,e.BIF=tt,e.BMD=nt,e.BND=rt,e.BOB=it,e.BOV=at,e.BRL=ot,e.BSD=st,e.BTN=ct,e.BWP=lt,e.BYN=ut,e.BZD=dt,e.CAD=ft,e.CDF=pt,e.CHE=mt,e.CHF=ht,e.CHW=gt,e.CLF=_t,e.CLP=vt,e.CNY=yt,e.COP=bt,e.COU=xt,e.CRC=St,e.CUP=Ct,e.CVE=wt,e.CZK=Tt,e.DJF=Et,e.DKK=Dt,e.DOP=Ot,e.DZD=kt,e.EGP=At,e.ERN=jt,e.ETB=Mt,e.EUR=Nt,e.FJD=Pt,e.FKP=Ft,e.GBP=It,e.GEL=Lt,e.GHS=Rt,e.GIP=zt,e.GMD=Bt,e.GNF=Vt,e.GTQ=Ht,e.GYD=Ut,e.HKD=Wt,e.HNL=Gt,e.HTG=Kt,e.HUF=qt,e.IDR=Jt,e.ILS=Yt,e.INR=Xt,e.IQD=Zt,e.IRR=Qt,e.ISK=$t,e.JMD=en,e.JOD=tn,e.JPY=nn,e.KES=rn,e.KGS=an,e.KHR=on,e.KMF=sn,e.KPW=cn,e.KRW=ln,e.KWD=un,e.KYD=dn,e.KZT=fn,e.LAK=pn,e.LBP=mn,e.LKR=hn,e.LRD=gn,e.LSL=_n,e.LYD=vn,e.MAD=yn,e.MDL=bn,e.MGA=xn,e.MKD=Sn,e.MMK=Cn,e.MNT=wn,e.MOP=Tn,e.MRU=En,e.MUR=Dn,e.MVR=On,e.MWK=kn,e.MXN=An,e.MXV=jn,e.MYR=Mn,e.MZN=Nn,e.NAD=Pn,e.NGN=Fn,e.NIO=In,e.NOK=Ln,e.NPR=Rn,e.NZD=zn,e.OMR=Bn,e.PAB=Vn,e.PEN=Hn,e.PGK=Un,e.PHP=Wn,e.PKR=Gn,e.PLN=Kn,e.PYG=qn,e.QAR=Jn,e.RON=Yn,e.RSD=Xn,e.RUB=Zn,e.RWF=Qn,e.SAR=$n,e.SBD=er,e.SCR=tr,e.SDG=nr,e.SEK=rr,e.SGD=ir,e.SHP=ar,e.SLE=or,e.SOS=sr,e.SRD=cr,e.SSP=lr,e.STN=ur,e.SVC=dr,e.SYP=fr,e.SZL=pr,e.THB=mr,e.TJS=hr,e.TMT=gr,e.TND=_r,e.TOP=vr,e.TRY=yr,e.TTD=br,e.TWD=xr,e.TZS=Sr,e.UAH=Cr,e.UGX=wr,e.USD=Tr,e.USN=Er,e.UYI=Dr,e.UYU=Or,e.UYW=kr,e.UZS=Ar,e.VED=jr,e.VES=Mr,e.VND=Nr,e.VUV=Q,e.WST=Pr,e.XAD=Fr,e.XAF=Ir,e.XCD=Lr,e.XCG=Rr,e.XOF=zr,e.XPF=Br,e.YER=Vr,e.ZAR=Hr,e.ZMW=Ur,e.ZWG=Wr,e.add=ge,e.allocate=_e,e.calculator=$,e.compare=ve,e.convert=ye,e.createDinero=r,e.dinero=ti,e.down=w,e.equal=be,e.greaterThan=xe,e.greaterThanOrEqual=Se,e.halfAwayFromZero=te,e.halfDown=ne,e.halfEven=T,e.halfOdd=E,e.halfTowardsZero=re,e.halfUp=D,e.hasSubUnits=Ce,e.haveSameAmount=we,e.haveSameCurrency=Te,e.isNegative=Ee,e.isPositive=De,e.isZero=Oe,e.lessThan=ke,e.lessThanOrEqual=Ae,e.maximum=je,e.minimum=Me,e.multiply=Ne,e.normalizeScale=Pe,e.subtract=Fe,e.toDecimal=Ie,e.toSnapshot=Le,e.toUnits=Re,e.transformScale=ze,e.trimScale=Be,e.up=O});
3
3
  //# sourceMappingURL=index.production.js.map
@@ -1,4 +1,4 @@
1
- /*! dinero.js 2.0.0 (UNRELEASED 8667862) | MIT License | © Sarah Dayan and contributors | https://dinerojs.com */
1
+ /*! dinero.js 2.0.1 (UNRELEASED 3a2dfb4) | MIT License | © Sarah Dayan and contributors | https://dinerojs.com */
2
2
  (function(global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
4
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -1,3 +1,3 @@
1
- /*! dinero.js 2.0.0 (UNRELEASED 8667862) | MIT License | © Sarah Dayan and contributors | https://dinerojs.com */
1
+ /*! dinero.js 2.0.1 (UNRELEASED 3a2dfb4) | MIT License | © Sarah Dayan and contributors | https://dinerojs.com */
2
2
  (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.dinerojs={}))})(this,function(e){let t=`Objects must have the same currency.`;function n(e,t){if(!e)throw Error(`[Dinero.js] ${t}`)}function r({calculator:e,onCreate:t,formatter:n={toNumber:Number,toString:String}}){return function r({amount:i,currency:{code:a,base:o,exponent:s},scale:c=s}){let l={code:a,base:o,exponent:s};return t?.({amount:i,currency:l,scale:c}),{calculator:e,formatter:n,create:r,toJSON(){return{amount:i,currency:l,scale:c}}}}}let i=function(e){return e[e.LT=-1]=`LT`,e[e.EQ=0]=`EQ`,e[e.GT=1]=`GT`,e}({});function a(e){return(t,n)=>e.compare(t,n)===i.EQ}function o(e){return(t,n)=>e.compare(t,n)===i.LT}function s(e){let t=a(e),n=o(e),r=e.zero();return i=>{if(t(i,r))return r;if(n(i,r)){let t=e.decrement(r);return e.multiply(t,i)}return i}}function c(e){return(t,n)=>e.compare(t,n)}function l(e){return Array.isArray(e)}function u(e){return t=>l(t)?t.reduce((t,n)=>e.multiply(t,n)):t}function d(e){let t=a(e);return(n,r)=>{let i=e.zero();if(t(i,n))return e.zero();let a=i,o=n;for(;t(e.modulo(o,r),i);)o=e.integerDivide(o,r),a=e.increment(a);return a}}function f(e){return(t,n)=>e.compare(t,n)===i.GT}function p(e){return(t,n)=>f(e)(t,n)||a(e)(t,n)}function m(e){return(t,n)=>{let r=a(e),i=f(e),s=o(e),c=p(e),l=e.zero(),u=e.increment(l),d=n.reduce((t,n)=>e.add(t,n),l);if(r(d,l))return n;let m=t,h=n.map(n=>{let r=e.integerDivide(e.multiply(t,n),d)||l;return m=e.subtract(m,r),r}),g=c(t,l),_=g?i:s,v=g?u:e.decrement(l),y=n.map((e,t)=>({ratio:e,index:t})).filter(({ratio:e})=>!r(e,l)).sort((e,t)=>i(e.ratio,t.ratio)?-1:1).map(({index:e})=>e),b=0;for(;_(m,l);){let t=y[b%y.length];h[t]=e.add(h[t],v);let n=e.subtract(m,v);if(r(n,m))break;m=n,b++}return h}}function h(e){return e?.hasOwnProperty(`amount`)}function g(e,t){return h(e)?{amount:e.amount,scale:e?.scale??t}:{amount:e,scale:t}}function _(e){let{multiply:t}=e;return e=>e.reduce((n,r,i)=>{let a=e.slice(i).reduce((e,n)=>t(e,n));return[...n,a]},[])}function v(e){let t=a(e),n=e.zero(),r=e.increment(e.increment(n));return i=>t(e.modulo(i,r),n)}function y(e){let t=a(e),n=s(e);return(r,i)=>{let a=n(e.modulo(r,i));return t(e.subtract(i,a),a)}}function b(e){return(t,n)=>o(e)(t,n)||a(e)(t,n)}function x(e){let t=o(e);return e=>e.reduce((e,n)=>t(e,n)?n:e)}function ee(e){let t=f(e);return e=>e.reduce((e,n)=>t(e,n)?n:e)}function S(e){let t=a(e),n=o(e),r=e.zero();return i=>{if(t(i,r))return r;let a=e.increment(r),o=e.decrement(r);return n(i,r)?o:a}}function C(e){let[t,...n]=e,r=u(t.calculator),{currency:i}=t.toJSON(),o=a(t.calculator),s=r(i.base);return n.every(e=>{let{currency:t}=e.toJSON(),n=r(t.base);return t.code===i.code&&o(n,s)&&o(t.exponent,i.exponent)})}let w=(e,t,n)=>{let r=f(n),i=a(n),o=n.zero(),s=r(e,o),c=n.integerDivide(e,t),l=i(n.modulo(e,t),o);return s||l?c:n.decrement(c)},te=(e,t,n)=>{let r=S(n),i=y(n),a=s(n);return i(e,t)?n.multiply(r(e),k(a(e),t,n)):O(e,t,n)},T=(e,t,n)=>y(n)(e,t)?w(e,t,n):O(e,t,n),E=(e,t,n)=>{let r=v(n),i=y(n),a=O(e,t,n);return i(e,t)?r(a)?a:n.decrement(a):a},D=(e,t,n)=>{let r=v(n),i=y(n),a=O(e,t,n);return i(e,t)&&r(a)?n.decrement(a):a},ne=(e,t,n)=>{let r=S(n),i=y(n),a=s(n);return i(e,t)?n.multiply(r(e),w(a(e),t,n)):O(e,t,n)},O=(e,t,n)=>{let r=f(n),i=y(n),a=s(n),o=n.zero(),c=a(n.modulo(e,t)),l=r(n.subtract(t,c),c),u=r(e,o);return i(e,t)||u&&!l||!u&&l?k(e,t,n):w(e,t,n)},k=(e,t,n)=>{let r=f(n),i=a(n),o=n.zero(),s=r(e,o),c=n.integerDivide(e,t);return!i(n.modulo(e,t),o)&&s?n.increment(c):c};function A(e){let t=f(e),n=u(e);return function(...[r,i,a=w]){let{amount:o,currency:s,scale:c}=r.toJSON(),l=t(i,c),u=l?e.multiply:a,[d,f]=l?[i,c]:[c,i],p=n(s.base),m=e.power(p,e.subtract(d,f));return r.create({amount:u(o,m,e),currency:s,scale:i})}}function j(e){let t=x(e),n=A(e),r=a(e);return function(...[i]){let a=i.reduce((e,n)=>{let{scale:r}=n.toJSON();return t([e,r])},e.zero());return i.map(e=>{let{scale:t}=e.toJSON();return r(t,a)?e:n(e,a)})}}function M(e){return function(...[t,n]){let{amount:r,currency:i,scale:a}=t.toJSON(),{amount:o}=n.toJSON(),s=e.add(r,o);return t.create({amount:s,currency:i,scale:a})}}function N(e){let r=j(e),i=M(e);return function(...[e,a]){n(C([e,a]),t);let[o,s]=r([e,a]);return i(o,s)}}function P(e){return function(...[t,n]){let{amount:r,currency:i,scale:a}=t.toJSON();return m(e)(r,n.map(e=>e.amount)).map(e=>t.create({amount:e,currency:i,scale:a}))}}function F(e){let t=P(e),r=p(e),i=f(e),o=A(e),s=x(e),c=a(e),l=e.zero(),u=Array(10).fill(null).reduce(e.increment,l);return function(...[a,d]){let f=d.length>0,p=d.map(e=>g(e,l)),m=f?s(p.map(({scale:e})=>e)):l,h=p.map(({amount:t,scale:n})=>{let r=c(n,m)?l:e.subtract(m,n);return{amount:e.multiply(t,e.power(u,r)),scale:n}}),_=h.every(({amount:e})=>r(e,l)),v=h.some(({amount:e})=>i(e,l));n(f&&_&&v,`Ratios are invalid.`);let{scale:y}=a.toJSON();return t(o(a,e.add(y,m)),h)}}function I(e){let t=c(e);return function(...[e,n]){let[r,i]=[e,n].map(e=>{let{amount:t}=e.toJSON();return t});return t(r,i)}}function L(e){let r=j(e),i=I(e);return function(...[e,a]){n(C([e,a]),t);let[o,s]=r([e,a]);return i(o,s)}}function R(e){let t=A(e),r=x(e),i=u(e),o=a(e),s=e.zero();return function(...[a,c,l]){let u=l[c.code],{amount:d,currency:f,scale:p}=a.toJSON();n(o(i(f.base),i(c.base)),`Objects must have the same currency base.`);let{amount:m,scale:h}=g(u,s),_=e.add(p,h);return t(a.create({amount:e.multiply(d,m),currency:c,scale:_}),r([_,c.exponent]))}}function z(e){let t=j(e),n=a(e);return function(...[e]){let[r,...i]=t(e),{amount:a}=r.toJSON();return i.every(e=>{let{amount:t}=e.toJSON();return n(t,a)})}}function B(e){return function(...[t,n]){return z(e)([t,n])&&C([t,n])}}function V(e){let t=f(e);return function(...[e,n]){let[r,i]=[e,n].map(e=>{let{amount:t}=e.toJSON();return t});return t(r,i)}}function H(e){let r=j(e),i=V(e);return function(...[e,a]){n(C([e,a]),t);let[o,s]=r([e,a]);return i(o,s)}}function U(e){let t=p(e);return function(...[e,n]){let[r,i]=[e,n].map(e=>{let{amount:t}=e.toJSON();return t});return t(r,i)}}function W(e){let r=j(e),i=U(e);return function(...[e,a]){n(C([e,a]),t);let[o,s]=r([e,a]);return i(o,s)}}function G(e){let t=a(e),n=u(e);return function(...[r]){let{amount:i,currency:a,scale:o}=r.toJSON(),s=n(a.base);return!t(e.modulo(i,e.power(s,o)),e.zero())}}function K(e){let t=o(e);return function(...[n]){let{amount:r}=n.toJSON();return t(r,e.zero())}}function q(e){let t=f(e);return function(...[n]){let{amount:r}=n.toJSON();return t(r,e.zero())}}function J(e){let t=a(e);return function(...[n]){let{amount:r}=n.toJSON();return t(r,e.zero())}}function Y(e){let t=o(e);return function(...[e,n]){let[r,i]=[e,n].map(e=>{let{amount:t}=e.toJSON();return t});return t(r,i)}}function X(e){let r=j(e),i=Y(e);return function(...[e,a]){n(C([e,a]),t);let[o,s]=r([e,a]);return i(o,s)}}function Z(e){let t=b(e);return function(...[e,n]){let[r,i]=[e,n].map(e=>{let{amount:t}=e.toJSON();return t});return t(r,i)}}function re(e){let r=j(e),i=Z(e);return function(...[e,a]){n(C([e,a]),t);let[o,s]=r([e,a]);return i(o,s)}}function ie(e){let t=x(e);return function(e){let[n]=e,{currency:r,scale:i}=n.toJSON(),a=t(e.map(e=>{let{amount:t}=e.toJSON();return t}));return n.create({amount:a,currency:r,scale:i})}}function ae(e){let r=j(e),i=ie(e);return function(...[e]){return n(C(e),t),i(r([...e]))}}function oe(e){let t=ee(e);return function(e){let[n]=e,{currency:r,scale:i}=n.toJSON(),a=t(e.map(e=>{let{amount:t}=e.toJSON();return t}));return n.create({amount:a,currency:r,scale:i})}}function se(e){let r=j(e),i=oe(e);return function(...[e]){return n(C(e),t),i(r([...e]))}}function ce(e){let t=A(e),n=e.zero();return function(...[r,i]){let{amount:a,currency:o,scale:s}=r.toJSON(),{amount:c,scale:l}=g(i,n),u=e.add(s,l);return t(r.create({amount:e.multiply(a,c),currency:o,scale:u}),u)}}function le(e){return function(...[t,n]){let{amount:r,currency:i,scale:a}=t.toJSON(),{amount:o}=n.toJSON(),s=e.subtract(r,o);return t.create({amount:s,currency:i,scale:a})}}function ue(e){let r=j(e),i=le(e);return function(...[e,a]){n(C([e,a]),t);let[o,s]=r([e,a]);return i(o,s)}}function Q(e){let t=_(e);return function(...[n,r]){let{amount:i,currency:a,scale:o}=n.toJSON(),{power:s,integerDivide:c,modulo:u}=e,d=t((l(a.base)?a.base:[a.base]).map(e=>s(e,o))).reduce((e,t,n)=>{let r=e[n],i=c(r,t),a=u(r,t);return[...e.filter((e,t)=>t!==n),i,a]},[i]);return r?r({value:d,currency:a}):d}}function de(e){let t=Q(e),r=u(e),i=a(e);return function(...[a,o]){let{currency:s,scale:c}=a.toJSON(),u=r(s.base),d=e.zero(),f=Array(10).fill(null).reduce(e.increment,d),p=l(s.base),m=i(e.modulo(u,f),d);n(!p&&m,`Currency is not decimal.`);let h=t(a),g=fe(e,a.formatter)(h,c);return o?o({value:g,currency:s}):g}}function fe(e,t){let n=s(e),r=a(e),i=o(e),c=e.zero();return(e,a)=>{let o=t.toString(e[0]),s=t.toString(n(e[1])),l=t.toNumber(a),u=`${o}${l>0?`.${s.padStart(l,`0`)}`:``}`,d=r(e[0],c),f=i(e[1],c);return d&&f?`-${u}`:u}}function pe(e){return e.toJSON()}function me(e){let t=d(e),n=a(e),r=x(e),i=A(e),o=u(e);return function(...[a]){let{amount:s,currency:c,scale:l}=a.toJSON(),u=t(s,o(c.base)),d=r([e.subtract(l,u),c.exponent]);return n(d,l)?a:i(a,d)}}function he(...[e,t]){let{calculator:n}=e;return N(n)(e,t)}function ge(...[e,t]){let{calculator:n}=e;return F(n)(e,t)}function _e(...[e,t]){let{calculator:n}=e;return L(n)(e,t)}function ve(...[e,t,n]){let{calculator:r}=e;return R(r)(e,t,n)}function ye(...[e,t]){let{calculator:n}=e;return B(n)(e,t)}function be(...[e,t]){let{calculator:n}=e;return H(n)(e,t)}function xe(...[e,t]){let{calculator:n}=e;return W(n)(e,t)}function Se(...[e]){let{calculator:t}=e;return G(t)(e)}function Ce(...[e]){let{calculator:t}=e[0];return z(t)(e)}let we=C;function Te(...[e]){let{calculator:t}=e;return K(t)(e)}function Ee(...[e]){let{calculator:t}=e;return q(t)(e)}function De(...[e]){let{calculator:t}=e;return J(t)(e)}function Oe(...[e,t]){let{calculator:n}=e;return X(n)(e,t)}function ke(...[e,t]){let{calculator:n}=e;return re(n)(e,t)}function Ae(...[e]){let{calculator:t}=e[0];return ae(t)(e)}function je(...[e]){let{calculator:t}=e[0];return se(t)(e)}function Me(...[e,t]){let{calculator:n}=e;return ce(n)(e,t)}function Ne(...[e]){let{calculator:t}=e[0];return j(t)(e)}function Pe(...[e,t]){let{calculator:n}=e;return ue(n)(e,t)}function Fe(...[e,t]){let{calculator:n}=e;return de(n)(e,t)}let Ie=pe;function Le(...[e,t]){let{calculator:n}=e;return Q(n)(e,t)}function Re(...[e,t,n]){let{calculator:r}=e;return A(r)(e,t,n)}function ze(...[e]){let{calculator:t}=e;return me(t)(e)}let Be={code:`AED`,base:10,exponent:2},Ve={code:`AFN`,base:10,exponent:2},He={code:`ALL`,base:10,exponent:2},Ue={code:`AMD`,base:10,exponent:2},We={code:`AOA`,base:10,exponent:2},Ge={code:`ARS`,base:10,exponent:2},Ke={code:`AUD`,base:10,exponent:2},qe={code:`AWG`,base:10,exponent:2},Je={code:`AZN`,base:10,exponent:2},Ye={code:`BAM`,base:10,exponent:2},Xe={code:`BBD`,base:10,exponent:2},Ze={code:`BDT`,base:10,exponent:2},Qe={code:`BGN`,base:10,exponent:2},$e={code:`BHD`,base:10,exponent:3},et={code:`BIF`,base:10,exponent:0},tt={code:`BMD`,base:10,exponent:2},nt={code:`BND`,base:10,exponent:2},rt={code:`BOB`,base:10,exponent:2},it={code:`BOV`,base:10,exponent:2},at={code:`BRL`,base:10,exponent:2},ot={code:`BSD`,base:10,exponent:2},st={code:`BTN`,base:10,exponent:2},ct={code:`BWP`,base:10,exponent:2},lt={code:`BYN`,base:10,exponent:2},ut={code:`BZD`,base:10,exponent:2},dt={code:`CAD`,base:10,exponent:2},ft={code:`CDF`,base:10,exponent:2},pt={code:`CHE`,base:10,exponent:2},mt={code:`CHF`,base:10,exponent:2},ht={code:`CHW`,base:10,exponent:2},gt={code:`CLF`,base:10,exponent:4},_t={code:`CLP`,base:10,exponent:0},vt={code:`CNY`,base:10,exponent:2},yt={code:`COP`,base:10,exponent:2},bt={code:`COU`,base:10,exponent:2},xt={code:`CRC`,base:10,exponent:2},St={code:`CUP`,base:10,exponent:2},Ct={code:`CVE`,base:10,exponent:2},wt={code:`CZK`,base:10,exponent:2},Tt={code:`DJF`,base:10,exponent:0},Et={code:`DKK`,base:10,exponent:2},Dt={code:`DOP`,base:10,exponent:2},Ot={code:`DZD`,base:10,exponent:2},kt={code:`EGP`,base:10,exponent:2},At={code:`ERN`,base:10,exponent:2},jt={code:`ETB`,base:10,exponent:2},Mt={code:`EUR`,base:10,exponent:2},Nt={code:`FJD`,base:10,exponent:2},Pt={code:`FKP`,base:10,exponent:2},Ft={code:`GBP`,base:10,exponent:2},It={code:`GEL`,base:10,exponent:2},Lt={code:`GHS`,base:10,exponent:2},Rt={code:`GIP`,base:10,exponent:2},zt={code:`GMD`,base:10,exponent:2},Bt={code:`GNF`,base:10,exponent:0},Vt={code:`GTQ`,base:10,exponent:2},Ht={code:`GYD`,base:10,exponent:2},Ut={code:`HKD`,base:10,exponent:2},Wt={code:`HNL`,base:10,exponent:2},Gt={code:`HTG`,base:10,exponent:2},Kt={code:`HUF`,base:10,exponent:2},qt={code:`IDR`,base:10,exponent:2},Jt={code:`ILS`,base:10,exponent:2},Yt={code:`INR`,base:10,exponent:2},Xt={code:`IQD`,base:10,exponent:3},Zt={code:`IRR`,base:10,exponent:2},Qt={code:`ISK`,base:10,exponent:0},$t={code:`JMD`,base:10,exponent:2},en={code:`JOD`,base:10,exponent:3},tn={code:`JPY`,base:10,exponent:0},nn={code:`KES`,base:10,exponent:2},rn={code:`KGS`,base:10,exponent:2},an={code:`KHR`,base:10,exponent:2},on={code:`KMF`,base:10,exponent:0},sn={code:`KPW`,base:10,exponent:2},cn={code:`KRW`,base:10,exponent:0},ln={code:`KWD`,base:10,exponent:3},un={code:`KYD`,base:10,exponent:2},dn={code:`KZT`,base:10,exponent:2},fn={code:`LAK`,base:10,exponent:2},pn={code:`LBP`,base:10,exponent:2},mn={code:`LKR`,base:10,exponent:2},hn={code:`LRD`,base:10,exponent:2},gn={code:`LSL`,base:10,exponent:2},_n={code:`LYD`,base:10,exponent:3},vn={code:`MAD`,base:10,exponent:2},yn={code:`MDL`,base:10,exponent:2},bn={code:`MGA`,base:5,exponent:1},xn={code:`MKD`,base:10,exponent:2},Sn={code:`MMK`,base:10,exponent:2},Cn={code:`MNT`,base:10,exponent:2},wn={code:`MOP`,base:10,exponent:2},Tn={code:`MRU`,base:5,exponent:1},En={code:`MUR`,base:10,exponent:2},Dn={code:`MVR`,base:10,exponent:2},On={code:`MWK`,base:10,exponent:2},kn={code:`MXN`,base:10,exponent:2},An={code:`MXV`,base:10,exponent:2},jn={code:`MYR`,base:10,exponent:2},Mn={code:`MZN`,base:10,exponent:2},Nn={code:`NAD`,base:10,exponent:2},Pn={code:`NGN`,base:10,exponent:2},Fn={code:`NIO`,base:10,exponent:2},In={code:`NOK`,base:10,exponent:2},Ln={code:`NPR`,base:10,exponent:2},Rn={code:`NZD`,base:10,exponent:2},zn={code:`OMR`,base:10,exponent:3},Bn={code:`PAB`,base:10,exponent:2},Vn={code:`PEN`,base:10,exponent:2},Hn={code:`PGK`,base:10,exponent:2},Un={code:`PHP`,base:10,exponent:2},Wn={code:`PKR`,base:10,exponent:2},Gn={code:`PLN`,base:10,exponent:2},Kn={code:`PYG`,base:10,exponent:0},qn={code:`QAR`,base:10,exponent:2},Jn={code:`RON`,base:10,exponent:2},Yn={code:`RSD`,base:10,exponent:2},Xn={code:`RUB`,base:10,exponent:2},Zn={code:`RWF`,base:10,exponent:0},Qn={code:`SAR`,base:10,exponent:2},$n={code:`SBD`,base:10,exponent:2},er={code:`SCR`,base:10,exponent:2},tr={code:`SDG`,base:10,exponent:2},nr={code:`SEK`,base:10,exponent:2},rr={code:`SGD`,base:10,exponent:2},ir={code:`SHP`,base:10,exponent:2},ar={code:`SLE`,base:10,exponent:2},or={code:`SOS`,base:10,exponent:2},sr={code:`SRD`,base:10,exponent:2},cr={code:`SSP`,base:10,exponent:2},lr={code:`STN`,base:10,exponent:2},ur={code:`SVC`,base:10,exponent:2},dr={code:`SYP`,base:10,exponent:2},fr={code:`SZL`,base:10,exponent:2},pr={code:`THB`,base:10,exponent:2},mr={code:`TJS`,base:10,exponent:2},hr={code:`TMT`,base:10,exponent:2},gr={code:`TND`,base:10,exponent:3},_r={code:`TOP`,base:10,exponent:2},vr={code:`TRY`,base:10,exponent:2},yr={code:`TTD`,base:10,exponent:2},br={code:`TWD`,base:10,exponent:2},xr={code:`TZS`,base:10,exponent:2},Sr={code:`UAH`,base:10,exponent:2},Cr={code:`UGX`,base:10,exponent:0},wr={code:`USD`,base:10,exponent:2},Tr={code:`USN`,base:10,exponent:2},Er={code:`UYI`,base:10,exponent:0},Dr={code:`UYU`,base:10,exponent:2},Or={code:`UYW`,base:10,exponent:4},kr={code:`UZS`,base:10,exponent:2},Ar={code:`VED`,base:10,exponent:2},jr={code:`VES`,base:10,exponent:2},Mr={code:`VND`,base:10,exponent:0},$={code:`VUV`,base:10,exponent:0},Nr={code:`WST`,base:10,exponent:2},Pr={code:`XAD`,base:10,exponent:2},Fr={code:`XAF`,base:10,exponent:0},Ir={code:`XCD`,base:10,exponent:2},Lr={code:`XCG`,base:10,exponent:2},Rr={code:`XOF`,base:10,exponent:0},zr={code:`XPF`,base:10,exponent:0},Br={code:`YER`,base:10,exponent:2},Vr={code:`ZAR`,base:10,exponent:2},Hr={code:`ZMW`,base:10,exponent:2},Ur={code:`ZWG`,base:10,exponent:2},Wr=(e,t)=>e+t,Gr=(e,t)=>e<t?i.LT:e>t?i.GT:i.EQ,Kr=e=>e-1,qr=e=>e+1,Jr=(e,t)=>Math.trunc(e/t),Yr=(e,t)=>e%t,Xr=(e,t)=>e*t,Zr=(e,t)=>e**t,Qr=(e,t)=>e-t;function $r(){return 0}let ei=r({calculator:{add:Wr,compare:Gr,decrement:Kr,increment:qr,integerDivide:Jr,modulo:Yr,multiply:Xr,power:Zr,subtract:Qr,zero:$r},onCreate({amount:e,scale:t}){n(Number.isInteger(e),`Amount is invalid.`),n(Number.isInteger(t),`Scale is invalid.`)}});e.AED=Be,e.AFN=Ve,e.ALL=He,e.AMD=Ue,e.AOA=We,e.ARS=Ge,e.AUD=Ke,e.AWG=qe,e.AZN=Je,e.BAM=Ye,e.BBD=Xe,e.BDT=Ze,e.BGN=Qe,e.BHD=$e,e.BIF=et,e.BMD=tt,e.BND=nt,e.BOB=rt,e.BOV=it,e.BRL=at,e.BSD=ot,e.BTN=st,e.BWP=ct,e.BYN=lt,e.BZD=ut,e.CAD=dt,e.CDF=ft,e.CHE=pt,e.CHF=mt,e.CHW=ht,e.CLF=gt,e.CLP=_t,e.CNY=vt,e.COP=yt,e.COU=bt,e.CRC=xt,e.CUP=St,e.CVE=Ct,e.CZK=wt,e.DJF=Tt,e.DKK=Et,e.DOP=Dt,e.DZD=Ot,e.EGP=kt,e.ERN=At,e.ETB=jt,e.EUR=Mt,e.FJD=Nt,e.FKP=Pt,e.GBP=Ft,e.GEL=It,e.GHS=Lt,e.GIP=Rt,e.GMD=zt,e.GNF=Bt,e.GTQ=Vt,e.GYD=Ht,e.HKD=Ut,e.HNL=Wt,e.HTG=Gt,e.HUF=Kt,e.IDR=qt,e.ILS=Jt,e.INR=Yt,e.IQD=Xt,e.IRR=Zt,e.ISK=Qt,e.JMD=$t,e.JOD=en,e.JPY=tn,e.KES=nn,e.KGS=rn,e.KHR=an,e.KMF=on,e.KPW=sn,e.KRW=cn,e.KWD=ln,e.KYD=un,e.KZT=dn,e.LAK=fn,e.LBP=pn,e.LKR=mn,e.LRD=hn,e.LSL=gn,e.LYD=_n,e.MAD=vn,e.MDL=yn,e.MGA=bn,e.MKD=xn,e.MMK=Sn,e.MNT=Cn,e.MOP=wn,e.MRU=Tn,e.MUR=En,e.MVR=Dn,e.MWK=On,e.MXN=kn,e.MXV=An,e.MYR=jn,e.MZN=Mn,e.NAD=Nn,e.NGN=Pn,e.NIO=Fn,e.NOK=In,e.NPR=Ln,e.NZD=Rn,e.OMR=zn,e.PAB=Bn,e.PEN=Vn,e.PGK=Hn,e.PHP=Un,e.PKR=Wn,e.PLN=Gn,e.PYG=Kn,e.QAR=qn,e.RON=Jn,e.RSD=Yn,e.RUB=Xn,e.RWF=Zn,e.SAR=Qn,e.SBD=$n,e.SCR=er,e.SDG=tr,e.SEK=nr,e.SGD=rr,e.SHP=ir,e.SLE=ar,e.SOS=or,e.SRD=sr,e.SSP=cr,e.STN=lr,e.SVC=ur,e.SYP=dr,e.SZL=fr,e.THB=pr,e.TJS=mr,e.TMT=hr,e.TND=gr,e.TOP=_r,e.TRY=vr,e.TTD=yr,e.TWD=br,e.TZS=xr,e.UAH=Sr,e.UGX=Cr,e.USD=wr,e.USN=Tr,e.UYI=Er,e.UYU=Dr,e.UYW=Or,e.UZS=kr,e.VED=Ar,e.VES=jr,e.VND=Mr,e.VUV=$,e.WST=Nr,e.XAD=Pr,e.XAF=Fr,e.XCD=Ir,e.XCG=Lr,e.XOF=Rr,e.XPF=zr,e.YER=Br,e.ZAR=Vr,e.ZMW=Hr,e.ZWG=Ur,e.add=he,e.allocate=ge,e.compare=_e,e.convert=ve,e.createDinero=r,e.dinero=ei,e.down=w,e.equal=ye,e.greaterThan=be,e.greaterThanOrEqual=xe,e.halfAwayFromZero=te,e.halfDown=T,e.halfEven=E,e.halfOdd=D,e.halfTowardsZero=ne,e.halfUp=O,e.hasSubUnits=Se,e.haveSameAmount=Ce,e.haveSameCurrency=we,e.isNegative=Te,e.isPositive=Ee,e.isZero=De,e.lessThan=Oe,e.lessThanOrEqual=ke,e.maximum=Ae,e.minimum=je,e.multiply=Me,e.normalizeScale=Ne,e.subtract=Pe,e.toDecimal=Fe,e.toSnapshot=Ie,e.toUnits=Le,e.transformScale=Re,e.trimScale=ze,e.up=k});
3
3
  //# sourceMappingURL=index.production.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dinero.js",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Create, calculate, and format money in JavaScript and TypeScript",
5
5
  "engines": {
6
6
  "node": ">=20.0.0"
@@ -25,6 +25,7 @@
25
25
  "type": "git",
26
26
  "url": "https://github.com/dinerojs/dinero.js.git"
27
27
  },
28
+ "type": "module",
28
29
  "license": "MIT",
29
30
  "author": {
30
31
  "name": "Sarah Dayan",