File size: 241 Bytes
bb79dd4
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8

import { pathToFileURL } from 'node:url';

// returns true if the passsed file is being invoked from node,
// not imported.
export function isMain(importMetaUrl) {
    return   importMetaUrl === pathToFileURL(process.argv[1]).href;
}