-
Notifications
You must be signed in to change notification settings - Fork 623
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
deprecation(semver): rename testRange()
to satisfies()
#4364
Conversation
I'm not in favor of this change. The reasons don't seem giving enough reasoning to do the deprecation and breaking change.
Also the name |
I think |
I agree with the ideas in this PR for the reasons Tim gives. |
|
@kt3k WDYT? |
We need strong reasons for doing breaking changes, such as resolving inconsistency, fixing obvious design errors, etc. 'Some name looking better' can't be a reason for breaking change in my view. |
Hey Yoshiya, I agree with Tim. However, we've not fully articulated our reasoning. The purpose of
Once one learns the function's purpose, one may be surprised to know they were asking the wrong questions in the first place due to the misleading name. However, the purpose of the function is far clearer when talking about SemVers than something like I think this is more than just a preference for function names; it is a decent improvement in the clarity of the function's objective and reduces the amount of reading of the documentation before use. I think the value gained is worth the breaking change. |
I think the name has been derived from |
Based on my and Tim's opinions and those of others expressed in Discord, the majority of users believe this function name is confusing. I think changing the name is a good idea. |
I'm still not convinced with the deprecation, but I see some issues with the suggested replacement.
Also the jsdoc of Another note: the original npm:semver module calls this API So the use of |
Actually, |
How about Also it's the same name as |
+1 |
testRange()
to rangeIncludes()
testRange()
to satisfies()
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4364 +/- ##
==========================================
- Coverage 90.99% 90.93% -0.07%
==========================================
Files 478 479 +1
Lines 37383 37399 +16
Branches 5308 5310 +2
==========================================
- Hits 34016 34008 -8
- Misses 3305 3329 +24
Partials 62 62 ☔ View full report in Codecov by Sentry. |
@timreichen and @kt3k, I've modified this PR to introduce the new function |
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
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
Changes
testRange()
in favour ofsatisfies()
.satisfies(range: Range, version: Version)
testRange()
used in std/semver are replaced withsatisfies()
.Reasons
testRange
has the focus on range rather on the version, to check if it is part of the range.testRange
can be confused for range validation.test
at the end of a file name has special meaning to deno in that the file will run tests withdeno test
. havingtest
as part of the function makes file names less comprehensive (test_range.ts
andtest_range_test.ts
).Derivations
- The nameSee #4364includes
is borrowed fromArray.prototype.includes()
, which checks if an element is part of array.