Missing country currency code
cfurter opened this issue · 2 comments
cfurter commented
When the currency code is not in the CurrencyCode.json file, an exception is thrown.
Here is my fix, I could not create a pull request.
diff --git a/lib/Decoder.js b/lib/Decoder.js
index 3eb9e4e..e951817 100644
--- a/lib/Decoder.js
+++ b/lib/Decoder.js
@@ -291,10 +291,12 @@ function getCurrencyCode(tlv) {
});
var obj = array[0];
- desc.push('Code: [' + obj['code'] + '] : ' + obj['currency']);
-
+ if (obj)
+ desc.push('Code: [' + obj['code'] + '] : ' + obj['currency']);
+ else
+ desc.push('unknown country code ' + value + '. plz update ISO3166.');
} else {
- desc.push('unknown country code. plz update ISO3166.');
+ desc.push('no country codes? plz load.');
}
return desc;
}
@@ -303,4 +305,4 @@ module.exports = {
setDecoder: setDecoder
};
coolbong commented
I fixed. plz check the codes.
thank you.
cfurter commented
Looks good +1
…--
Cheers,
Craig.
________________________________
From: coolbong <notifications@github.com>
Sent: Wednesday, 25 September 2019 19:07
To: coolbong/node-tlv <node-tlv@noreply.github.com>
Cc: Craig Furter <craig@furter.co.nz>; Author <author@noreply.github.com>
Subject: Re: [coolbong/node-tlv] Missing country currency code (#4)
I fixed. plz check the codes.
thank you.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#4?email_source=notifications&email_token=AAUHEHHQLT7LAXI2BKC46BLQLME2HA5CNFSM4I2HY24KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7Q3H2A#issuecomment-534885352>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AAUHEHGFH4NQTJQLSG53PMTQLME2HANCNFSM4I2HY24A>.