```coffeescript
check = (route, criteria) ->
  for name in ['name', 'action', 'controller']
    property = criteria[name]
    return false if property and property isnt route[name]
  return true

for handler in ... when check handler.route, criteria
  ...
```