Documentation
    Preparing search index...

    Function groupBy

    • 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[]>>

      --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: T) => G

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

      --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]}--