mariklozik,
... разговор слепого с глухим
function fn(arr, pattern) {
return arr.filter(function(el) {
return pattern.some(function(mask) {
return Object.keys(mask).every(function(key) {
return el[key] == mask[key]
})
})
})
};
var arr = [
{id: 1, src: "../img/image.jpg", name: "image_1"},
{id: 2, src: "../img/image.jpg", name: "image_2"},
{id: 3, src: "../img/image.jpg", name: "image_3"},
{id: 4, src: "../img/image.jpg", name: "image_4"},
{id: 5, src: "../img/image.jpg", name: "image_5"}
],
pattern = [{id:1, name : "image_1"}];
alert(JSON.stringify(fn(arr, pattern)));