main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
252 bytes
|
Line | |
---|
1 | export 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 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.