Skip to content

Instantly share code, notes, and snippets.

@julesbou
Created March 11, 2016 17:32
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 julesbou/3c207e877cb9a636c8f7 to your computer and use it in GitHub Desktop.
Save julesbou/3c207e877cb9a636c8f7 to your computer and use it in GitHub Desktop.
var coll = new Backbone.Collection([model1, model2]);
console.log(coll.search('Jordan').first().get('last_name')); // Aslam
console.log(coll.search('John').first().get('last_name')); // Doe
console.log(coll.search(/Jo/).pluck('last_name')); // ['Aslam', 'Doe']
console.log(coll.search(/Jordan|John/).pluck('last_name')): // ['Aslam', 'Doe']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment