-
-
Notifications
You must be signed in to change notification settings - Fork 820
[RFC]: add @stdlib/fs/resolve-parent-paths
#2565
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
Comments
@Snehil-Shah Sounds good to me. Thanks for this suggestion! |
@kgryte For regexp paths, we would have to test the regex with every possible path at each directory level. I wonder how much this would hurt perf? |
@Snehil-Shah Yeah, it won't be great. For simple regular expressions, it should be fine, and not much worse than normal string comparison. |
@kgryte I meant, that for an array of strings, we can check if each of the resolved directory (made from each path in array) exists or not. But in case of regexp, we would have to traverse the entire directory at each level to test if it exists or not. So, say if a directory has a 100 files/folders, we would have to traverse and test all of them to see if they satisfy the regexp. Or is there another way that I'm overlooking? |
That's correct. We'd need to use readdir, rather than exists. Maybe we should just limit to an array of strings and not support regular expressions. |
Yeah, we should just stick to an array of strings, as the read-dir approach seems to greatly increase time complexity |
Works for me! We can always add sthg for regexps later, possibly a different package. |
Should I also create an RFC for |
Yes, that would be good. Thanks! |
PR-URL: stdlib-js#2566 Closes: stdlib-js#2565 --------- Signed-off-by: Snehil Shah <snehilshah.989@gmail.com> Co-authored-by: Athan Reines <kgryte@gmail.com> Reviewed-by: Athan Reines <kgryte@gmail.com> Reviewed-by: Philipp Burckhardt <pburckhardt@outlook.com>
Description
This RFC proposes adding
@stdlib/fs/resolve-parent-paths
similar to@stdlib/fs/resolve-parent-path
, which instead of a single path, accepts either an array of paths or a regular expression.Related Issues
No.
Questions
No.
Other
No.
Checklist
RFC:
.The text was updated successfully, but these errors were encountered: