extension-tools
Advanced tools
Comparing version 0.4.3 to 0.4.4
{ | ||
"name": "extension-tools", | ||
"version": "0.4.3", | ||
"version": "0.4.4", | ||
"description": "A collection of tools for automated publishing of browser extensions", | ||
@@ -5,0 +5,0 @@ "main": "exec.js", |
@@ -26,14 +26,13 @@ // Functions for validating, comparing and manipulating | ||
var aHead = aParts[0] || 0; | ||
var bHead = bParts[0] || 0; | ||
var partsLength = Math.max(aParts.length, bParts.length); | ||
if (aParts.length == 1 && bParts.length == 1) { | ||
return aHead < bHead; | ||
} else if (aHead != bHead) { | ||
return aHead < bHead; | ||
} else { | ||
var aTail = aParts.slice(1).join('.'); | ||
var bTail = bParts.slice(1).join('.'); | ||
return aHead < bHead || lessThan(aTail, bTail); | ||
for(var x = 0; x < partsLength; x++) { | ||
var aVal = isNaN(aParts[x]) ? 0 : +aParts[x]; | ||
var bVal = isNaN(bParts[x]) ? 0 : +bParts[x]; | ||
if (aVal !== bVal) { | ||
return aVal < bVal; | ||
} | ||
} | ||
// if we reached the end of the loop the 2 version are equals | ||
return false; | ||
} | ||
@@ -40,0 +39,0 @@ |
@@ -10,7 +10,12 @@ var expect = require('chai').expect; | ||
expect(extensionVersion.lessThan('1.0', '0.1')).to.equal(false); | ||
expect(extensionVersion.lessThan('1.0', '1')).to.equal(false); | ||
expect(extensionVersion.lessThan('1.0', '1.0.1')).to.equal(true); | ||
expect(extensionVersion.lessThan('1.0.9', '1.0.10')).to.equal(true); | ||
expect(extensionVersion.lessThan('1.0.10', '1.0.99')).to.equal(true); | ||
expect(extensionVersion.lessThan('10', '9')).to.equal(false); | ||
}); | ||
it('should increment versions', function() { | ||
@@ -17,0 +22,0 @@ expect(extensionVersion.increment('1.0.1', 0)).to.equal('2.0.1'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
28819
652