Skip to content

Commit cc6fde2

Browse files
committedJul 7, 2023
fix: trim each range set before parsing
Fixes #587
1 parent 99d8287 commit cc6fde2

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
 

‎classes/range.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Range {
3838
this.set = this.raw
3939
.split('||')
4040
// map the range to a 2d array of comparators
41-
.map(r => this.parseRange(r))
41+
.map(r => this.parseRange(r.trim()))
4242
// throw out any comparator lists that are empty
4343
// this generally means that it was not a valid range, which is allowed
4444
// in loose mode, but will still throw if the WHOLE range is invalid.

‎test/fixtures/range-exclude.js

+2
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,6 @@ module.exports = [
102102
['>=1.0.0 <1.1.0', '1.1.0', { includePrerelease: true }],
103103
['>=1.0.0 <1.1.0', '1.1.0-pre'],
104104
['>=1.0.0 <1.1.0-pre', '1.1.0-pre'],
105+
106+
['== 1.0.0 || foo', '2.0.0', { loose: true }],
105107
]

0 commit comments

Comments
 (0)
Please sign in to comment.