diff --git a/.jshintrc b/.jshintrc index 81d5568..406049c 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,5 +1,4 @@ -{ "es5": true -, "node": true +{ "node": true , "browser": true , "jquery": true diff --git a/lib/walk.js b/lib/walk.js index 7ce9794..de36921 100644 --- a/lib/walk.js +++ b/lib/walk.js @@ -37,7 +37,7 @@ me._wq = []; me._wqueue = [me._wq]; me._wcurpath = undefined; - me._wfilters = options.filters; + me._wfilters = options.filters || []; me._wfirstrun = true; me._wcurpath = pathname; @@ -185,30 +185,32 @@ me._wReadFiles(); }); }; + Walker.prototype._wFilter = function () { + var me = this + , exclude + ; + + // Stop directories that contain filter keywords + // from continuing through the walk process + exclude = me._wfilters.some(function (filter) { + if (me._wcurpath.match(filter)) { + return true; + } + }); + + return exclude; + }; Walker.prototype._wWalkSync = function () { - console.log('walkSync'); + //console.log('walkSync'); var err , files , me = this ; - // Stop directories that contain filter keywords - // from continuing through the walk process - if (me._wfilters != undefined) { - var shouldExclude = false; - for (var iFilter=0; iFilter