Skip to content
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: trim each range set before parsing #588

Merged
merged 1 commit into from Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion classes/range.js
Expand Up @@ -38,7 +38,7 @@ class Range {
this.set = this.raw
.split('||')
// map the range to a 2d array of comparators
.map(r => this.parseRange(r))
.map(r => this.parseRange(r.trim()))
// throw out any comparator lists that are empty
// this generally means that it was not a valid range, which is allowed
// in loose mode, but will still throw if the WHOLE range is invalid.
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/range-exclude.js
Expand Up @@ -102,4 +102,6 @@ module.exports = [
['>=1.0.0 <1.1.0', '1.1.0', { includePrerelease: true }],
['>=1.0.0 <1.1.0', '1.1.0-pre'],
['>=1.0.0 <1.1.0-pre', '1.1.0-pre'],

['== 1.0.0 || foo', '2.0.0', { loose: true }],
]