~/

Destructuring assignments

These are Destructuring assignments.

someObject =
  a: 'foo'
  b: 'bar'

{ a, b } = someObject

console.log a # -> 'foo'
console.log b # -> 'bar'
class Foo
  constructor: (a) ->
    @a = a

class Foo
  constructor: (@a) -> # is equivalant to above
class Foo
  constructor: (params) ->
    @a = params.a

class Foo
  constructor: ({@a}) -> # Destructuring assignments can be used here as well

Though I'm not sure it is readable :P