-
Notifications
You must be signed in to change notification settings - Fork 636
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
semver: deprecate rangeMax
and rangeMin
#4365
Comments
I agree, this seems very confusing. Just a thought about 1. for the record: |
+1 for this.
Using infinity might be fine to use in the underlying logic. |
In we deprecate these two functions, there is no way to check anymore if a version is bigger/less than a range, because #4273 relies on these two as an alternative. Any thoughts? |
That sounds a valid point. I think if we deprecate these 2 APIs, we need to re-implement |
Can this now be closed? |
rangeMax
andrangeMin
were introduced in #3385, but these 2 APIs seem having critical design flaws. I suggest we should deprecate these 2 APIs.rangeMax
returns invalid semvers.rangeMax(parseRange("<1.0.0"))
returns 0.∞.∞ (0.Infinity.Infinity).rangeMax(parseRange("<1.1.0"))
returns 1.0.∞ (1.0.Infinity).rangeMax(parseRange("<0.0.0"))
returns -∞.∞.∞ (-Infinity.Infinity.Infinity).These values are non semvers. Exposing them are very confusing.
rangeMax
ignores prereleaserangeMax(parseRange("<1.2.3-a"))
returns 1.2.2 ignoring prerelease version.Because of this behavior, the example below returns
false
, which seems a bug, but there's no clear way to fix this.rangeMin(parseRange(">1.2.3"))
return 1.2.4, but actually 1.2.4-0 is smaller than that (and bigger than 1.2.3). On the other hand,rangeMin(parseRange(">1.2.3-a"))
returns the correct value 1.2.3-a.0, but the switching of the algorithm depending on the input value seems confusing and arbitrary.Note: There's no concern about the compatibility to
npm:semver
because these APIs are invented by us in #3385.The text was updated successfully, but these errors were encountered: