27 lines
334 B
Go
27 lines
334 B
Go
package views
|
|
|
|
func min(x, y int) int {
|
|
if x < y {
|
|
return x
|
|
}
|
|
return y
|
|
}
|
|
|
|
func max(x, y int) int {
|
|
if x > y {
|
|
return x
|
|
}
|
|
return y
|
|
}
|
|
|
|
func limit(v, minv, maxv int) int {
|
|
return min(max(v, minv), maxv)
|
|
}
|
|
|
|
func iff[T any](condition bool, trueValue, falseValue T) T {
|
|
if condition {
|
|
return trueValue
|
|
}
|
|
return falseValue
|
|
}
|