shtylman/node-browser-resolve — pull request #10 by rudyjahchan (2013-03-09 21:00:49+00:00)
Title: Support resolving when local path has no extension

Many times when requiring a local file the extension is dropped:

```javascript
foo = require('foo');
```

Within node, the require.resolve method will look for extensions other than just .js. Having the same feature would be ideal, especially in use with browserify. The resolve module that node-browser-resolve relies on already supports having extensions, so it is simply a matter of passing them on.

I decided to add an optional options parameter to the resolve which right now only has supporters an extensions option. It is an array of extension strings. So to support resolving of .coffee in addition to .js, you do the following.

```javascript
resolve('./bar', parent, { extensions: ['.js', '.coffee'] }, function(err, path) {
// handle path
});
```

As mentioned the options are NOT required. You can call resolve without it and it will still resolve it to a .js.extensions property to the resolve method, to mimic the global require.extensions available in node. But 1.) the latter is a mapping of extensions to compilation functions which is outside the scope of this module, and 2.) all other modules in the browserify stack rightly avoid globals.