MCPcopy Create free account
hub / github.com/adam-hanna/arrayOperations / countAnimals

Function countAnimals

arrayOperations_unit_test.go:91–100  ·  view source on GitHub ↗
(state map[string]int, animal string)

Source from the content-addressed store, hash-verified

89}
90
91func countAnimals(state map[string]int, animal string) map[string]int {
92 count, ok := state[animal]
93 if !ok {
94 state[animal] = 1
95 return state
96 }
97
98 state[animal] = count + 1
99 return state
100}
101
102func TestReduce(t *testing.T) {
103 arr := []string{"cat", "dog", "cat", "cow"}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…