function findFile(name, cwd) {
  cwd = cwd || process.cwd();

  var filename = path.normalize(path.join(cwd, name));
  if (findFileResults[filename] !== undefined) {
    return findFileResults[filename];
  }

  var parent = path.resolve(cwd, "../");

  if (fsUtils.exists(filename)) {
    findFileResults[filename] = filename;
    return filename;
  }

  if (cwd === parent) {
    findFileResults[filename] = null;
    return null;
  }

  return findFile(name, parent);
}
Searches for a file with a specified name starting with
'dir' and going all the way up either until it finds the file
or hits the root.

@param {string} name filename to search for (e.g. .jshintrc)
@param {string} dir  directory to start search from (default:
                     current working directory)

@returns {string} normalized filename