MCPcopy Create free account
hub / github.com/immutable-js/immutable-js / countByFactory

Function countByFactory

src/Operations.js:376–382  ·  view source on GitHub ↗
(collection, grouper, context)

Source from the content-addressed store, hash-verified

374}
375
376export function countByFactory(collection, grouper, context) {
377 const groups = Map().asMutable();
378 collection.__iterate((v, k) => {
379 groups.update(grouper.call(context, v, k, collection), 0, (a) => a + 1);
380 });
381 return groups.asImmutable();
382}
383
384export function groupByFactory(collection, grouper, context) {
385 const isKeyedIter = isKeyed(collection);

Callers 1

countByFunction · 0.90

Calls 5

MapClass · 0.90
asMutableMethod · 0.65
updateMethod · 0.65
asImmutableMethod · 0.65
__iterateMethod · 0.45

Tested by

no test coverage detected