small medium large xlarge

Back to: All Forums  CoffeeScript
05 Aug 2011, 19:10
R. Mark Volkmann (13 posts)

On the top of page 72 in the book (end of section 4.5), why are there braces around the names to the left of the assignment? For example: {Dictionary} = require ‘./Dictionary’

Is that something specific to Node.js?

05 Aug 2011, 23:41
Trevor Burnham (53 posts)

It’s shorthand for @Dictionary = (require ‘./Dictionary’).Dictionary@. I talk briefly about the syntax (and how useful it is with Node’s @require@) in section 3.6, “Pattern Matching.”

I also show off the syntax in my May PragPub article “A CoffeeScript Intervention”:

You must be logged in to comment