jashkenas/coffee-script — Issue #2099: postfix chains
Author: randallb
Created: 2012-02-03 17:43:42+00:00
State: open

This is a feature request.

When I'm chaining multiple args together, ideally, I'd like to optionally chain things together based on a postfix if clause.

For instance:

@model.where(@name)
.where(matchObj)
.skip(numberOfItems * (page-1)) #if numberOfItems && page
.limit(numberOfItems) #if numberOfItems

Make sense? I'm not certain this belongs in the language, but thought I'd put it out there.