Skip to content

Instantly share code, notes, and snippets.

@ketanghumatkar
Created March 9, 2015 11:25
Show Gist options
  • Save ketanghumatkar/47109cb8fa3c10ae845d to your computer and use it in GitHub Desktop.
Save ketanghumatkar/47109cb8fa3c10ae845d to your computer and use it in GitHub Desktop.
Filter the objects from array of objects based of array of ids
var collectionObject = [{id: 1}, {id: 2}, {id: 3}, {id: 4}]
var ids = [2,3]
_.filter(collectionObject, function(ca){
return _.contains(ids, ca.id)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment