source:
imaps-frontend/node_modules/@popperjs/core/lib/utils/uniqueBy.js
Last change on this file was 79a0317, checked in by , 6 months ago | |
---|---|
|
|
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.