DN
const set = new Set();
arr.filter((obj) => !set.has(obj.direction) && set.add(obj.direction));
Можно еще через рамду кто любит, но менее понятно и по перформансу хуже если верить бенчмарку
R.uniqWith(R.eqBy(R.prop('direction')))(arr)
Size: a a a
DN
const set = new Set();
arr.filter((obj) => !set.has(obj.direction) && set.add(obj.direction));
S
const set = new Set();
arr.filter((obj) => !set.has(obj.direction) && set.add(obj.direction));
L
DE
const set = new Set();
arr.filter((obj) => !set.has(obj.direction) && set.add(obj.direction));
DN
DE
DE
DE
[...new Set(arr.map(({ d: direction }) => d))].map((d) => ({ direction: d }))
DE
DE
MH
MH
DN
В
DE
DE
DN
DN