ES Modules version of require.main === module.
Checks if script was called directly.
ES6 import.meta.url always returns the file url with path extension.
process.argv[1] comes from the command-line and may be extensionless.
Parameters:
Name | Type | Description |
---|---|---|
metaURL |
The import.meta.url of type string or URL instance. |
- Source:
Returns:
True if script was called directly, false if not.
- Type
- boolean