index.js
function read(fp, opts, fn) {
  opts = opts || {};
  opts.encoding = opts.encoding || 'utf8';

  if (opts.read) {
    return opts.read(fp, opts);
  } else if (fn) {
    return fn(fp, opts);
  }

  if (endsWith(fp, '.js')) {
    return tryRequire(fp);
  } else {
    var str = tryCatch(fs.readFileSync, fp, opts);
    if (endsWith(fp, '.json')) {
      return tryCatch(JSON.parse, str);
    }
    return str;
  }
}
function read(fp, opts, fn) {
  opts = opts || {};
  opts.encoding = opts.encoding || 'utf8';

  if (opts.read) {
    return opts.read(fp, opts);
  } else if (fn) {
    return fn(fp, opts);
  }

  if (endsWith(fp, '.js')) {
    return tryRequire(fp);
  } else {
    var str = tryCatch(fs.readFileSync, fp, opts);
    if (endsWith(fp, '.json')) {
      return tryCatch(JSON.parse, str);
    }
    return str;
  }
}
function read ( fp , opts , fn ) { opts = opts || { } ; opts . encoding = opts . encoding || 'utf8' ; if ( opts . read ) { return opts . read ( fp , opts ) ; } else if ( fn ) { return fn ( fp , opts ) ; } if ( endsWith ( fp , '.js' ) ) { return tryRequire ( fp ) ; } else { var str = tryCatch ( fs . readFileSync , fp , opts ) ; if ( endsWith ( fp , '.json' ) ) { return tryCatch ( JSON . parse , str ) ; } return str ; } }
Read or require the given file with `opts`
Read or require the given file with opts