Created
January 31, 2015 17:46
-
-
Save pketh/bfdd57d340d91c09c269 to your computer and use it in GitHub Desktop.
You don't need each, collect or select in Coffeescript
This file contains 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
# from http://makandracards.com/makandra/18605-you-don-t-need-each-collect-or-select-in-coffeescript | |
## each | |
for item in items | |
... | |
## collect / map | |
ages = (person.age for person in people) | |
## select / grep | |
adults = (person for person in people when person.age >= 18) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment