UNPKG
@popperjs/core
Version:
latest (2.11.8)
2.11.8
2.11.7
2.11.6
2.11.5
2.11.4
2.11.3
2.11.2
2.11.1
2.11.0
2.10.2
2.10.1
2.10.0
2.9.3
2.9.2
2.9.1
2.9.0
2.8.6
2.8.5
2.8.4
2.8.3
2.8.2
2.8.1
2.8.0
2.7.2
2.7.1
2.7.0
2.6.0
2.5.4
2.5.3
2.5.2
2.5.1
2.5.0
2.4.4
2.4.3
2.4.2
2.4.1
2.4.0
2.3.3
2.3.2
2.3.1
2.3.0
2.2.3
2.2.2
2.2.1
2.2.0
2.2.0-bundlephobia.1
2.1.1
2.1.0
2.0.6
2.0.5
2.0.4
2.0.3
2.0.2
2.0.1
2.0.0
2.0.0-rc.3
2.0.0-rc.2
2.0.0-rc.1
2.0.0-next.17
2.0.0-next.16
2.0.0-next.15
2.0.0-next.14
2.0.0-next.13
2.0.0-next.12
2.0.0-next.11
2.0.0-next.10
2.0.0-next.9
2.0.0-next.8
2.0.0-next.7
2.0.0-next.6
2.0.0-next.5
2.0.0-alpha.4
2.0.0-alpha.3
2.0.0-alpha.2
2.0.0-alpha.1
Tooltip and Popover Positioning Engine
github.com/popperjs/popper-core
popperjs/popper-core
@popperjs/core
/
lib
/
utils
/
uniqueBy.js.flow
15 lines
(11 loc)
•
293 B
Flow
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// @flow
export
default
function
uniqueBy<T>(
arr
:
Array
<T>,
fn
:
T
=>
any
):
Array
<T> {
const
identifiers =
new
Set
();
return
arr.
filter
(
item
=>
{
const
identifier =
fn
(item);
if
(!identifiers.
has
(identifier)) { identifiers.
add
(identifier);
return
true
; } }); }