github.com/m4gshm/gollections@v0.0.13-0.20240331203319-a34a86e58a24/op/check/api.go (about) 1 // Package check provides common predicate functions 2 package check 3 4 import ( 5 "reflect" 6 ) 7 8 // Nil checks whether the reference is nil 9 func Nil[T any](val *T) bool { 10 return val == nil 11 } 12 13 // NotNil checks whether the reference is not nil 14 func NotNil[T any](val *T) bool { 15 return !Nil(val) 16 } 17 18 // Zero checks whether the value is zero 19 func Zero[T any](value T) bool { 20 return reflect.ValueOf(value).IsZero() 21 }