Uh oh!
There was an error while loading. Please reload this page.
fix: throw on bad version with correct error message - #552
Conversation
|
Uh oh!
There was an error while loading. Please reload this page.
c6b0ce1 to
e0d7c01Comparewraithgar
commented
Apr 15, 2023
Arrays and objects still throw an ambiguous message but is it worth bringing in something like >require('.').diff([],'1.3.2')Uncaught TypeError: Invalid Version:>require('.').diff({},'1.3.2')Uncaught TypeError: Invalid Version: [objectObject]vs >require('.').diff([],'1.3.2')Uncaught TypeError: Invalid Version: []>require('.').diff({},'1.3.2')Uncaught TypeError: Invalid Version: {} |
tjenkinson
commented
Apr 15, 2023
Given that code path should only be hit if you're doing something really wrong, I don't see any harm in making the error more readable with |
Oops... This does break something. I am using this library in a react-native project, and since RN does not run in a Node.js environment, its bundler might not recognize the I've just received a failure report, and haven't investigated into it. Update: I installed util for polyfill, and now it is working fine. |
tjenkinson
commented
Apr 18, 2023
Ah I checked the node version support of it but didn’t realise this was also used in a browser 🙈 |
The parsing logic that is duplicated in SemVer's constructor was also removed. See #541 for previous discussions about not optimizing for invalid SemVer.
With this fix:
v7.4.0:503a4e52: