github.com/m4gshm/gollections@v0.0.13-0.20240331203319-a34a86e58a24/collection/filter/api.go (about)

     1  // Package filter provides aliases for collections filtering helpers
     2  package filter
     3  
     4  import (
     5  	"github.com/m4gshm/gollections/collection"
     6  	"github.com/m4gshm/gollections/loop"
     7  )
     8  
     9  // AndConvert - filter.AndConvert is short alias of collection.FilterAndConvert
    10  func AndConvert[From, To any, IT collection.Iterable[From]](elements IT, filter func(From) bool, converter func(From) To) loop.Loop[To] {
    11  	return collection.FilterAndConvert(elements, filter, converter)
    12  }
    13  
    14  // ConvertFilter - filter.ConvertFilter is short alias of slice.FilterConvertFilter
    15  func ConvertFilter[From, To any, IT collection.Iterable[From]](elements IT, filterFrom func(From) bool, converter func(From) To, filterTo func(To) bool) loop.Loop[To] {
    16  	return collection.FilterAndConvert(elements, filterFrom, converter).Filter(filterTo)
    17  }