mirror of
https://github.com/rjNemo/underscore
synced 2026-06-06 02:26:42 +00:00
8 lines
118 B
Go
8 lines
118 B
Go
package underscore
|
|
|
|
func Ternary[T any](condition bool, pos, neg T) T {
|
|
if condition {
|
|
return pos
|
|
}
|
|
return neg
|
|
}
|