Skip to content

Commit 3f222b1

Browse files
authoredApr 10, 2023
fix: reuse comparators on subset (#537)
1 parent 113f513 commit 3f222b1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed
 

‎ranges/subset.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ const subset = (sub, dom, options = {}) => {
6868
return true
6969
}
7070

71+
const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')]
72+
const minimumVersion = [new Comparator('>=0.0.0')]
73+
7174
const simpleSubset = (sub, dom, options) => {
7275
if (sub === dom) {
7376
return true
@@ -77,17 +80,17 @@ const simpleSubset = (sub, dom, options) => {
7780
if (dom.length === 1 && dom[0].semver === ANY) {
7881
return true
7982
} else if (options.includePrerelease) {
80-
sub = [new Comparator('>=0.0.0-0')]
83+
sub = minimumVersionWithPreRelease
8184
} else {
82-
sub = [new Comparator('>=0.0.0')]
85+
sub = minimumVersion
8386
}
8487
}
8588

8689
if (dom.length === 1 && dom[0].semver === ANY) {
8790
if (options.includePrerelease) {
8891
return true
8992
} else {
90-
dom = [new Comparator('>=0.0.0')]
93+
dom = minimumVersion
9194
}
9295
}
9396

0 commit comments

Comments
 (0)
Please sign in to comment.