Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit 1deeab2

Browse files
rmgbnoordhuis
authored andcommitted
doc: improve exports/module.exports consistency
While they reference the same object, they are only interchangeable for updates, not assignment.
1 parent 93391ae commit 1deeab2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

doc/api/modules.markdown

+4-4
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Consider this situation:
8787
When `main.js` loads `a.js`, then `a.js` in turn loads `b.js`. At that
8888
point, `b.js` tries to load `a.js`. In order to prevent an infinite
8989
loop an **unfinished copy** of the `a.js` exports object is returned to the
90-
`b.js` module. `b.js` then finishes loading, and its exports object is
90+
`b.js` module. `b.js` then finishes loading, and its `exports` object is
9191
provided to the `a.js` module.
9292

9393
By the time `main.js` has loaded both modules, they're both finished.
@@ -240,7 +240,7 @@ representing the current module. In particular
240240

241241
* {Object}
242242

243-
The `exports` object is created by the Module system. Sometimes this is not
243+
The `module.exports` object is created by the Module system. Sometimes this is not
244244
acceptable, many want their module to be an instance of some class. To do this
245245
assign the desired export object to `module.exports`. For example suppose we
246246
were making a module called `a.js`
@@ -281,13 +281,13 @@ y.js:
281281
### module.require(id)
282282

283283
* `id` {String}
284-
* Return: {Object} `exports` from the resolved module
284+
* Return: {Object} `module.exports` from the resolved module
285285

286286
The `module.require` method provides a way to load a module as if
287287
`require()` was called from the original module.
288288

289289
Note that in order to do this, you must get a reference to the `module`
290-
object. Since `require()` returns the `exports`, and the `module` is
290+
object. Since `require()` returns the `module.exports`, and the `module` is
291291
typically *only* available within a specific module's code, it must be
292292
explicitly exported in order to be used.
293293

0 commit comments

Comments
 (0)