Created
August 4, 2016 19:10
-
-
Save macalinao/caa9e7105864ce03835ecd32ce4499b6 to your computer and use it in GitHub Desktop.
i cry every time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// StatusesWithIds finds all condition statuses that match the given ids. | |
func StatusesWithIds(in []*cpb.ConditionStatus, ids []*cpb.ConditionId) []*cpb.ConditionStatus { | |
// create our filter set | |
set := map[string]bool{} | |
for _, id := range ids { | |
set[util.StringifyID(id)] = true | |
} | |
// i.e. ids.map(util.StringifyID).toSet | |
// filter stuff out | |
var ret []*cpb.ConditionStatus | |
for _, status := range in { | |
if set[util.StringifyID(status.Id)] { | |
ret = append(ret, status) | |
} | |
} | |
// i.e. in.filter(set[util.StringifyID(_.Id)]) | |
return ret | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what is wrong with you ian, haha