UNPKG
quxt
Version:
latest (1.1.1)
1.1.1
1.1.0
1.0.0
Lodash but OVERPOWERED!
github.com/quxapp/quxt
quxapp/quxt
quxt
/
arrays
/
mode.js
9 lines
(7 loc)
•
234 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
const
frequency =
require
(
'../.internal/frequency'
)
function
mode
(
data
) {
const
chart =
frequency
(data)
const
max =
Math
.
max
(...chart.
values
())
return
[...chart.
keys
()].
filter
(
x
=>
chart.
get
(x) === max) }
module
.
exports
= mode