chill117 / lnurl-node

Flexible lnurl server implementation with API and CLI implemented in nodejs.
MIT License
97 stars 26 forks source link

Fix `isHex` to be case-insensitive #36

Closed nchabra closed 3 years ago

chill117 commented 3 years ago

Thanks for taking the time to make a pull-request. I added a few test cases for the isHex method and I have mostly reverted the code changes to isHex. It will now be case insensitive as your pull-request was intending. The problem with using a regular expression as you did, is that it will return true for strings like "12345" which is technically a valid hexadecimal string, but the purpose of isHex is to differentiate between real hexadecimal strings and numbers that are of type string.