Skip to content

Commit

Permalink
fix: Improve performance of isSatisfiable function
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Bittman authored and isaacs committed Mar 26, 2019
1 parent 9b8e961 commit 673e820
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions semver.js
Original file line number Diff line number Diff line change
Expand Up @@ -934,13 +934,19 @@ Range.prototype.intersects = function (range, options) {
}

return this.set.some(function (thisComparators) {
return range.set.some(function (rangeComparators) {
return isSatisfiable(thisComparators, options) && thisComparators.every(function (thisComparator) {
return isSatisfiable(rangeComparators, options) && rangeComparators.every(function (rangeComparator) {
return thisComparator.intersects(rangeComparator, options)
})
return (
isSatisfiable(thisComparators, options) &&
range.set.some(function (rangeComparators) {
return (
isSatisfiable(rangeComparators, options) &&
thisComparators.every(function (thisComparator) {
return rangeComparators.every(function (rangeComparator) {
return thisComparator.intersects(rangeComparator, options)
})
})
)
})
})
)
})
}

Expand Down

0 comments on commit 673e820

Please sign in to comment.