-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add stopDir functionality #17
Comments
@CVarisco could you please elaborate on your use case (what exactly you used it for and why), so that we can better understand how common the need might be and so we can have the opportunity to propose alternative solutions? Thanks! |
Hi @sholladay, sure :) I hope that is enough to explain what I'm looking for 👍 |
That issue's title mentions searching all the way to I'd like to better understand why we should limit the search, though. Maybe there is a more appropriate algorithm for you. For example, I once wanted to search until a file does not exist, but after thinking about it a bit deeper, I ended up creating find-down. That worked out much better; it's simpler, faster, and more reliable for finding things high up in the tree, such as the user's code-dir. In your case, is there an actual problem you foresee with allowing the search to continue upwards outside of the project directory or is this just a performance optimization? |
The feature should search from a child directory (from inside to outside) one file (in this case the config file). I hope that is clear why I thought about it 👍 |
It makes sense, but if you know that your file will exist within a directory, why not check it directly? |
Hi @sindresorhus !
Thanks a lot to share with us your little tool.
I used your library in one of my side projects and I added the capability to the user to stop the find-up process if the last directory is equal to the stopDir passed like an option.
I'll open a PR to add the functionality on the original library.
Feel free to dismiss my PR on this project if you think that is useless 🙂
Have fun coding 🌮
The text was updated successfully, but these errors were encountered: