Mam następujący szyk
[{ id: 1,
type: 'video',
image: null,
url: 'https://www.youtube.com/1'
},
{ id: 2,
type: 'video',
image: null,
url: 'https://www.youtube.com/2'
},
{ id: 3,
type: 'image',
image: 'https://example-1.url.webp'
},
{ id: 4,
type: 'image',
image: 'https://example-2.url.jpg',
},
{ id: 5,
type: 'video',
image: 'https://www.youtube.com/2',
}
]
Ja już przepuszczam wszystkie elementy, które nie mają formatu webp, a obraz null
const galleryFilter = gallery.filter(
(item) => item?.image?.indexOf("webp") === -1 || item?.image === null
);
Jak widać, są 2 items
(id 2 i id 5 ) z tym samym adresem URL, jak mogę również filtrować element, nazwany z tym samym adresem URL w galleryFilter
metoda ?