Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

depthLimit option is ignored when filter option is set #14

Open
Lukas238 opened this Issue Mar 27, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@Lukas238
Copy link

Lukas238 commented Mar 27, 2019

Hi,

When using this options, I can only access the level 0 (default) of the directory been read.

I want to match any "/folder/subfolder" that match my regexp (link: https://regex101.com/r/EYiftm/1).

The regexp seem to be correct, but when I walk the root folder with the option "deepthLimit:1" (so to get the folder and subfolder names in the path) and the filter option, I only get the folder in deep 0.

If I disable the filteroption, I get the folder/subfolder as expected.

depthLimit: 1 get ignored when using with filter option.

function filter_yearFolder(item){
    return /\/\d{4}\/.+$/.test(item.path);
}

let dirs = klawSync("/Users/user1/work", {nofile: true, depthLimit: 1, filter: filter_yearFolder})
 console.log(dirs);

Removing filter option let depthLimit:1work as expected (but sans any filtering)

let dirs = klawSync("/Users/user1/work", {nofile: true, depthLimit: 1})
 console.log(dirs);

Best regards!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.