Skip to content

Commit 1d4ea60

Browse files
jasnellrvagg
authored andcommitted
doc: small clarifications to modules.markdown
per: nodejs/node-v0.x-archive#8708 A modified version of the original PR submitted by @builtbylane. Reviewed By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> PR-URL: #2378
1 parent c888985 commit 1d4ea60

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

doc/api/modules.markdown

+9-6
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ io.js has several modules compiled into the binary. These modules are
121121
described in greater detail elsewhere in this documentation.
122122

123123
The core modules are defined in io.js's source in the `lib/` folder.
124+
The core modules are defined within io.js's source and are located in the
125+
`lib/` folder.
124126

125127
Core modules are always preferentially loaded if their identifier is
126128
passed to `require()`. For instance, `require('http')` will always
@@ -131,22 +133,23 @@ return the built in HTTP module, even if there is a file by that name.
131133
<!--type=misc-->
132134

133135
If the exact filename is not found, then io.js will attempt to load the
134-
required filename with the added extension of `.js`, `.json`, and then `.node`.
136+
required filename with the added extensions: `.js`, `.json`, and finally
137+
`.node`.
135138

136139
`.js` files are interpreted as JavaScript text files, and `.json` files are
137140
parsed as JSON text files. `.node` files are interpreted as compiled addon
138141
modules loaded with `dlopen`.
139142

140-
A module prefixed with `'/'` is an absolute path to the file. For
143+
A required module prefixed with `'/'` is an absolute path to the file. For
141144
example, `require('/home/marco/foo.js')` will load the file at
142145
`/home/marco/foo.js`.
143146

144-
A module prefixed with `'./'` is relative to the file calling `require()`.
145-
That is, `circle.js` must be in the same directory as `foo.js` for
147+
A required module prefixed with `'./'` is relative to the file calling
148+
`require()`. That is, `circle.js` must be in the same directory as `foo.js` for
146149
`require('./circle')` to find it.
147150

148-
Without a leading '/', './', or '../' to indicate a file, the module is either a
149-
core module or is loaded from a `node_modules` folder.
151+
Without a leading '/', './', or '../' to indicate a file, the module must
152+
either be a core module or is loaded from a `node_modules` folder.
150153

151154
If the given path does not exist, `require()` will throw an Error with its
152155
`code` property set to `'MODULE_NOT_FOUND'`.

0 commit comments

Comments
 (0)