The type of elements in the array / 数组元素的类型
The type of the key (extends PropertyKey) / 键的类型(继承 PropertyKey)
An object with grouped elements. 分组后的对象
Uses plain object for key lookup, overall O(n) time complexity. Key lookup is O(1) via hasOwn.
使用普通对象实现键查找,整体时间复杂度 O(n)。 通过 hasOwn 实现 O(1) 键查找。
Groups the elements of an array based on the given function.
This function takes an array and a grouping function, and returns an object where each key is a value returned by the grouping function, and the value is an array of elements that produced that key.
根据给定函数对数组元素进行分组。
此函数接收一个数组和一个分组函数,返回一个对象,其中每个键是由分组函数返回的值, 值是产生该键的元素数组。