diff --git a/lib/device.js b/lib/device.js index 9e05bd4..ba2c2af 100644 --- a/lib/device.js +++ b/lib/device.js @@ -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; }