arr = [21: 31, 22: 14, 23: 1, 24: 35, 25: 6, 26: 16, 27: 13, 28: 78, 29: 1,30: 42, 31: 21, 32: 31, 33: 15,34: 20, 35: 24]
[[24: 35], [21: 31]]
const findDupes = data => {
const tmp = data.reduce((a, e) => {
const ee = Object.entries(e).pop();
const keys = [`${ee[0]}_${ee[1]}`, `${ee[1]}_${ee[0]}`];
if (!a[keys[0]]) a[keys[0]] = { e, s: [] };
if (a[keys[1]]) a[keys[1]].s.push(e);
return a;
}, {})
return Object.entries(tmp).filter(e => e[1].s.length > 0).map(e => e[1].e);
}
console.log(findDupes(data));
const data = [{ 21: 31 }, { 22: 14 }, ...];