excluding a directory
arunkumar413 opened this issue · 3 comments
arunkumar413 commented
unable to exclude node_modules
. It's throwing an error:
TypeError: (intermediate value)(intermediate value)(intermediate value).some is not a function
Here is the code:
const tree = dree.scan("./", {
stat: true,
depth: 200,
exclude: "/node_modules",
});
euberdeveloper commented
As in the examples and in the documentation website:
"It is a regex or array of regex and all the matching paths will not be considered by the algorithm"
This means that in your example you should put a regex and not a string:
const tree = dree.scan("./", {
stat: true,
depth: 200,
exclude: /node_modules/
});
euberdeveloper commented
There could be a plan to add the support for strings.
In that case, a string "my_string" would be converted in a regex /my_string/, for now it is not supported
euberdeveloper commented
This feature has been added since version 3.4.0
. Now you can use regex or strings, the string 'xxx'
would be transformed automatically into /xxx/