code: function relative(a, b, stat) {
    if (typeof a !== 'string') {
      throw new TypeError('relative expects a string.');
    }
  
    if (a == '' && !b) return a;
  
    var len = arguments.length;
    if (len === 1) {
      b = a; a = process.cwd(); stat = null;
    }
  
    if (len === 2 && typeof b === 'boolean') {
      b = a; a = process.cwd(); stat = true;
    }
  
    if (len === 2 && typeof b === 'object') {
      stat = b; b = a; a = process.cwd();
    }
  
    var origB = b;
  
    // see if a slash exists before normalizing
    var slashA = endsWith(a, '/');
    var slashB = endsWith(b, '/');
  
    a = unixify(a);
    b = unixify(b);
  
    // if `a` had a slash, add it back
    if (slashA) { a = a + '/'; }
  
    if (isFile(a, stat)) {
      a = path.dirname(a);
    }
  
    var res = path.relative(a, b);
    if (res === '') {
      return '.';
    }
  
    // if `b` originally had a slash, and the path ends
    // with `b` missing a slash, then re-add the slash.
    var noslash = trimEnd(origB, '/');
    if (slashB && (res === noslash || endsWith(res, noslash))) {
      res = res + '/';
    }
    return res;
  }
docs: Get the relative path from `a` to `b`.