semver
Advanced tools
Comparing version 7.2.3 to 7.3.0
# changes log | ||
## 7.3.0 | ||
* Add `subset(r1, r2)` method to determine if `r1` range is entirely | ||
contained by `r2` range. | ||
## 7.2.3 | ||
* Fix handling of `includePrelease` mode where version ranges like `1.0.0 - | ||
2.0.0` would include `3.0.0-pre` and not `1.0.0-pre`. | ||
## 7.2.2 | ||
@@ -4,0 +14,0 @@ |
@@ -95,2 +95,3 @@ // hoisted class for cyclic dependency | ||
.split(/\s+/) | ||
.map(comp => replaceGTE0(comp, this.options)) | ||
// in loose mode, throw out any that are not valid comparators | ||
@@ -383,2 +384,8 @@ .filter(this.options.loose ? comp => !!comp.match(compRe) : () => true) | ||
const replaceGTE0 = (comp, options) => { | ||
debug('replaceGTE0', comp, options) | ||
return comp.trim() | ||
.replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '') | ||
} | ||
// This function is passed to string.replace(re[t.HYPHENRANGE]) | ||
@@ -385,0 +392,0 @@ // M, m, patch, prerelease, build |
@@ -47,2 +47,3 @@ // just pre-load all the stuff that index.js lazily exports | ||
simplifyRange: require('./ranges/simplify'), | ||
subset: require('./ranges/subset'), | ||
} |
@@ -180,1 +180,4 @@ const { MAX_SAFE_COMPONENT_LENGTH } = require('./constants') | ||
createToken('STAR', '(<|>)?=?\\s*\\*') | ||
// >=0.0.0 is like a star | ||
createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$') | ||
createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$') |
{ | ||
"name": "semver", | ||
"version": "7.2.3", | ||
"version": "7.3.0", | ||
"description": "The semantic version parser used by npm.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -82,2 +82,3 @@ semver(1) -- The semantic versioner for npm | ||
const simplifyRange = require('semver/ranges/simplify') | ||
const rangeSubset = require('semver/ranges/subset') | ||
``` | ||
@@ -459,2 +460,4 @@ | ||
generated range, then that is returned. | ||
* `subset(subRange, superRange)`: Return `true` if the `subRange` range is | ||
entirely contained by the `superRange` range. | ||
@@ -461,0 +464,0 @@ Note that, since ranges may be non-contiguous, a version might not be |
83770
51
1767
567