appcenter-cli
Version:
Command line tool for Visual Studio App Center
40 lines (39 loc) • 1.36 kB
JavaScript
;
// From appcenter testCloud utils
Object.defineProperty(exports, "__esModule", { value: true });
exports.DeviceConfigurationSort = void 0;
const compareVersionNumbers_1 = require("./compareVersionNumbers");
/**
* Sort Device Configurations in the order: phone, tablet, os (desc), model (desc).
*
* @export
* @class DeviceConfigurationSort
*/
var DeviceConfigurationSort;
(function (DeviceConfigurationSort) {
function compare(d1, d2) {
if (d1.model.formFactor !== d2.model.formFactor) {
// Phones appear first.
if (d1.model.formFactor === "phone") {
return -1;
}
else if (d2.model.formFactor === "phone") {
return 1;
}
}
else if (d1.os !== d2.os) {
return compareVersionNumbers_1.CompareVersionNumbers.compareDesc(d1.os, d2.os);
}
else if (d1.model.model !== d2.model.model) {
// Sorts model descending
if (d1.model.model < d2.model.model) {
return 1;
}
else if (d1.model.model > d2.model.model) {
return -1;
}
}
return 0;
}
DeviceConfigurationSort.compare = compare;
})(DeviceConfigurationSort = exports.DeviceConfigurationSort || (exports.DeviceConfigurationSort = {}));