• Accumulates each chunk into an object where the key is the result of calling a provided function or using a chunk's property.

    The key can be the result of a property on the chunk.

    Type Parameters

    • T

    • K extends string | number | symbol

    Parameters

    • propName: K

    Returns TransformStream<T, Record<string, T[]>>

    See

    label:function

    Example

    --one------------two------------------three-----------------------------

    groupBy('length')

    --{'3':['one']}--{'3',['one','two']}--{'3':['one','two'],'5':['three']}-
  • The key can be the result of calling a provided function.

    Type Parameters

    • T

    • G extends Stringable

    Parameters

    • propName: ((chunk) => G)
        • (chunk): G
        • Parameters

          • chunk: T

          Returns G

    Returns TransformStream<T, Record<string, T[]>>

    Example

    --6.1----------4.2--------------------6.3------------------------

    groupBy(Math.floor)

    --{'6':[6.1]}--{'4':[4.2],'6':[6.1]}--{'4':[4.2],'6':[6.1,6.3]}--

Generated using TypeDoc