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
373 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 second (ie. new) one in the case of a 'tie', to deal with eg. normalization code improvements
return b;
}
};