feat(semver): add minVersion and coerce functions#7038
Open
sxzz wants to merge 5 commits intodenoland:mainfrom
Open
feat(semver): add minVersion and coerce functions#7038sxzz wants to merge 5 commits intodenoland:mainfrom
minVersion and coerce functions#7038sxzz wants to merge 5 commits intodenoland:mainfrom
Conversation
Add `minVersion(range)` which returns the lowest SemVer that satisfies a given range, ported from node-semver's `minVersion`. Add `coerce(version, options?)` which extracts a valid SemVer from a loosely-formatted string or number, ported from node-semver's `coerce`. Supports `rtl` and `includePrerelease` options.
d53090b to
2f1e752
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7038 +/- ##
==========================================
- Coverage 93.88% 93.87% -0.01%
==========================================
Files 627 629 +2
Lines 49995 50117 +122
Branches 8794 8833 +39
==========================================
+ Hits 46936 47047 +111
- Misses 2478 2484 +6
- Partials 581 586 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
|
Looks good 😊 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
minVersion(range)which returns the lowest SemVer that satisfies a given range, ported from node-semver'sminVersioncoerce(version, options?)which extracts a valid SemVer from a loosely-formatted string or number, ported from node-semver'scoerce. SupportsrtlandincludePrereleaseoptionsTest plan
deno test semver/min_version_test.ts— 26 test cases passdeno test semver/coerce_test.ts— 20 test cases passdeno checkpasses for both files