mirror of
https://github.com/denoland/deno.git
synced 2024-11-29 16:30:56 -05:00
11 lines
215 B
Markdown
11 lines
215 B
Markdown
|
## Testing if current file is the main program
|
||
|
|
||
|
To test if the current script has been executed as the main input to the program
|
||
|
check `import.meta.main`.
|
||
|
|
||
|
```ts
|
||
|
if (import.meta.main) {
|
||
|
console.log("main");
|
||
|
}
|
||
|
```
|