code: function resolveName(pkgpath) {
    pkgpath = pkgpath.replace(RE_TRAILING, '');
  
    const cwd = process.cwd();
    const parts = pkgpath.split(path.sep);
    const len = parts.length;
  
    let idx = 1;
  
    // Handle packages nested under root
    if (!pkgpath.includes('node_modules') && cwd != pkgpath) {
      // Increase by distance from root
      idx += path.relative(cwd, pkgpath).split(path.sep).length;
      // Handle scoped node_modules
    } else if (parts[len - 2].charAt(0) == '@') {
      idx = 2;
    }
  
    return parts.slice(len - idx).join(path.sep);
  }
docs: Resolve package name from 'pkgpath'
  @param {String} pkgpath
  @returns {String}