Skip to content

Instantly share code, notes, and snippets.

@s0ber
Forked from kossnocorp/parentheses_rule.coffee
Last active August 29, 2015 14:04
Show Gist options
  • Save s0ber/6b170c51dfbfe7b6532c to your computer and use it in GitHub Desktop.
Save s0ber/6b170c51dfbfe7b6532c to your computer and use it in GitHub Desktop.
# The main rule: I want to see a method call. Brackets are the most simple way to make it.
# if there is single argument and it is not a string, brackets required
fn()
fn(1)
fn(variable)
# if just single string, quotes are some kind of brackets here, and brackets can be omitted
fn 'string'
# if method is chainable, brackets required
fn.addClass('is-string')
# if there are more than one arguments, brackets requried
fn('string', variable)
# if argument doesn't fit one line, brackets can be omitted
fn 'string', variable, ->
doSomething()
fn
key: 'value'
anotherKey: 'value'
# all other cases - brackets required
fn('string', variable, anotherFn)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment