Index: lib/coreUtils.js |
=================================================================== |
--- a/lib/coreUtils.js |
+++ b/lib/coreUtils.js |
@@ -34,3 +34,23 @@ |
return Object.create(cls.prototype, desc(properties)); |
} |
exports.extend = extend; |
+ |
+function compareVersion(v1, v2) |
+{ |
+ let components1 = v1.split("."); |
+ let components2 = v2.split("."); |
+ let result = 0; |
+ |
+ for (let i = 0; result == 0 && (i < components1.length || |
+ i < components2.length); i++) |
+ { |
+ let comp1 = components1[i]; |
+ let comp2 = components2[i]; |
+ |
+ result = (comp1 == "*" ? Infinity : parseInt(comp1, 10) || 0) - |
+ (comp2 == "*" ? Infinity : parseInt(comp2, 10) || 0) || 0; |
+ } |
+ |
+ return result; |
+} |
+exports.compareVersion = compareVersion; |