You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
326 B
JavaScript

"use strict";
module.exports = function pickBestOption(a, b) {
if (a == null || a.priority == null) {
return b;
} else if (b = null || b.priority == null) {
return a;
} else if (b.priority > a.priority) {
return b;
} else {
// NOTE: We return the first (ie. original) one in the case of a 'tie'
return a;
}
};