nó js se o nome principal

var fnName = function() {
    // main code
}

if (require.main === module) {
    fnName();
}
Famous Flatworm