Open makbol opened 5 years ago
If you expect findme.js
to be inside of a directory named eggs
, then you can do findUp('eggs/findme.js')
and it will find which level of the tree it is at.
But yeah, if you need actual recursive search of only a filename, then we don't currently have first-class support for thst.
For now, you could certainly use a matcher
function to do it.
I'm not a huge fan of exposing this as an option, but I think I would support having a built-in recursive search helper function, which you would pass to findUp
as a matcher. That would make it a bit easier to combine with other use cases.
I'm not a huge fan of exposing this as an option, but I think I would support having a built-in recursive search helper function, which you would pass to findUp as a matcher. That would make it a bit easier to combine with other use cases.
👍 Something like:
await findUp(async directory => {
return findUp.down('findme.js', {cwd: directory, depth: 1})
})
While walking up recursively check also subdirectories for a searched file. Depth is set by param.
findUp('findme.js', { subdirs: true, depth: 1 })
I can offer help with that if you are open for PRs.