Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace vague 'may not' with definitive 'will not' #23143

Closed
wants to merge 6 commits into from
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions doc/api/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,12 @@ Modules are cached after the first time they are loaded. This means
(among other things) that every call to `require('foo')` will get
exactly the same object returned, if it would resolve to the same file.

Multiple calls to `require('foo')` may not cause the module code to be
executed multiple times. This is an important feature. With it,
"partially done" objects can be returned, thus allowing transitive
dependencies to be loaded even when they would cause cycles.
By default (provided the `require.cache` is not modified), multiple calls to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional nit: Get rid of By default and the parentheses:

Provided `require.cache` is not modified, multiple calls to

I'm fine with it the way it is but I think that change makes it a tiny bit more clear.

`require('foo')` will not cause the module code to be executed multiple times.

This is an important feature. With it, "partially done" objects can be returned,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line has trailing space and exceeds the limit of 80 characters producing linter issue.

thus allowing transitive dependencies to be loaded even when they would cause
cycles.

To have a module execute code multiple times, export a function, and call
that function.
Expand Down