/** * @file Shims for `Object.groupBy` and `Map.groupBy`, both Node 21. * The two differ in more than their container, which is why they are separate * spec algorithms rather than one with a flag: * * - `Object.groupBy` coerces each key with ToPropertyKey, so `1` and `'1'` land * in the SAME group, and it returns a null-prototype object so a key named * `toString` cannot collide with `Object.prototype`. * - `Map.groupBy` keys by SameValueZero, so `1` and `'1'` stay apart, and any * value at all can be a key. Both pass the index as the callback's second * argument and both iterate the iterable exactly once. */ /** * The native `Map.groupBy`, or undefined below Node 21. */ export declare const mapGroupByNative: ((items: Iterable, keySelector: (item: T, index: number) => K) => Map) | undefined; /** * `Map.groupBy` shim. Keys compare by SameValueZero, which `Map` already does, * so no coercion happens and `1` stays distinct from `'1'`. */ export declare function mapGroupByShim(items: Iterable, keySelector: (item: T, index: number) => K): Map; export declare const mapGroupBy: (items: Iterable, keySelector: (item: T, index: number) => K) => Map; /** * The native `Object.groupBy`, or undefined below Node 21. */ export declare const objectGroupByNative: ((items: Iterable, keySelector: (item: T, index: number) => K) => Partial>) | undefined; /** * `Object.groupBy` shim. The result has a null prototype, per spec, so a group * keyed `toString` or `__proto__` is an ordinary own property. */ export declare function objectGroupByShim(items: Iterable, keySelector: (item: T, index: number) => K): Partial>; export declare const objectGroupBy: (items: Iterable, keySelector: (item: T, index: number) => K) => Partial>;