You can use getters like connect does.

https://github.com/senchalabs/connect/blob/master/lib/connect.js#L86-92



2012/8/13 Osher E <osher...@gmail.com>:
> Hi all
>
> most modules have an entry point, which is by default index.js.
>
> But what if my module does not have one entry point?
> What if it is a colleciton of many small cross-project core utility modules
> that i would not always want to load them all to use one of them?
> I mean, by doing
>
> var core = require('core').logger
> we require  whatever is exported on the entry-point of core, and use only
> logger.
> and there could be twenty of them, where in this project I just need the
> logger here.
>
> Please avoid the discussion of wither to wrap each utility as it's own
> package...
> Just assume that they do not justify that, but do need a package to live
> in...
>
> I saw somewhere that I should be able to
> var core = require('core/logger')
> and should be able to direct in my package.json that 'core/logger' is
> actually available at ./lib/logger
> only that now i cant find that place that sais how to do it...
>
> Was I dreaming? Can anybody point it out for me? :)
>
> Thanks
>
> O.
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nodejs@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to