Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "utils/tabulate/docs/types/index.d"

Index

Functions

Functions

Export assignment tabulate

  • tabulate(collection: Collection): Array<Array<any>>
  • Generates a frequency table.

    Notes

    • The output is an array of arrays. Each sub-array corresponds to a unique value in the input collection and is structured as follows:

      • 0: unique value
      • 1: value count
      • 2: frequency percentage
    • If provided an empty collection, the function returns an empty array.

    Parameters

    Returns Array < Array < any > >

    frequency table

    Example

    var arr = [ 'beep', 'boop', 'foo', 'beep' ];
    
    var out = tabulate( arr );
    // returns [ [ 'beep', 2, 0.5 ], [ 'boop', 1, 0.25 ], [ 'foo', 1, 0.25 ] ]