node.js - what's the best way to reference parent/containing nodejs module? -


mymodule   |__index.js   |__foo.js   |__bar.js       

inside of foo.js want reference mymodule (parent). what's best way of doing that?

i debating between 1 of following:

var parent = module.parent.exports var parent = require('./'); 

you can use __dirname reference parent module.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -