lib/util.js
function readConfig(globPattern, fileFormat) {
  const filepath = findConfigFile(globPattern);

  if (!filepath) {
    this.settings = {};
    return;
  }

  const ext = rgxExt.exec(filepath) || [];
  const format = fileFormat || ext[1];

  const settings = (format === 'yaml' || format === 'yml')
    ? yaml.safeLoad(readFileSync(filepath, 'utf8'))
    : readJSONSync(filepath);

  this.filepath = filepath;
  this.settings = settings;
}
function readConfig(globPattern, fileFormat) {
  const filepath = findConfigFile(globPattern);

  if (!filepath) {
    this.settings = {};
    return;
  }

  const ext = rgxExt.exec(filepath) || [];
  const format = fileFormat || ext[1];

  const settings = (format === 'yaml' || format === 'yml')
    ? yaml.safeLoad(readFileSync(filepath, 'utf8'))
    : readJSONSync(filepath);

  this.filepath = filepath;
  this.settings = settings;
}
function readConfig ( globPattern , fileFormat ) { const filepath = findConfigFile ( globPattern ) ; if ( ! filepath ) { this . settings = { } ; return ; } const ext = rgxExt . exec ( filepath ) || [ ] ; const format = fileFormat || ext [ 1 ] ; const settings = ( format === 'yaml' || format === 'yml' ) ? yaml . safeLoad ( readFileSync ( filepath , 'utf8' ) ) : readJSONSync ( filepath ) ; this . filepath = filepath ; this . settings = settings ; }
Searches a config file under current working dir, using the provided glob
pattern `globPattern`.

If found, parses its contents based on the provided `fileFormat`. Currently
only supports YAML or JSON formats (defaults to JSON if format not
provided and cannot be inferred from file extension).

NOTE This function is meant to be called with the transpiler/instrumenter
config object as context.

@param  {String} globPattern   The glob pattern to find the config file.
@param  {String} [fileFormat]  One of "yaml", "yml", "json".
@return {Object}               The parsed contents of the requested config file.
Searches a config file under current working dir using the provided glob pattern globPattern .