function ancestors(first, second) {
  var path = [];

  for (var n in first.path) {
    if (first.path[n] !== second.path[n]) break;
    path.push(first.path[n]);
  }
  return path;
}
Finds the common ancestor path between two states.

@param {Object} first The first state.
@param {Object} second The second state.
@return {Array} Returns an array of state names in descending order, not including the root.