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

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