I'm just getting started with node.js and I have some experience with Python. In Python I could check whether the __name__
variable was set to "__main__"
, and if it was I'd know that my script was being run directly. In that case I could run test code or make use of the module directly in other ways.
Is there anything similar in node.js?