src/yake/yakefile.js
function recursiveFindFile(aDirectory, arrayOfFileNames)
{
    if (debug) debugLog(`recursiveFindFile dir: ${aDirectory}, filenames: ${util.inspect(arrayOfFileNames)}`);
    // var directory = process.cwd();
    let directory = aDirectory;

    const tmp = directoryHasFile(directory, arrayOfFileNames);

    if ((tmp === undefined) && directory !== '/')
    {
        directory = path.dirname(directory);
        const anotherTmp = recursiveFindFile(directory, arrayOfFileNames);

        return anotherTmp;
    }
    else if (tmp === undefined)
    {
        // ran out of directories
        return undefined;
    }
    const p = path.resolve(directory, tmp);

    return p;
}
function recursiveFindFile(aDirectory, arrayOfFileNames)
{
    if (debug) debugLog(`recursiveFindFile dir: ${aDirectory}, filenames: ${util.inspect(arrayOfFileNames)}`);
    // var directory = process.cwd();
    let directory = aDirectory;

    const tmp = directoryHasFile(directory, arrayOfFileNames);

    if ((tmp === undefined) && directory !== '/')
    {
        directory = path.dirname(directory);
        const anotherTmp = recursiveFindFile(directory, arrayOfFileNames);

        return anotherTmp;
    }
    else if (tmp === undefined)
    {
        // ran out of directories
        return undefined;
    }
    const p = path.resolve(directory, tmp);

    return p;
}
function recursiveFindFile ( aDirectory , arrayOfFileNames ) { if ( debug ) debugLog ( ` ${ aDirectory } ${ util . inspect ( arrayOfFileNames ) } ` ) ; // var directory = process.cwd(); let directory = aDirectory ; const tmp = directoryHasFile ( directory , arrayOfFileNames ) ; if ( ( tmp === undefined ) && directory !== '/' ) { directory = path . dirname ( directory ) ; const anotherTmp = recursiveFindFile ( directory , arrayOfFileNames ) ; return anotherTmp ; } else if ( tmp === undefined ) { // ran out of directories return undefined ; } const p = path . resolve ( directory , tmp ) ; return p ; }
Search upwards from and including aDirectory to find one of the files named in arrayOfFiles
returns the full path of the file if it exists

@param   {string}                            path to a directory where the search should start
@param   {array of strings}                  arrayOfFileNames  The array of file names
@return  {string | undefined}                full path of the jakefile that was found or undefined if none found
Search upwards from and including aDirectory to find one of the files named in arrayOfFiles returns the full path of the file if it exists