Answers for "node js check if called from module"

0

node js check if called from module

if (require.main === module) {
    console.log('called directly');
} else {
    console.log('required as a module');
}
Posted by: Guest on June-01-2020

Code answers related to "node js check if called from module"

Code answers related to "Javascript"

Browse Popular Code Answers by Language