Function count

  • Creates an object composed of keys from the results of running elements of collection thru iteratee. The corresponding value of each key is the number of times the key was returned by iteratee.

    Returns

    Returns an Object with the frequency values

    Example

    count([6.1, 4.2, 6.3], Math.floor);
    // { '4': 1, '6': 2 }

    // property iteratee shorthand.
    count(['one', 'two', 'three'], x => x.length);
    // { '3': 2, '5': 1 }

    Type Parameters

    • T

    Parameters

    • obj: T[]
    • fn: Iteratee<T, any, any>

    Returns Record<string, number>

  • Type Parameters

    • T

    Parameters

    • obj: Object
    • fn: Iteratee<T, any, any>

    Returns Record<string, number>

Generated using TypeDoc