joyent/node — Issue #1851: “All Together...” documentation is misleading w.r.t. Folder Modules
Author: exogen
Created: 2011-10-10 18:40:49+00:00
State: open

The pseudocode in the All Together section lists this as the final step for `LOAD_AS_DIRECTORY(X)`:

`LOAD_AS_FILE(X/index)`

`LOAD_AS_FILE(X)` then has the following steps:

```
1. If X is a file, load X as JavaScript text. STOP
2. If X.js is a file, load X.js as JavaScript text. STOP
...
```

However, `X/index` (without an extension) is never actually attempted – Node skips straight to `X/index.js`. I found this misleading, as I expected e.g. `require('./path/to/dir')` to attempt a file named simply `index` first.

(The other documentation for Folder Modules is fine and clearly states that `index.js` and `index.node` are attempted.)