Closed fisker closed 5 years ago
What if you want both at the same time? Then it would have to search twice, which could also cause race conditions.
I would do readPkgUp.resolve
get the path then require or readjson
Just like I usually do with require, require.resolve
then require
Then I would have to document how to use it properly and people will still not read it and do it wrong. With destructuring, the current API is fine, IMHO.
Sure, just suggestion.
Another reason not to do it is that I just did two major versions for silly stuff, so I don't really want to cause more churn.
You renamed
.package
in https://github.com/sindresorhus/read-pkg-up/commit/8140c731da0c4ddfedd549d55660acf0ee53ee1d .But why not
readPkgUp
andreadPkgUp.sync
for thejson
, addreadPkgUp.resolve
andreadPkgUp.resolve.sync
to get thepath
, just likerequire