deno/docs/examples/testing_if_main.md
2020-05-06 18:21:13 -04:00

215 B

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.

if (import.meta.main) {
  console.log("main");
}