function searchFromPivot(matchingSet, order, pivot, dir) {
  var i;

  for (i = pivot; i >= 0 && i < order.length; i += dir) {
    if (matchingSet[order[i]]) {
      return matchingSet[order[i]];
    }
  }

  for (i = pivot; i >= 0 && i < order.length; i -= dir) {
    if (matchingSet[order[i]]) {
      return matchingSet[order[i]];
    }
  }
}
Searches a map of stretches, weights, etc. in the given direction and
then, if no match has been found, in the opposite directions.

@param {Object.<string, any>} matchingSet A map of the various font variations.
@param {any[]} order The order of the different variations
@param {number} pivot The starting point of the search in the order list.
@param {number} dir The initial direction of the search (desc = -1, asc = 1)
@private