-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathutil.js
More file actions
27 lines (22 loc) · 764 Bytes
/
util.js
File metadata and controls
27 lines (22 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
define(function(require, exports, module){
"use strict";
var versionCompare = function(left, right) {
if (typeof left + typeof right !== 'stringstring') {
return false;
}
var a = left.split('.'),
b = right.split('.'),
len = Math.max(a.length, b.length);
for (i = 0; i < len; i = i + 1) {
if ((a[i] && !b[i] && parseInt(a[i]) > 0) || (parseInt(a[i]) > parseInt(b[i]))) {
return 1;
} else if ((b[i] && !a[i] && parseInt(b[i]) > 0) || (parseInt(a[i]) < parseInt(b[i]))) {
return -1;
}
}
return 0;
};
return {
versionCompare: versionCompare
};
});