-
Notifications
You must be signed in to change notification settings - Fork 629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(semver): throw on invalid input in parseRange()
#5567
Conversation
import { isSemVer } from "./is_semver.ts"; | ||
|
||
function isComparator(value: unknown): value is Comparator { | ||
if ( | ||
value === null || value === undefined || Array.isArray(value) || | ||
typeof value !== "object" | ||
) return false; | ||
if (value === NONE || value === ALL) return true; | ||
if (value === ALL) return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, we no longer regard <0.0.0
as a valid comparator.
semver/parse_range.ts
Outdated
// remove spaces between operators and versions | ||
.replaceAll(/(?<=<|>|=|~) +/g, "") | ||
.replaceAll(/(?<=<|>|=|~)(\s+)/g, "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pass-by fix that this change requires.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5567 +/- ##
==========================================
+ Coverage 96.12% 96.48% +0.36%
==========================================
Files 465 465
Lines 37772 37770 -2
Branches 5549 5582 +33
==========================================
+ Hits 36308 36443 +135
+ Misses 1422 1285 -137
Partials 42 42 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Closes #4845