local-cli/util/Config.js
function findParentDirectory(currentFullPath, filename) {
  const root = path.parse(currentFullPath).root;
  const testDir = (parts) => {
    if (parts.length === 0) {
      return null;
    }

    const fullPath = path.join(root, parts.join(path.sep));

    var exists = fs.existsSync(path.join(fullPath, filename));
    return exists ? fullPath : testDir(parts.slice(0, -1));
  };

  return testDir(currentFullPath.substring(root.length).split(path.sep));
}
function findParentDirectory(currentFullPath, filename) {
  const root = path.parse(currentFullPath).root;
  const testDir = (parts) => {
    if (parts.length === 0) {
      return null;
    }

    const fullPath = path.join(root, parts.join(path.sep));

    var exists = fs.existsSync(path.join(fullPath, filename));
    return exists ? fullPath : testDir(parts.slice(0, -1));
  };

  return testDir(currentFullPath.substring(root.length).split(path.sep));
}
function findParentDirectory ( currentFullPath , filename ) { const root = path . parse ( currentFullPath ) . root ; const testDir = ( parts ) => { if ( parts . length === 0 ) { return null ; } const fullPath = path . join ( root , parts . join ( path . sep ) ) ; var exists = fs . existsSync ( path . join ( fullPath , filename ) ) ; return exists ? fullPath : testDir ( parts . slice ( 0 , - 1 ) ) ; } ; return testDir ( currentFullPath . substring ( root . length ) . split ( path . sep ) ) ; }
Finds the most near ancestor starting at `currentFullPath` that has a file named `filename`
Finds the most near ancestor starting at currentFullPath that has a file named filename