UNPKG

@tpluscode/rdfine

Version:
15 lines (14 loc) 380 B
export function onlyUnique(areEqual) { return function (value, index, self) { if (Array.isArray(value)) { return true; } const found = self.findIndex(other => { if (Array.isArray(other)) { return true; } return areEqual(value, other); }); return found === index; }; }