fs-jetpack
fs-jetpack copied to clipboard
find matching recursively upward
It would be nice to have a way to find files in or upward of cwd
. This is common for e.g. finding the nearest tsconfig.json
, package.json
, ... etc.
For performance and intent-representation reasons I think it would make sense to have an option to short-circuit at first match. The TS types could use this flag to change the return type (via conditional typing), e.g.:
With find 1 semantic on:
null | string
With off:
string[]
This is a great idea, I would do a PR on this if I had the time... I am currently super busy though.
Glad you like it @papb! We've been benefiting from this library on some work at Prisma Labs. Its good to at least know you're buying into the idea. Maybe our team (myself or @weakky) will find an opportunity on our side to contribute a PR toward this issue.
Fantastic :)
Sounds interesting, I'm also super busy till the end of this year, after that can investigate this feature as well. But don't hesitate to be faster than me :)
Closely related: sindresorhus/find-up