lib/shared.js
function match(self, dirname, basename, callback) {
  var pathname, stats, pattern, matches;

  pattern = patternFor(self, basename);
  matches = self.entries(dirname).filter(function(m) { return pattern.test(m); });
  matches = sortMatches(self, matches, basename);

  while (matches.length) {
    pathname  = path.join(dirname, matches.shift());
    stats     = self.stat(pathname);

    if (stats && stats.isFile() && callback(pathname)) {
      return pathname;
    }
  }
}
function match(self, dirname, basename, callback) {
  var pathname, stats, pattern, matches;

  pattern = patternFor(self, basename);
  matches = self.entries(dirname).filter(function(m) { return pattern.test(m); });
  matches = sortMatches(self, matches, basename);

  while (matches.length) {
    pathname  = path.join(dirname, matches.shift());
    stats     = self.stat(pathname);

    if (stats && stats.isFile() && callback(pathname)) {
      return pathname;
    }
  }
}
function match ( self , dirname , basename , callback ) { var pathname , stats , pattern , matches ; pattern = patternFor ( self , basename ) ; matches = self . entries ( dirname ) . filter ( function ( m ) { return pattern . test ( m ) ; } ) ; matches = sortMatches ( self , matches , basename ) ; while ( matches . length ) { pathname = path . join ( dirname , matches . shift ( ) ) ; stats = self . stat ( pathname ) ; if ( stats && stats . isFile ( ) && callback ( pathname ) ) { return pathname ; } } }
Checks if the path is actually on the file system and performs any syscalls if necessary.
Checks if the path is actually on the file system and performs any syscalls if necessary .