'use strict'

const fs = require('graceful-fs')
const path = require('path')

function klawSync (dir, opts) {
  dir = path.resolve(dir)
  opts = opts || {}
  return _klawSync(dir, opts, [])
}

function _klawSync (dir, opts, ls) {
  const paths = fs.readdirSync(dir).map(p => dir + path.sep + p)
  for (var i = 0; i < paths.length; i += 1) {
    const pi = paths[i]
    const st = fs.statSync(pi)
    const item = {path: pi, stats: st}
    if (st.isDirectory()) {
      if (opts.filter) {
        if (opts.filter(item) && !opts.nodir) {
          ls.push(item)
          ls = _klawSync(pi, opts, ls)
        } else {
          if (!opts.noRecurseOnFailedFilter) ls = _klawSync(pi, opts, ls)
        }
      } else {
        if (!opts.nodir) ls.push(item)
        ls = _klawSync(pi, opts, ls)
      }
    } else {
      if (opts.filter) {
        if (opts.filter(item) && !opts.nofile) ls.push(item)
      } else {
        if (!opts.nofile) ls.push(item)
      }
    }
  }
  return ls
}

module.exports = klawSync

@@ -158,25 +158,20 @@
  return 
-_klawSync
+walk
 (dir, op
@@ -190,25 +190,20 @@
 unction 
-_klawSync
+walk
  (dir, o
@@ -554,33 +554,28 @@
        ls = 
-_klawSync
+walk
 (pi, opts, l
@@ -640,33 +640,28 @@
 ilter) ls = 
-_klawSync
+walk
 (pi, opts, l
@@ -744,17 +744,12 @@
 s = 
-_klawSync
+walk
 (pi,

rename internal fn to walk