API Reference

Returns the number of instances of each item in an array.

function counts<T>(arr: T[]): { [key: string]: number }

// Example:

counts(["a","b","c","c","d","d","d"]) //=> {
  "a": 1,
  "b": 1,
  "c": 2,
  "d": 3
}