I have a Node.js module with a function that is exported, and designed to be invoked when the script is run from the command line:
function init() {
console.log('initializing');
}
init();
module.exports = { init };
I'd like to require / import the underlying method in another module, without evaluating init. Unfortunately require seems to evaluate it:
> require('./test.js').init;
initializing
{ init: [Function: init] }
Is it possible to require this method, without evaluating it in this scenario?