github.com/m4gshm/gollections@v0.0.13-0.20240331203319-a34a86e58a24/break/predicate/one/api.go (about)

     1  // Package one provides predicate builders
     2  package one
     3  
     4  import (
     5  	"github.com/m4gshm/gollections/break/predicate"
     6  	"github.com/m4gshm/gollections/collection/immutable/set"
     7  	"github.com/m4gshm/gollections/convert/as"
     8  )
     9  
    10  // Of creates a predicate that can be used to compare a value with predefined expected values
    11  func Of[T comparable](expected ...T) predicate.Predicate[T] {
    12  	return as.ErrTail(set.Of(expected...).Contains)
    13  }