Well, I know I can do whatever I want. My code is actually working... but that doesn't mean I'm doing it the right way. Even after 20+ years of programming experience, I have no problem asking for advice, especially in a new environment such as Node. Node's community is thriving and code gets passed around very easily, which is awesome. I care about writing code that is as readable and as standard as possible. Since I'm a noob in this area, I'm willing to adapt. :-)
Thanks everyone for the feedback! -- Tito On Mar 4, 2012, at 3:25 PM, Mark Hahn wrote: > Just do whatever you want with exports. The isolation is provided at the > module level in any case. > > I appreciate it when someone explains things and gives me tips and hints but > I hate it when people tell me how to write my code. They somehow think they > know how to code better than me. > > On Sun, Mar 4, 2012 at 3:53 AM, fent <[email protected]> wrote: > I think what mikeal's point was that your module should focus on one main > purpose. Any extra features should be attached to the main _default_ funtion. > > There are however modules with many main features like utility belts > underscore and utile. > > On Sunday, March 4, 2012 2:13:43 AM UTC-7, Tito wrote: > Hello, > A couple of weeks ago I saw a slide where @mikeal mentioned: "if your module > exposes more than one function, you might be doing it wrong :)" > > I replied by asking: "@mikeal What if I have a bunch of utility functions? > Isn't this the purpose of a module? A module per function sounds like > overkill..." > > He replied with: "@titusmagnus module.exports = function default () {}. > module.exports.notdefault = function () {}" > > I'm fairly new to Node and I don't really know how to implement a module with > this syntax. As a matter of fact, I haven't been able to find any related > documentation. What is the purpose of default() and notdefault()? Is there a > page where I can see this in action? A real example would be awesome. > > Thanks! > > -- Tito > > > > > > > > On Sunday, March 4, 2012 2:13:43 AM UTC-7, Tito wrote: > Hello, > A couple of weeks ago I saw a slide where @mikeal mentioned: "if your module > exposes more than one function, you might be doing it wrong :)" > > I replied by asking: "@mikeal What if I have a bunch of utility functions? > Isn't this the purpose of a module? A module per function sounds like > overkill..." > > He replied with: "@titusmagnus module.exports = function default () {}. > module.exports.notdefault = function () {}" > > I'm fairly new to Node and I don't really know how to implement a module with > this syntax. As a matter of fact, I haven't been able to find any related > documentation. What is the purpose of default() and notdefault()? Is there a > page where I can see this in action? A real example would be awesome. > > Thanks! > > -- Tito > > > > > > > > On Sunday, March 4, 2012 2:13:43 AM UTC-7, Tito wrote: > Hello, > A couple of weeks ago I saw a slide where @mikeal mentioned: "if your module > exposes more than one function, you might be doing it wrong :)" > > I replied by asking: "@mikeal What if I have a bunch of utility functions? > Isn't this the purpose of a module? A module per function sounds like > overkill..." > > He replied with: "@titusmagnus module.exports = function default () {}. > module.exports.notdefault = function () {}" > > I'm fairly new to Node and I don't really know how to implement a module with > this syntax. As a matter of fact, I haven't been able to find any related > documentation. What is the purpose of default() and notdefault()? Is there a > page where I can see this in action? A real example would be awesome. > > Thanks! > > -- Tito > > > > > > > > -- > 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
