Last active
December 17, 2015 06:18
-
-
Save delba/5563968 to your computer and use it in GitHub Desktop.
Mapping Objects in CoffeeScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data = | |
| X100: | |
| description: "A really cool camera" | |
| stock: 5 | |
| X1: | |
| description: "An awesome camera" | |
| stock: 6 | |
| # Multiline: parentheses not required | |
| cameras = for own name, info of data | |
| "#{name}: #{info.description} (#{info.stock} in stock)" | |
| # One-line: parentheses required | |
| cameras = ("#{name}: #{info.description} (#{info.stock} in stock)" for own name, info of data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment