Counts the number of items grouped by the callback's return value.
Internally backed by a Map keyed on the raw callback value — same identity semantics as [[groupBy]].
Map
countBy(['apple', 'banana', 'avocado'], v => v[0])// [ ['a', 2], ['b', 1] ] Copy
countBy(['apple', 'banana', 'avocado'], v => v[0])// [ ['a', 2], ['b', 1] ]
Counts the number of items grouped by the callback's return value.
Internally backed by a
Mapkeyed on the raw callback value — same identity semantics as [[groupBy]].