Skip to content

Commit

Permalink
Merge pull request #22 from dsanchezcr/npm-fix-tests
Browse files Browse the repository at this point in the history
Fixing issues of the npm package. Resolves #21 update to 2.0.1
  • Loading branch information
dsanchezcr authored Nov 20, 2023
2 parents 017fe0c + 3ac670c commit 10cd9fa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/NuGet/ColonesExchangeRate/ColonesExchangeRate.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<PackageTags>colones; dollars; euros; currency-exchange; exchange-rate; costa-rica; CRC;</PackageTags>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>https://github.com/dsanchezcr/ColonesExchangeRate</PackageProjectUrl>
<Version>2.0.0</Version>
<AssemblyVersion>2.0.0</AssemblyVersion>
<Version>2.0.1</Version>
<AssemblyVersion>2.0.1</AssemblyVersion>
<Description>Currency conversion from Colones (Costa Rica - CRC ₡) to Dollars (United States - USD $) and Euros (European Union - EUR €). It consumes the exchange rate API from Ministerio de Hacienda de Costa Rica.</Description>
</PropertyGroup>
<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/npm/colonesexchangerate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class ColonesExchangeRate {
// Method to convert Colones to Euros
colonesToEuros(amount) {
return this.convertCurrency(amount, rate => {
if (rate?.Euro?.Colones != null)
return 1 / rate.Euro.Colones;
if (rate?.euro?.colones != null)
return 1 / rate.euro.colones;
else
return 1 / ((rate?.dolar?.compra?.valor ?? 0) * parseFloat(rate?.euro?.valor ?? "0"));
});
Expand All @@ -51,8 +51,8 @@ class ColonesExchangeRate {
// Method to convert Euros to Colones
eurosToColones(amount) {
return this.convertCurrency(amount, rate => {
if (rate?.Euro?.Colones != null)
return rate.Euro.Colones;
if (rate?.euro?.colones != null)
return rate.euro.colones;
else {
return (parseFloat(rate?.euro?.valor ?? "0") * (rate?.dolar?.venta?.valor ?? 0));
}
Expand Down
2 changes: 1 addition & 1 deletion src/npm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dsanchezcr/colonesexchangerate",
"version": "2.0.0",
"version": "2.0.1",
"type": "module",
"description": "Currency conversion from Colones (Costa Rica - CRC ₡) to Dollars (United States - USD $) and Euros (European Union - EUR €). It consumes the exchange rate API from Ministerio de Hacienda de Costa Rica.",
"main": "ColonesExchangeRate.mjs",
Expand Down

0 comments on commit 10cd9fa

Please sign in to comment.