0: {revitid: "281814", viewid: 3298, level: "", building: "", room: "", …}
1: {revitid: "281857", viewid: 3299, level: "", building: "", room: "", …}
2: {revitid: "281899", viewid: 3300, level: "", building: "", room: "", …}
3: {revitid: "281957", viewid: 3301, level: "", building: "", room: "", …}
4: {revitid: "281814", viewid: 3298, level: "", building: "", room: "", …}
5: {revitid: "281857", viewid: 3299, level: "", building: "", room: "", …}
6: {revitid: "281957", viewid: 3302, level: "", building: "", room: "", …}
7: {revitid: "282264", viewid: 3304, level: "", building: "", room: "", …}
const count = arr.reduce((acc, n) => (acc[n.revitid] = (acc[n.revitid] || 0) + 1, acc), {});
const unique = Object.entries(count).filter(n => n[1] === 1).map(n => n[0]);
const newArr = arr.filter(n => unique.includes(n.revitid));
const duplicate = arr.reduce((acc, n) => (acc[n.revitid] = acc.hasOwnProperty(n.revitid), acc), {});
const newArr = arr.filter(n => !duplicate[n.revitid]);
const newArr = arr.filter(function(n) {
return !this.get(n.revitid);
}, arr.reduce((acc, { revitid: n }) => acc.set(n, acc.has(n)), new Map));
const newArr = arr.filter((n, i, a) => a.filter(m => m.revitid === n.revitid).length === 1);
const newArr = Object
.values(arr.reduce((acc, n) => (acc[n.revitid] = acc[n.revitid] ? 1 : n, acc), {}))
.filter(n => n !== 1);
const newArr = Object
.values(arr.reduce((acc, n) => ((acc[n.revitid] = acc[n.revitid] || []).push(n), acc), {}))
.flatMap(n => n.length === 1 ? n : []);
const notUniqueRevitids = data
.reduce((acc, obj) => {
if (acc[0].size === acc[0].add(obj.revitid).size) {
acc[1].add(obj.revitid);
}
return acc;
}, [new Set(), new Set()])[1];
const uniqueObj = data.filter(obj => !notUniqueRevitids.has(obj.revitid));