How to filter an array of objects storing only once for each matched item

join shbcf.ru