3 // Returns true if the given *Anime should be included in the final ResultSet
4 type ResultFilter func(*Anime) bool
6 // Returns true if the Anime with the given title should be included in the final ResultSet
7 type TitleComparer func(string) bool
9 // Filters a ResultSet according to the given TitleComparer; returns the filtered ResultSet
10 func (rs ResultSet) FilterByTitles(cmp TitleComparer) ResultSet {
13 if cmp(a.PrimaryTitle) {
17 for _, m := range []map[string][]Name{
18 a.OfficialNames, a.ShortNames, a.Synonyms,
20 for _, names := range m {
21 for _, name := range names {
32 // Filters a ResultSet according to the given ResultFilter; returns the filtered ResultSet
33 func (rs ResultSet) Filter(filter ResultFilter) ResultSet {
35 for _, a := range rs {