Unpacked parameters are now sorted

This commit is contained in:
Zaid Abdulla committed 2016-08-16 13:12:52 -07:00
1 parent 12a6cd7d8b
commit 0b70658cd3
1 file changed
+20
+20
View File
@@ -199,6 +199,26 @@ function unpack(deviceData, path, revision) {
} }
} }
allMatches.sort(function(a, b) {
for (let i = 0; i < a.length; ++ i) {
if (a === b)
continue;
// Use numeric sorting for numbers
let ia = parseInt(a), ib = parseInt(b);
if (ia.toString() == a && ib.toString() == b) {
a = ia;
b = ib;
}
if (a < b)
return -1;
else
return 1;
}
return 0;
});
return allMatches; return allMatches;
} }