Skip to content

Commit 2827059

Browse files
committed
clarification on 9.5
1 parent 8991844 commit 2827059

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/content/9/en/part9b.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,8 @@ Do not copy the calculator code to file *index.ts*; instead, make it a [TypeScri
835835

836836
For *calculateBmi* to work correctly from both the command line and the endpoint, consider adding a check *require.main === module* to the file <i>bmiCalculator.ts</i>. It tests whether the module is main, i.e. it is run directly from the command line (in our case, *npm run calculateBmi*), or it is used by other modules that import functions from it (e.g. <i>index.ts</i>). Parsing command-line arguments makes sense only if the module is main. Without this condition, you might see argument validation errors when starting the application via *npm start* or *npm run dev*.
837837

838+
See the Node [documentation](https://nodejs.org/api/modules.html#accessing-the-main-module) for more.
839+
838840
</div>
839841

840842
<div class="content">

0 commit comments

Comments
 (0)