const filterArray = (array, identify) => {
const matches = {};
return array.filter(item => {
const identity = identify(item);
const isExists = identity in matches;
if (!isExists) {
matches[identity] = true;
return true
}
return false;
});
};