@leanchuck/core - v0.1.1
    Preparing search index...

    Interface RollupOptions<T>

    Options for rollup.

    interface RollupOptions<T> {
        by: KeyAccessor<T>;
        value: NumberAccessor<T>;
        metrics?: Record<string, NumberAccessor<T>>;
        precision?: number;
    }

    Type Parameters

    • T

      The shape of the source item.

    Index

    Properties

    How to determine which group each item belongs to.

    The primary numeric value to sum (used later for Pareto ranking).

    metrics?: Record<string, NumberAccessor<T>>

    Additional named numeric metrics to sum per group. Each entry becomes a key on RollupEntry.metrics.

    metrics: { cost: (r) => r.cost, units: 'quantity' }
    
    precision?: number

    Decimal places for the rounded average. Defaults to 4.