Skip to content

Instantly share code, notes, and snippets.

@linus-amg
Created May 22, 2015 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linus-amg/5795aabcd9c19ef2d771 to your computer and use it in GitHub Desktop.
Save linus-amg/5795aabcd9c19ef2d771 to your computer and use it in GitHub Desktop.
users
class Collection extends Backbone.Collection
model: User
query: (query) ->
query = new RegExp query, 'gi'
filtered = @filter (item) ->
state = !!item.attributes.details.firstName.match(query)
return state
return new Collection filtered
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment