semver 7.7.2 → 7.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/classes/range.js CHANGED
@@ -255,6 +255,7 @@ const isSatisfiable = (comparators, options) => {
255
255
  // already replaced the hyphen ranges
256
256
  // turn into a set of JUST comparators.
257
257
  const parseComparator = (comp, options) => {
258
+ comp = comp.replace(re[t.BUILD], '')
258
259
  debug('comp', comp, options)
259
260
  comp = replaceCarets(comp, options)
260
261
  debug('caret', comp)
package/classes/semver.js CHANGED
@@ -111,11 +111,25 @@ class SemVer {
111
111
  other = new SemVer(other, this.options)
112
112
  }
113
113
 
114
- return (
115
- compareIdentifiers(this.major, other.major) ||
116
- compareIdentifiers(this.minor, other.minor) ||
117
- compareIdentifiers(this.patch, other.patch)
118
- )
114
+ if (this.major < other.major) {
115
+ return -1
116
+ }
117
+ if (this.major > other.major) {
118
+ return 1
119
+ }
120
+ if (this.minor < other.minor) {
121
+ return -1
122
+ }
123
+ if (this.minor > other.minor) {
124
+ return 1
125
+ }
126
+ if (this.patch < other.patch) {
127
+ return -1
128
+ }
129
+ if (this.patch > other.patch) {
130
+ return 1
131
+ }
132
+ return 0
119
133
  }
120
134
 
121
135
  comparePre (other) {
@@ -2,6 +2,10 @@
2
2
 
3
3
  const numeric = /^[0-9]+$/
4
4
  const compareIdentifiers = (a, b) => {
5
+ if (typeof a === 'number' && typeof b === 'number') {
6
+ return a === b ? 0 : a < b ? -1 : 1
7
+ }
8
+
5
9
  const anum = numeric.test(a)
6
10
  const bnum = numeric.test(b)
7
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "semver",
3
- "version": "7.7.2",
3
+ "version": "7.7.3",
4
4
  "description": "The semantic version parser used by npm.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "devDependencies": {
17
17
  "@npmcli/eslint-config": "^5.0.0",
18
- "@npmcli/template-oss": "4.24.3",
18
+ "@npmcli/template-oss": "4.25.1",
19
19
  "benchmark": "^2.1.4",
20
20
  "tap": "^16.0.0"
21
21
  },
@@ -52,7 +52,7 @@
52
52
  "author": "GitHub Inc.",
53
53
  "templateOSS": {
54
54
  "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
55
- "version": "4.24.3",
55
+ "version": "4.25.1",
56
56
  "engines": ">=10",
57
57
  "distPaths": [
58
58
  "classes/",