thi-ng/umbrella

View on GitHub
packages/transducers/src/internal/group-opts.ts

Summary

Maintainability
A
0 mins
Test Coverage
import type { GroupByOpts } from "../api.js";
import { push } from "../push.js";

/**
 * Shared helper function for `groupBy*` reducers
 *
 * @param opts -
 *
 * @internal
 */
export const __groupByOpts = <SRC, KEY, GROUP>(
    opts?: Partial<GroupByOpts<SRC, PropertyKey, GROUP>>
) =>
    <GroupByOpts<SRC, KEY, GROUP>>{
        key: (x: any) => x,
        group: push(),
        ...opts,
    };