diff options
Diffstat (limited to 'deps/npm/node_modules/semver/semver.browser.js')
-rw-r--r-- | deps/npm/node_modules/semver/semver.browser.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/deps/npm/node_modules/semver/semver.browser.js b/deps/npm/node_modules/semver/semver.browser.js index 250885a7e7..b84228ab51 100644 --- a/deps/npm/node_modules/semver/semver.browser.js +++ b/deps/npm/node_modules/semver/semver.browser.js @@ -226,6 +226,12 @@ for (var i = 0; i < R; i++) { exports.parse = parse; function parse(version, loose) { + if (version instanceof SemVer) + return version; + + if (typeof version !== 'string') + return null; + if (version.length > MAX_LENGTH) return null; @@ -299,7 +305,12 @@ function SemVer(version, loose) { this.prerelease = []; else this.prerelease = m[4].split('.').map(function(id) { - return (/^[0-9]+$/.test(id)) ? +id : id; + if (/^[0-9]+$/.test(id)) { + var num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) + return num + } + return id; }); this.build = m[5] ? m[5].split('.') : []; |