Documentation
¶
Overview ¶
Package condition contains some functions for conditional judgment. eg. And, Or, TernaryOperator ... The implementation of this package refers to the implementation of carlmjohnson's truthy package, you may find more useful information in truthy(https://github.com/carlmjohnson/truthy), thanks carlmjohnson.
Index ¶
- func And[T, U any](a T, b U) bool
- func Bool[T any](value T) bool
- func Nand[T, U any](a T, b U) bool
- func Nor[T, U any](a T, b U) bool
- func Or[T, U any](a T, b U) bool
- func TernaryOperator[T, U any](isTrue T, ifValue U, elseValue U) U
- func Xnor[T, U any](a T, b U) bool
- func Xor[T, U any](a T, b U) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
Bool returns the truthy value of anything. If the value's type has a Bool() bool method, the method is called and returned. If the type has an IsZero() bool method, the opposite value is returned. Slices and maps are truthy if they have a length greater than zero. All other types are truthy if they are not their zero value.
func TernaryOperator ¶
func TernaryOperator[T, U any](isTrue T, ifValue U, elseValue U) U
TernaryOperator checks the value of param `isTrue`, if true return ifValue else return elseValue
Types ¶
This section is empty.