UNPKG
object-group-bye
Version:
latest (0.1.1)
0.1.1
0.1.0
ponyfill or polyfill of Object.groupBy ES feature
github.com/Vinsurs/object.groupby
object-group-bye
/
dist
/
object.groupby.js
14 lines
(13 loc)
•
259 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function
i
(
n, f
) {
const
e = {};
Object
.
setPrototypeOf
(e,
null
);
let
r =
0
;
for
(
const
o
of
n) {
let
t =
f
(o, r++);
typeof
t !=
"symbol"
&& (t =
String
(t)), e[t] || (e[t] = []), e[t].
push
(o); }
return
e; }
export
{ i
as
ObjectGroupBy
};