function uniq(arr) {
const index = [];
return arr.filter((elem) => {
const str = JSON.stringify(elem);
return index.includes(str) ? false : index.push(str);
});
}
function onlyUniq(myArr, key) {
return myArr.filter((obj, pos, arr) => {
return arr.map(el => el[key]).indexOf(obj[prop]) === pos;
});
}