Re:Koa – Next-generation web framework for Node.js
by ds_ on Thursday December 19, 2013 @10:50AM
(#6935304)
A similar convention, often seen within the node community: https://npmjs.org/doc/coding-style.html#Comma-First
Personally, I find this ugly with very little benefit. It seems awkward to edit.
[ Parent
| on HN ]
Re:Koa – Next-generation web framework for Node.js
by jaegerpicker on Thursday December 19, 2013 @12:19PM
(#6936052)
Comma first is a great convention, it allows you to easily comment out an item in a list while debugging. for example:
var test = [
"firstitem"
, "seconditem"
//, "thriditem_commented_out"
//, "fourthitem_should_also_be_commented_out"
]
Otherwise you have to do this: var test = [
"firstitem",
"seconditem"//,
//"thriditem",
//"fourthitem"
]
It's just a lot more cognitive overhead to not put the comma first.
Re:Koa – Next-generation web framework for Node.js
by city41 on Thursday December 19, 2013 @01:04PM
(#6936389)
That's not true because the spec for JS allows the trailing comma. IE is the only browser that doesn't follow this. So if you are doing Node dev, the trailing comma is harmless.
Re:Koa – Next-generation web framework for Node.js
by iaskwhy on Thursday December 19, 2013 @01:41PM
(#6936715)
You realise it's the opposite for the first item, right? Code easier to read (and thus understand) is what everyone should aim for.
Re:Koa – Next-generation web framework for Node.js
by mradmin on Thursday December 19, 2013 @10:59AM
(#6935401)
Agreed, I follow this styleguide: https://github.com/felixge/node-style-guide