@@ -4150,6 +4150,7 @@ const isSatisfiable = (comparators, options) => {
41504150// already replaced the hyphen ranges
41514151// turn into a set of JUST comparators.
41524152const parseComparator = (comp, options) => {
4153+ comp = comp.replace(re[t.BUILD], '')
41534154 debug('comp', comp, options)
41544155 comp = replaceCarets(comp, options)
41554156 debug('caret', comp)
@@ -4569,11 +4570,25 @@ class SemVer {
45694570 other = new SemVer(other, this.options)
45704571 }
45714572
4572- return (
4573- compareIdentifiers(this.major, other.major) ||
4574- compareIdentifiers(this.minor, other.minor) ||
4575- compareIdentifiers(this.patch, other.patch)
4576- )
4573+ if (this.major < other.major) {
4574+ return -1
4575+ }
4576+ if (this.major > other.major) {
4577+ return 1
4578+ }
4579+ if (this.minor < other.minor) {
4580+ return -1
4581+ }
4582+ if (this.minor > other.minor) {
4583+ return 1
4584+ }
4585+ if (this.patch < other.patch) {
4586+ return -1
4587+ }
4588+ if (this.patch > other.patch) {
4589+ return 1
4590+ }
4591+ return 0
45774592 }
45784593
45794594 comparePre (other) {
@@ -5446,6 +5461,10 @@ module.exports = debug
54465461
54475462const numeric = /^[0-9]+$/
54485463const compareIdentifiers = (a, b) => {
5464+ if (typeof a === 'number' && typeof b === 'number') {
5465+ return a === b ? 0 : a < b ? -1 : 1
5466+ }
5467+
54495468 const anum = numeric.test(a)
54505469 const bnum = numeric.test(b)
54515470
0 commit comments