Mochabot log - CommonJS IRC channel: #commonjs on irc.freenode.net

2010-05-27:

[11:02] <aukbc> how to get the full path from fileupload in javascript
[17:11] <creationix> is there a place for commonjs idioms and code style guides
[17:11] <creationix> or is commonjs just a technical spec?
[17:11] <tlrobinson> so far mostly a spec, but i think it would be good to have a style guide
[17:11] <creationix> tlrobinson: how about some sample code I could look at that's considered commonjs style
[17:12] <tlrobinson> of course creating a style guide is extreme bike shedding
[17:12] <creationix> just looking for some prior art to help reduce bikeshedding really
[17:12] <tlrobinson> i think each of the major commonjs projects has different style
[17:13] <creationix> fair enough, I'm just working on a new node framework and am trying to get a feel for the most accepted styles
[17:14] <tlrobinson> my biased opinion says narwhal is "correct" :)
[17:14] <creationix> stuff like semicolons or no semicolons, commas in front, commas at back, OO based vs functional based
[17:14] <creationix> tlrobinson: I would assume so ;)
[17:14] <creationix> tlrobinson: narwhal is on github right?
[17:14] <tlrobinson> yeah http://github.com/280north/narwhal
[17:15] <tlrobinson> though its completely consistent either
[17:15] <tlrobinson> we started switching to uppercase identifiers for module objects (e.x. var FILE = require("file"))
[17:15] <tlrobinson> which i really like now, but not all of the code has been converted
[17:15] <creationix> tlrobinson: what did you have before, CamelCased?
[17:16] <tlrobinson> i don't really remember
[17:16] <tlrobinson> i'm not sure we had a consistent style before
[17:16] <creationix> tlrobinson: just glanced through the code, is renaming exports like this common
[17:16] <creationix> http://github.com/280north/narwhal/blob/master/lib/assert.js#L20
[17:17] <tlrobinson> i don't think it is common, i don't particularly like it either
[17:18] <creationix> why not (if I may ask)
[17:19] <tlrobinson> if you don't notice that at the top its not obvious what's being exported
[17:19] <tlrobinson> not a great reason though, i don't care too much either way
[17:20] <creationix> hmm, what if we merge the two ideas and do "MYMODULE = exports" and then later "MYMODULE.foo = ..."
[17:21] <creationix> you normally wouldn't be patching other module objects I would think

 

 

Logs by date :