fshost / node-dir

Recursive asynchronous file and directory operations for Node.js
MIT License
221 stars 44 forks source link

Imposible to match strings ? #10

Closed pyronaur closed 9 years ago

pyronaur commented 10 years ago
/node_modules/node-dir/lib/readfiles.js:82
                    if (options.exclude && options.exclude.test(filename)) ret
                                                           ^
TypeError: Object node_modules,test has no method 'test'

My config was:

{ exclude: ['node_modules', 'test'] }

Doesn't seem to work with arrays at all, only regex is accepted ? In that case the docs need updating...

ThatGuyCND commented 9 years ago

I've run into the same issue. Did you find a solution? FWIW: the regex /.\Wnode_modules\W./ didn't work either

pyronaur commented 9 years ago

@ThatGuyCND - I settled for not using node-dir for now. If you find any alternatives let me know :). The repo seems a bit dead...

fshost commented 9 years ago

The error you have indicated appears to be from an early version. Make sure you are using the latest version when installing from NPM. If your using this as a dependency in your package make sure you are using 0.1.8 or higher. There are tests now for both regexes and arrays of string and both work.