Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/module.ts>isMain

A JavaScript extension package for building strong and modern applications.
Latest
function isMain
import { isMain } from "https://deno.land/x/ayonli_jsext@v0.9.72/module.ts";

Checks if the current file is the entry of the program.

Examples

Example 1

import { isMain } from "@ayonli/jsext/module";

if (isMain(import.meta)) {
    console.log("This is the main module.");
}

Returns

boolean

Examples

Example 1

// CommonJS
const { isMain } = require("@ayonli/jsext/module");

if (isMain(module)) {
    console.log("This is the main module.");
}

Parameters

module: NodeJS.Module

Returns

boolean