index.js
function visit(state, filePath, one, done) {
  var file

  // Don’t walk into places multiple times.
  if (own.call(state.checked, filePath)) {
    done([])
    return
  }

  state.checked[filePath] = true

  file = vfile(filePath)

  stat(resolve(filePath), onstat)

  function onstat(error, stats) {
    var real = Boolean(stats)
    var results = []
    var result

    if (state.broken || !real) {
      done([])
    } else {
      result = state.test(file, stats)

      if (mask(result, INCLUDE)) {
        results.push(file)

        if (one) {
          state.broken = true
          return done(results)
        }
      }

      if (mask(result, BREAK)) {
        state.broken = true
      }

      if (state.broken || !stats.isDirectory() || mask(result, SKIP)) {
        return done(results)
      }

      readdir(filePath, onread)
    }

    function onread(error, entries) {
      visitAll(state, entries, filePath, one, onvisit)
    }

    function onvisit(files) {
      done(results.concat(files))
    }
  }
}
function visit(state, filePath, one, done) {
  var file

  // Don’t walk into places multiple times.
  if (own.call(state.checked, filePath)) {
    done([])
    return
  }

  state.checked[filePath] = true

  file = vfile(filePath)

  stat(resolve(filePath), onstat)

  function onstat(error, stats) {
    var real = Boolean(stats)
    var results = []
    var result

    if (state.broken || !real) {
      done([])
    } else {
      result = state.test(file, stats)

      if (mask(result, INCLUDE)) {
        results.push(file)

        if (one) {
          state.broken = true
          return done(results)
        }
      }

      if (mask(result, BREAK)) {
        state.broken = true
      }

      if (state.broken || !stats.isDirectory() || mask(result, SKIP)) {
        return done(results)
      }

      readdir(filePath, onread)
    }

    function onread(error, entries) {
      visitAll(state, entries, filePath, one, onvisit)
    }

    function onvisit(files) {
      done(results.concat(files))
    }
  }
}
function visit ( state , filePath , one , done ) { var file // Don’t walk into places multiple times. if ( own . call ( state . checked , filePath ) ) { done ( [ ] ) return } state . checked [ filePath ] = true file = vfile ( filePath ) stat ( resolve ( filePath ) , onstat ) function onstat ( error , stats ) { var real = Boolean ( stats ) var results = [ ] var result if ( state . broken || ! real ) { done ( [ ] ) } else { result = state . test ( file , stats ) if ( mask ( result , INCLUDE ) ) { results . push ( file ) if ( one ) { state . broken = true return done ( results ) } } if ( mask ( result , BREAK ) ) { state . broken = true } if ( state . broken || ! stats . isDirectory ( ) || mask ( result , SKIP ) ) { return done ( results ) } readdir ( filePath , onread ) } function onread ( error , entries ) { visitAll ( state , entries , filePath , one , onvisit ) } function onvisit ( files ) { done ( results . concat ( files ) ) } } }
Find files in `filePath`.
Find files in filePath .