import hasOwnProp from "../utils/has-own-prop.js";
var priorities = {};
export function addUnitPriority(unit, priority) {
  priorities[unit] = priority;
}
export function getPrioritizedUnits(unitsObj) {
  var units = [],
      u;

  for (u in unitsObj) {
    if (hasOwnProp(unitsObj, u)) {
      units.push({
        unit: u,
        priority: priorities[u]
      });
    }
  }

  units.sort(function (a, b) {
    return a.priority - b.priority;
  });
  return units;
}