-
Notifications
You must be signed in to change notification settings - Fork 512
[BUG] intersects(r1, r2, options)
function returns true
if the not intersected range < 0.0.0
and 0.x
are supplied
#521
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
Comments
Technically this should be true if including pre releases, because 0.0.0-0 is less than 0.0.0. |
If the I forgot the |
Yeah, that definitely seems like a bug to me. Was just noting the edge case so we don't make a new bug when fixing this one 😬 |
With |
I would assume not; "the rules" say that in prerelease parts, any valid number comes before any valid string, and 0 is the smallest number (negative numbers don't exist 🙈). |
Thanks for confirming, that was my understanding also. |
If I think that covers everything? |
Found another bug while testing a fix for this:
ends up calling https://github.com/npm/node-semver/blob/main/ranges/intersects.js#L5 which doesn't pass those options to the |
nice catch |
Is there an existing issue for this?
Current Behavior
Range
< 0.0.0
(or range< 0.0.0-0
if theincludePrerelease
option istrue
) should not intersect with all ranges. However, theintersects(r1, r2, options)
function returnstrue
when comparing ranges< 0.0.0
(< 0.0.0-0
) and X-Range.Expected Behavior
false
if compared to range< 0.0.0
if theincludePrerelease
option isfalse
false
if compared to range< 0.0.0-0
if theincludePrerelease
option istrue
Steps To Reproduce
Environment
The text was updated successfully, but these errors were encountered: