UNPKG

252 BJavaScriptView Raw
1export default function uniqueBy(arr, fn) {
2 var identifiers = new Set();
3 return arr.filter(function (item) {
4 var identifier = fn(item);
5
6 if (!identifiers.has(identifier)) {
7 identifiers.add(identifier);
8 return true;
9 }
10 });
11}
\No newline at end of file