Created
May 18, 2012 19:43
-
-
Save dupuchba/2727261 to your computer and use it in GitHub Desktop.
Backbone.js : search filter function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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