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

getGitReposInFolder: fix async folder filtering #311

Merged
merged 1 commit into from
Sep 26, 2018

Conversation

lbogdan
Copy link
Contributor

@lbogdan lbogdan commented Aug 17, 2018

Folder filtering in Git.getGitReposInFolder()

const folders = await Promise.all<string>(filteredItems.filter(async item => (await fs.stat(item)).isDirectory()));

is not working as intended, because the filter() callback returns a Promise, which is a truthy value, so filter() just passes filteredItems through, and Promise.all() does the same (as the array values are strings, not Promises), so in the end folders is a copy of filteredItems.

Fixes #143 .

Note: I adapted asyncFilter() implementation from this StackOverflow answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants