index.js
/**
 * Goes up folder hierarchy looking for encrypted file; search stops when either root folder or folder with 'package.json' is reached
 * @param     {String}     file     the file to look for
 * @returns   {String}              the full pathname of passed @file or throws error if not found
 */
Goes up folder hierarchy looking for encrypted file; search stops when either root folder or folder with 'package.json' is reached
@param     {String}     file     the file to look for
@returns   {String}              the full pathname of passed @file or throws error if not found
Goes up folder hierarchy looking for encrypted file ; search stops when either root folder or folder with ' package . json ' is reached @param { String } file the file to look for @returns { String } the full pathname of passed @file or throws error if not found
function findFileLocation(file) {
  let location = './';
  while (true) {
    if (exists(location + file)) {
      break;
    } else if (exists(location + 'package.json') || location === '/') {
      throw new Error(`Failed to find file "${file}" within the project`);
    }
    location = path.resolve('../' + location) + '/';
  }
  return location;
}
function findFileLocation ( file ) { let location = './' ; while ( true ) { if ( exists ( location + file ) ) { break ; } else if ( exists ( location + 'package.json' ) || location === '/' ) { throw new Error ( ` ${ file } ` ) ; } location = path . resolve ( '../' + location ) + '/' ; } return location ; }
Goes up folder hierarchy looking for encrypted file; search stops when either root folder or folder with 'package.json' is reached
 @param     {String}     file     the file to look for
 @returns   {String}              the full pathname of passed @file or throws error if not found
Goes up folder hierarchy looking for encrypted file ; search stops when either root folder or folder with ' package . json ' is reached @param { String } file the file to look for @returns { String } the full pathname of passed @file or throws error if not found
// Assumption is that reaching the app root folder or the system '/' marks the end of the search // Go one level up