Atlas Sullivan
Atlas Sullivan

Reputation: 189

Is there any way, as of current, to check if my script is being called as a module in deno?

As the title says. For example, I can check for the following in node:

if(process.main===module) console.log('This is being called as a module');

Is there any way, as of current, that I can check for the same thing in deno?

Upvotes: 0

Views: 85

Answers (1)

Saddy
Saddy

Reputation: 1581

You can use import.meta.main, which will be false if it is called from a module.

Upvotes: 1

Related Questions