function where(collection, source) { return collection.filter(function(obj){ return Object.keys(source).every(function(key){ return obj[key]===source[key]; }); }); }