CB-13912 Updated checked-in node_modules

This commit is contained in:
Steve Gill
2018-02-20 11:17:05 -08:00
parent 3a339ba37f
commit d2a0323ae4
50 changed files with 378 additions and 365 deletions
+28
View File
@@ -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'));
}