Skip to content

Instantly share code, notes, and snippets.

@dupuchba
Created May 18, 2012 19:43
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 dupuchba/2727261 to your computer and use it in GitHub Desktop.
Save dupuchba/2727261 to your computer and use it in GitHub Desktop.
Backbone.js : search filter function
search : function(letters){
if(letters == "") return this;
var pattern = new RegExp(letters,"i");
return _(this.filter(function(data) {
return pattern.test(data.get("name"));
}));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment