github.com/m4gshm/gollections@v0.0.13-0.20240331203319-a34a86e58a24/slice/filter/api.go (about) 1 // Package filter provides aliases for slice filtering helpers 2 package filter 3 4 import ( 5 "github.com/m4gshm/gollections/slice" 6 ) 7 8 // AndConvert filters the 'From' elements, and then converts them to 'To' 9 func AndConvert[FS ~[]From, From, To any](elements FS, filter func(From) bool, converter func(From) To) []To { 10 return slice.FilterAndConvert(elements, filter, converter) 11 } 12 13 // ConvertFilter filters the 'From' elements, then converts them to 'To', and then filters that ones 14 func ConvertFilter[FS ~[]From, From, To any](elements FS, filter func(From) bool, converter func(From) To, filterTo func(To) bool) []To { 15 return slice.FilterConvertFilter(elements, filter, converter, filterTo) 16 }