Browse Source

Remove duplicate docs about main module

v0.7.4-release
isaacs 14 years ago
parent
commit
ebc4d5cd29
  1. 17
      doc/api/modules.markdown

17
doc/api/modules.markdown

@ -350,23 +350,6 @@ The example module above could be structured like so:
Node executes the callback immediately, so please plan your programs
accordingly.
### Accessing the main module
When a file is run directly from Node, `require.main` is set to its
`module`. That means that you can determine whether a file has been run
directly by testing
require.main === module
For a file `foo.js`, this will be `true` if run via `node foo.js`, but
`false` if run by `require('./foo')`.
Because `module` provides a `filename` property (normally equivalent to
`__filename`), the entry point of the current application can be obtained
by checking `require.main.filename`.
## Addenda: Package Manager Tips
The semantics of Node's `require()` function were designed to be general

Loading…
Cancel
Save