mirror of
https://github.com/apache/cordova-android.git
synced 2026-04-23 00:00:09 +08:00
CB-13912 Updated checked-in node_modules
This commit is contained in:
+28
@@ -21,6 +21,9 @@ exports.SEMVER_SPEC_VERSION = '2.0.0';
|
||||
var MAX_LENGTH = 256;
|
||||
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
||||
|
||||
// Max safe segment length for coercion.
|
||||
var MAX_SAFE_COMPONENT_LENGTH = 16;
|
||||
|
||||
// The actual regexps go on exports.re
|
||||
var re = exports.re = [];
|
||||
var src = exports.src = [];
|
||||
@@ -156,6 +159,15 @@ src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$';
|
||||
var XRANGELOOSE = R++;
|
||||
src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$';
|
||||
|
||||
// Coercion.
|
||||
// Extract anything that could conceivably be a part of a valid semver
|
||||
var COERCE = R++;
|
||||
src[COERCE] = '(?:^|[^\\d])' +
|
||||
'(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' +
|
||||
'(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
|
||||
'(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
|
||||
'(?:$|[^\\d])';
|
||||
|
||||
// Tilde ranges.
|
||||
// Meaning is "reasonably at or greater than"
|
||||
var LONETILDE = R++;
|
||||
@@ -1294,3 +1306,19 @@ function intersects(r1, r2, loose) {
|
||||
r2 = new Range(r2, loose)
|
||||
return r1.intersects(r2)
|
||||
}
|
||||
|
||||
exports.coerce = coerce;
|
||||
function coerce(version) {
|
||||
if (version instanceof SemVer)
|
||||
return version;
|
||||
|
||||
if (typeof version !== 'string')
|
||||
return null;
|
||||
|
||||
var match = version.match(re[COERCE]);
|
||||
|
||||
if (match == null)
|
||||
return null;
|
||||
|
||||
return parse((match[1] || '0') + '.' + (match[2] || '0') + '.' + (match[3] || '0'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user