compare-versions
Advanced tools
Comparing version 2.0.0 to 2.0.1
{ | ||
"name": "compare-versions", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Compare semver version strings to find greater, equal or lesser.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -34,3 +34,3 @@ /* global define */ | ||
if ((s1[2] + s2[2]).indexOf('-') > -1) { | ||
if ((s1[2] + s2[2] + '').indexOf('-') > -1) { | ||
var p1 = (patchPattern.exec(s1[2]) || [''])[0]; | ||
@@ -37,0 +37,0 @@ var p2 = (patchPattern.exec(s2[2]) || [''])[0]; |
{ | ||
"name": "compare-versions", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Compare semver version strings to find greater, equal or lesser.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,3 +5,3 @@ var assert = require('assert'); | ||
describe('compare versions', function () { | ||
it('should compare versions correctly', function () { | ||
it('should compare three-segment versions correctly', function () { | ||
assert.equal(compare('10.1.8', '10.0.4'), 1); | ||
@@ -12,2 +12,14 @@ assert.equal(compare('10.0.1', '10.0.1'), 0); | ||
it('should compare two-segment versions correctly', function () { | ||
assert.equal(compare('10.8', '10.4'), 1); | ||
assert.equal(compare('10.1', '10.1'), 0); | ||
assert.equal(compare('10.1', '10.2'), -1); | ||
}); | ||
it('should compare single-segment versions correctly', function () { | ||
assert.equal(compare('10', '9'), 1); | ||
assert.equal(compare('10', '10'), 0); | ||
assert.equal(compare('9', '10'), -1); | ||
}); | ||
it('should compare versions with different number of digits in same group', function () { | ||
@@ -14,0 +26,0 @@ assert.equal(compare('11.0.10', '11.0.2'), 1); |
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
10218
218