index.js
function findFileLocation(file) {
  let location = './';
  while (true) {
    if (exists(location + file)) {
      break;
    } else if (exists(location + 'package.json') || location === '/') {
      // Assumption is that reaching the app root folder or the system '/' marks the end of the search
      throw new Error(`Failed to find file "${file}" within the project`);
    }
    // Go one level up
    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 === '/') {
      // Assumption is that reaching the app root folder or the system '/' marks the end of the search
      throw new Error(`Failed to find file "${file}" within the project`);
    }
    // Go one level up
    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 === '/' ) { // Assumption is that reaching the app root folder or the system '/' marks the end of the search throw new Error ( ` ${ file } ` ) ; } // Go one level up 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