1 contributor
Like
Install count-by as a package?
Copied
npm i @bit/justin-capalbo.ramda.count-by
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example modifieddraft
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
and packages in Bit or NPM to the example. any of the 1 million componentstoggle layout
No preview available
chevron_left
chevron_right
countBy (
fn:
Function
,list:
) : Array
Object
Counts the elements of a list according to how many match each value of a
key generated by the supplied function. Returns an object mapping the keys
produced by fn
to the number of occurrences in the list. Note that all
keys are coerced to strings because of how JavaScript objects work.
Acts as a transducer if a transformer is given in list position.
Example
Arguments
fn:
Function
The function used to map values to keys.
list:
Array
The list to count elements from.
Returns
Object
An object mapping keys to number of occurrences in the list.