Open matthias-ccri opened 2 years ago
Hi, @matthias-ccri . That's a great suggestion! Would you like to work on a contribution and submit a Pull Request? If not, I can try to get to it, but I can't promise that would happen soon.
If you (or whoever) works on this, please also add a test case to https://github.com/proj4js/mgrs/blob/master/test/test.js
Calling
mgrs.inverse('1fcd3c38-ef3d-462d-8fd4-6191bde89736')
returns[NaN, NaN, NaN, NaN]
.The input string is not a mgrs string so it's expected that mgrs would fail to parse it. But could the library fail in a more obvious way, such as returning
undefined
or throwing an error?Our company got bitten by this, since we were using mgrs to detect whether a string was mgrs. We have a search field where the user can enter latlon coordinates, mgrs, and place names, and so our code tries to detect whether a string is mgrs. Unfortunately, we considered an array return value to be a successful parse. We now have code to check for the NaNs. Should this failure case be improved?
Thanks.