replace
 //proceed for every entry in libsToLoad
with
 //proceed for every entry in exports.libs

Am Montag, 13. August 2012 13:15:34 UTC+2 schrieb greelgorke:
>
> make your entry point configurable:
>
> // core entry point:
> module.exports.libs = ['logger', 'morelib', /*all other*/];
>
> module.exports.load = function load(libsToLoad){
>   var libs = {};
>   if(libsToLoad.indexOf('logger') >=0)
>    libs.logger = require('./logger');
> //proceed for every entry in libsToLoad
>
>   return libs;
> };
>
>
> // client module
> var core = require('core');
> // check that lib can be loaded with core.libs
>
> var libs = core.load(['logger']);
> var logger = libs.logger;
>
>
> hope it helps, i don't see any way to load a module out of the package. in 
> fact this would contradict the purpose of packages as they are meant 
>
> greetz
>
> Am Montag, 13. August 2012 12:02:10 UTC+2 schrieb Osher E:
>>
>> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to