function solveRelativePath(base, to) {
  var solvedPath = []; // Coercing to array

  to = [].concat(to);

  for (var i = 0, l = to.length; i < l; i++) {
    var step = to[i];

    if (step === '.') {
      if (!i) solvedPath = base.slice(0);
    } else if (step === '..') {
      solvedPath = (!i ? base : solvedPath).slice(0, -1);
    } else {
      solvedPath.push(step);
    }
  }

  return solvedPath;
}
Solving a potentially relative path.

@param  {array} base - The base path from which to solve the path.
@param  {array} to   - The subpath to reach.
@param  {array}      - The solved absolute path.