function recursiveFileSearch(dir, exclude) {
  let entitiesInDir, dirsInDir, filesInDir;
  // Get everything in the directory first
  entitiesInDir = fs.readdirSync(dir);
  // Filter out everything that's not allowed
  entitiesInDir = entitiesInDir.filter((entity) => {
    if (exclude.includes(entity)) return false;
    if (entity.charAt(0) == '.' || entity.charAt(0) == '_') return false;
    return true;
  });
  // Separate the directories and files
  filesInDir = [];
  dirsInDir = entitiesInDir.filter((entity) => {
    // if it's a directory keep it so it can be stored in dirsInDir
    if (fs.lstatSync(`${dir}/${entity}`).isDirectory()) return true;
    // otherwise add it to our list of files
    filesInDir.push(`${dir}/${entity}`);
    // and filter it out by returning false
    return false;
  });
  // Add all of the files in the directories we found in our main files array
  dirsInDir.forEach((subDir) => {
    filesInDir = filesInDir.concat(recursiveFileSearch(`${dir}/${subDir}`, []));
  });
  // Return our main files array
  return filesInDir;
}
/**
 *
 * @param {string} dir the directory with which to search for files
 * @param {array<string>} exclude A list of files / directories to exclude in
 *                                file search
 * @returns {array<string>} an array of all of the paths of the found files
 */
@param {string} dir the directory with which to search for files
@param {array} exclude A list of files / directories to exclude in
file search
@returns {array} an array of all of the paths of the found files
@param { string } dir the directory with which to search for files @param { array } exclude A list of files / directories to exclude in file search @returns { array } an array of all of the paths of the found files
function recursiveFileSearch(dir, exclude) {
  let entitiesInDir, dirsInDir, filesInDir;
  entitiesInDir = fs.readdirSync(dir);
  entitiesInDir = entitiesInDir.filter((entity) => {
    if (exclude.includes(entity)) return false;
    if (entity.charAt(0) == '.' || entity.charAt(0) == '_') return false;
    return true;
  });
  filesInDir = [];
  dirsInDir = entitiesInDir.filter((entity) => {
    if (fs.lstatSync(`${dir}/${entity}`).isDirectory()) return true;
    filesInDir.push(`${dir}/${entity}`);
    return false;
  });
  dirsInDir.forEach((subDir) => {
    filesInDir = filesInDir.concat(recursiveFileSearch(`${dir}/${subDir}`, []));
  });
  return filesInDir;
}
function recursiveFileSearch ( dir , exclude ) { let entitiesInDir , dirsInDir , filesInDir ; entitiesInDir = fs . readdirSync ( dir ) ; entitiesInDir = entitiesInDir . filter ( ( entity ) => { if ( exclude . includes ( entity ) ) return false ; if ( entity . charAt ( 0 ) == '.' || entity . charAt ( 0 ) == '_' ) return false ; return true ; } ) ; filesInDir = [ ] ; dirsInDir = entitiesInDir . filter ( ( entity ) => { if ( fs . lstatSync ( ` ${ dir } ${ entity } ` ) . isDirectory ( ) ) return true ; filesInDir . push ( ` ${ dir } ${ entity } ` ) ; return false ; } ) ; dirsInDir . forEach ( ( subDir ) => { filesInDir = filesInDir . concat ( recursiveFileSearch ( ` ${ dir } ${ subDir } ` , [ ] ) ) ; } ) ; return filesInDir ; }
@param {string} dir the directory with which to search for files
 @param {array<string>} exclude A list of files / directories to exclude in
                                file search
 @returns {array<string>} an array of all of the paths of the found files
@param { string } dir the directory with which to search for files @param { array<string > } exclude A list of files / directories to exclude in file search @returns { array<string > } an array of all of the paths of the found files
// Get everything in the directory first // Filter out everything that's not allowed // Separate the directories and files // if it's a directory keep it so it can be stored in dirsInDir // otherwise add it to our list of files // and filter it out by returning false // Add all of the files in the directories we found in our main files array // Return our main files array