Autosave: 2024-04-28 11:40:03

This commit is contained in:
thomasabishop 2024-04-28 11:40:03 +01:00
parent e9afc67905
commit 670f36ab5f
2 changed files with 11 additions and 0 deletions

Binary file not shown.

View file

@ -37,3 +37,14 @@ If you use any module not in the Node core, you will need to have this installed
globally for it to work. (There are globally for it to work. (There are
[ways around this](https://thom4.net/2014/self-contained-node-scripts/) for Node [ways around this](https://thom4.net/2014/self-contained-node-scripts/) for Node
scripts you publish but for personal scripts this doesn't matter.) scripts you publish but for personal scripts this doesn't matter.)
## `require.main`
This construction checks that the script is being directy invoked via the 'node'
command in the terminal rather than called by another module.
This is equivalent to the [following construct]() in Python:
```py
if __name__ == "__main__":
```