SyntaxFix
Write A Post
Hire A Developer
Questions
Sometimes you want to run a function via CLI, sometimes you want to require it from another module. Here's how to do both.
require
// file to run const runMe = () => {} if (require.main === module) { runMe() } module.exports = runMe