Here's nearly the same module I wrote some time ago. https://github.com/tblobaum/directory similarly it requires all files in a directory (or you can require a different directory which has the added benefit of respecting a package.json there) but it will never require the file that invokes it.
I guess the main difference is that with `directory` you get a synchronous callback loop for your files as well as an object hash. Isaac, The motivation for `directory` came from a few different potential use cases, but if I remember right I think one of them was to reduce the number of exports calls needed in some cases. Sometimes an index or intermediary exports file can have a few dozen exports that all have basically the same pattern. On Sun, May 6, 2012 at 1:47 PM, Isaac Schlueter <[email protected]> wrote: > Why not just do require('foo/bar.js') instead of require('foo').bar? > > On Sat, May 5, 2012 at 1:45 AM, Richard Marr <[email protected]> wrote: >> Nice. >> >> I often do something pretty similar; putting something like this in >> index.js: >> https://gist.github.com/1122217 >> >> >> >> On 4 May 2012 03:19, Stephen Handley <[email protected]> wrote: >>> >>> New package to allow writing minimal node index.js/index.coffee files that >>> require and export siblings by file basename. Would appreciate any >>> feedback... I assumed there was native support for something like this in >>> node, but haven't found anything. >>> >>> https://github.com/stephenhandley/requireindex >>> >>> -- >>> 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 >> >> >> >> >> -- >> Richard Marr >> >> -- >> 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 > > -- > 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 -- 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
