Extension for require.resolve which will resolve directories as well as files
npm install dir-resolvedir-resolve
===========

An extension to require.resolve(). Traditionally, require.resolve() calls
only work if you're working with files, as opposed to directories. For example:
```
node_modules/
module/
package.json
test/
index.js
You could run require.resolve('module') or require.resolve('module/package')require.resolve('module/test')
and it would return paths to the files you expected. However, if you ran it would throw an exception. Sincerequire.resolve() is designed to be the underlying mechanism upon whichrequire() works, this is good and expected behavior. After all, what does
requiring a directory even mean in node?
That said, I recently have had the desire of being able, to not require() therequire.resolve()
directories of my dependencies, but to get their locations via at which point this this behavior became a hindrance.
Thus, I have written dir-resolve. Meant to be an extension torequire.resolve(), dir-resolve provides all the functionality ofrequire.resolve() but adds the ability to resolve the directories of your
dependencies as well.
npm install dir-resolve
`javascript
var resolve = require('dir-resolve');
//Assuming the example above is at /path
resolve('module/package'); // -> '/path/node_modules/module/package.json'
resolve('module/test'); // -> '/path/node_modules/module/test'
`
In my testing it is compatible with Windows.
Clone this repo and run npm install to run locally.
To run the tests do npm test or npm test -- --watch`.