lib/middleware.js
function compare(pathA, pathB) {
  pathA = pathA.split(sep);
  pathB = pathB.split('/');
  if (!pathA[pathA.length - 1]) pathA.pop();
  if (!pathB[0]) pathB.shift();
  var overlap = [];

  while (pathA[pathA.length - 1] == pathB[0]) {
    overlap.push(pathA.pop());
    pathB.shift();
  }
  return overlap.join('/');
}
function compare(pathA, pathB) {
  pathA = pathA.split(sep);
  pathB = pathB.split('/');
  if (!pathA[pathA.length - 1]) pathA.pop();
  if (!pathB[0]) pathB.shift();
  var overlap = [];

  while (pathA[pathA.length - 1] == pathB[0]) {
    overlap.push(pathA.pop());
    pathB.shift();
  }
  return overlap.join('/');
}
function compare ( pathA , pathB ) { pathA = pathA . split ( sep ) ; pathB = pathB . split ( '/' ) ; if ( ! pathA [ pathA . length - 1 ] ) pathA . pop ( ) ; if ( ! pathB [ 0 ] ) pathB . shift ( ) ; var overlap = [ ] ; while ( pathA [ pathA . length - 1 ] == pathB [ 0 ] ) { overlap . push ( pathA . pop ( ) ) ; pathB . shift ( ) ; } return overlap . join ( '/' ) ; }
get the overlaping path from the end of path A, and the begining of path B.

@param {String} pathA
@param {String} pathB
@return {String}
@api private
get the overlaping path from the end of path A and the begining of path B .