Comparing version 6.0.0 to 6.1.0
{ | ||
"name": "semver", | ||
"version": "6.0.0", | ||
"version": "6.1.0", | ||
"description": "The semantic version parser used by npm.", | ||
@@ -10,6 +10,6 @@ "main": "semver.js", | ||
"postversion": "npm publish", | ||
"postpublish": "git push origin --all; git push origin --tags" | ||
"postpublish": "git push origin --follow-tags" | ||
}, | ||
"devDependencies": { | ||
"tap": "^13.0.0-rc.18" | ||
"tap": "^14.1.6" | ||
}, | ||
@@ -16,0 +16,0 @@ "license": "ISC", |
@@ -7,3 +7,3 @@ semver(1) -- The semantic versioner for npm | ||
```bash | ||
npm install --save semver | ||
npm install semver | ||
```` | ||
@@ -235,3 +235,3 @@ | ||
Allows changes that do not modify the left-most non-zero digit in the | ||
Allows changes that do not modify the left-most non-zero element in the | ||
`[major, minor, patch]` tuple. In other words, this allows patch and | ||
@@ -359,2 +359,5 @@ minor updates for versions `1.0.0` and above, patch updates for | ||
in descending order when passed to `Array.sort()`. | ||
* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions | ||
are equal. Sorts in ascending order if passed to `Array.sort()`. | ||
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`. | ||
* `diff(v1, v2)`: Returns difference between two versions by the release type | ||
@@ -361,0 +364,0 @@ (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), |
@@ -428,2 +428,26 @@ exports = module.exports = SemVer | ||
SemVer.prototype.compareBuild = function (other) { | ||
if (!(other instanceof SemVer)) { | ||
other = new SemVer(other, this.options) | ||
} | ||
var i = 0 | ||
do { | ||
var a = this.build[i] | ||
var b = other.build[i] | ||
debug('prerelease compare', i, a, b) | ||
if (a === undefined && b === undefined) { | ||
return 0 | ||
} else if (b === undefined) { | ||
return 1 | ||
} else if (a === undefined) { | ||
return -1 | ||
} else if (a === b) { | ||
continue | ||
} else { | ||
return compareIdentifiers(a, b) | ||
} | ||
} while (++i) | ||
} | ||
// preminor will bump the version up to the next minor release, and immediately | ||
@@ -623,2 +647,9 @@ // down to pre-release. premajor and prepatch work the same way. | ||
exports.compareBuild = compareBuild | ||
function compareBuild (a, b, loose) { | ||
var versionA = new SemVer(a, loose) | ||
var versionB = new SemVer(b, loose) | ||
return versionA.compare(versionB) || versionA.compareBuild(versionB) | ||
} | ||
exports.rcompare = rcompare | ||
@@ -632,3 +663,3 @@ function rcompare (a, b, loose) { | ||
return list.sort(function (a, b) { | ||
return exports.compare(a, b, loose) | ||
return exports.compareBuild(a, b, loose) | ||
}) | ||
@@ -640,3 +671,3 @@ } | ||
return list.sort(function (a, b) { | ||
return exports.rcompare(a, b, loose) | ||
return exports.compareBuild(b, a, loose) | ||
}) | ||
@@ -761,3 +792,3 @@ } | ||
this.operator = m[1] | ||
this.operator = m[1] !== undefined ? m[1] : '' | ||
if (this.operator === '=') { | ||
@@ -782,3 +813,3 @@ this.operator = '' | ||
if (this.semver === ANY) { | ||
if (this.semver === ANY || version === ANY) { | ||
return true | ||
@@ -809,5 +840,11 @@ } | ||
if (this.operator === '') { | ||
if (this.value === '') { | ||
return true | ||
} | ||
rangeTmp = new Range(comp.value, options) | ||
return satisfies(this.value, rangeTmp, options) | ||
} else if (comp.operator === '') { | ||
if (comp.value === '') { | ||
return true | ||
} | ||
rangeTmp = new Range(this.value, options) | ||
@@ -1229,6 +1266,2 @@ return satisfies(comp.semver, rangeTmp, options) | ||
Range.prototype.test = function (version) { | ||
if (!version) { | ||
return false | ||
} | ||
if (typeof version === 'string') { | ||
@@ -1235,0 +1268,0 @@ version = new SemVer(version, this.options) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63544
1321
415