Node.js counterpart of Python's __name__ == '__main__'

The following programs are roughly equivalent:

Python

def main():
    print('hello, world')


if __name__ == '__main__':
    main()

JavaScript of the Node.js variety

function main() {
    console.log('hello, world')
}

if (require.main === module) {
    main()
}

Docs