Options
All
  • Public
  • Public/Protected
  • All
Menu

Module array/groupBy

Index

References

Functions

References

Renames and re-exports groupBy

Functions

  • groupBy<T>(fns: ArrPred<T>[], list: ArrayLike<T>): T[][]
  • groupBy<T>(fns: ArrPred<T>[]): (list: ArrayLike<T>) => T[][]
  • Creates an array of arrays generated from the results of running each element of list thru each fn. The corresponding value of each index is an array of elements satisfies to function with that index, and the last array is elements with no satisfied function

    example

    groupBy([isPositive, isZero, isNegative], [0, -3, 2, 'str', 4, -1]);//=> [[2,4], [0], [-3, -1], ['str']]

    Type parameters

    • T

    Parameters

    • fns: ArrPred<T>[]

      The functions to check values in a list.

    • list: ArrayLike<T>

      The list to iterate over.

    Returns T[][]

    Returns the composed array.

  • Creates an array of arrays generated from the results of running each element of list thru each fn. The corresponding value of each index is an array of elements satisfies to function with that index, and the last array is elements with no satisfied function

    example

    groupBy([isPositive, isZero, isNegative], [0, -3, 2, 'str', 4, -1]);//=> [[2,4], [0], [-3, -1], ['str']]

    Type parameters

    • T

    Parameters

    • fns: ArrPred<T>[]

      The functions to check values in a list.

    Returns (list: ArrayLike<T>) => T[][]

    Returns the composed array.

      • (list: ArrayLike<T>): T[][]
      • Parameters

        • list: ArrayLike<T>

        Returns T[][]

Generated using TypeDoc