raganwald/method-combinators — pull request #9 by ludicast (2012-11-17 23:16:58+00:00)
Title: added splatter combinators

I found this useful, not sure if you will. Or even if the combinator is named appropriately - could be "each", "map", "collect" or whatever (if you like it but not the name I can change it obviously).

Basically, when a method has a for loop at the top that runs on an inputted array, splatter lets you trim the function to just work on an item in the array and splatter lifts it to run on the array members themselves.

taxItems: (items)->
for item in items
@tax(item)

then becomes

taxItems: splatter (item)->
@tax(item)

Also, since the array might not be the first parameter, I added a splatterAt(index) combinator that takes care of this (splatter delegates to splatterAt(0)).