Skip to content

Add GroupBy function #8

@aswinkarthik

Description

@aswinkarthik

API

john := Person{name: "John", age: 25}
doe := Person{name: "Doe", age: 30}
wick := Person{name: "Wick", age: 25}

input := []Person{
   john,
   doe,
   wick,
}

var output map[int][]Person

godash.GroupBy(input, &output, func(person Person) int {
    return person.age
})

// output is
// { 25: [john, wick], 30:  [doe] }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions