Skip to content

Instantly share code, notes, and snippets.

@selfagency
Created July 11, 2021 01:09
Show Gist options
  • Save selfagency/852ccb375537ed51152f87be294a0d12 to your computer and use it in GitHub Desktop.
Save selfagency/852ccb375537ed51152f87be294a0d12 to your computer and use it in GitHub Desktop.
[if node app is cli, else]
if (require.main === module) {
console.log('called directly');
} else {
console.log('required as a module');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment