vectorsize / substance-text

Substance Text
substance.github.com/text
MIT License
282 stars 26 forks source link

Coding guidelines #24

Closed michael closed 11 years ago

michael commented 11 years ago

I'm not crazy about this.. but maybe we should rule out minor inconsistencies betw. our coding styles. :)

if($clicked.hasClass('tool') || $clicked.hasClass('content') || $clicked.is("span")) {
  events.trigger('surface:active');
}else{
}

vs. (with some whitespace)

if ($clicked.hasClass('tool') || $clicked.hasClass('content') || $clicked.is("span")) {
  events.trigger('surface:active');
} else {
}
function getText() {
  return $el.text();
}

Then we have:

var buffSize = 5 // we grab some extra text to make the search more specific
,   txt = getText()
,   findStart = txt.charAt(beg - buffSize)
,   findText = ''
,   i = beg - buffSize;

vs. (more JSON-esque)

var buffSize = 5, // we grab some extra text to make the search more specific
    txt = getText(),
    findStart = txt.charAt(beg - buffSize),
    findText = '',
    i = beg - buffSize;

totally for arguments for or against a particular style :)

vectorsize commented 11 years ago

I'm not against any coding style in particular as I said earlier, I think it's just about deciding on something...Perhaps external rules help keeping a discussion out of the way, or if you know already what u like just say it ;)