build(deps): bump github.com/gookit/config/v2 from 2.2.6 to 2.2.7
Bumps [github.com/gookit/config/v2](https://github.com/gookit/config) from 2.2.6 to 2.2.7. - [Release notes](https://github.com/gookit/config/releases) - [Commits](https://github.com/gookit/config/compare/v2.2.6...v2.2.7) --- updated-dependencies: - dependency-name: github.com/gookit/config/v2 dependency-version: 2.2.7 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
+11
-11
@@ -8,12 +8,12 @@ import (
|
||||
)
|
||||
|
||||
// OrElse return default value on val is zero, else return val
|
||||
func OrElse[T comdef.XintOrFloat](val, defVal T) T {
|
||||
func OrElse[T comdef.Number](val, defVal T) T {
|
||||
return ZeroOr(val, defVal)
|
||||
}
|
||||
|
||||
// ZeroOr return default value on val is zero, else return val
|
||||
func ZeroOr[T comdef.XintOrFloat](val, defVal T) T {
|
||||
func ZeroOr[T comdef.Number](val, defVal T) T {
|
||||
if val != 0 {
|
||||
return val
|
||||
}
|
||||
@@ -27,7 +27,7 @@ func ZeroOr[T comdef.XintOrFloat](val, defVal T) T {
|
||||
// LessOr(11, 10, 1) // 1
|
||||
// LessOr(2, 10, 1) // 2
|
||||
// LessOr(10, 10, 1) // 1
|
||||
func LessOr[T comdef.XintOrFloat](val, max, devVal T) T {
|
||||
func LessOr[T comdef.Number](val, max, devVal T) T {
|
||||
if val < max {
|
||||
return val
|
||||
}
|
||||
@@ -41,7 +41,7 @@ func LessOr[T comdef.XintOrFloat](val, max, devVal T) T {
|
||||
// LteOr(11, 10, 1) // 11
|
||||
// LteOr(2, 10, 1) // 2
|
||||
// LteOr(10, 10, 1) // 10
|
||||
func LteOr[T comdef.XintOrFloat](val, max, devVal T) T {
|
||||
func LteOr[T comdef.Number](val, max, devVal T) T {
|
||||
if val <= max {
|
||||
return val
|
||||
}
|
||||
@@ -54,7 +54,7 @@ func LteOr[T comdef.XintOrFloat](val, max, devVal T) T {
|
||||
//
|
||||
// GreaterOr(23, 0, 2) // 23
|
||||
// GreaterOr(0, 0, 2) // 2
|
||||
func GreaterOr[T comdef.XintOrFloat](val, min, defVal T) T {
|
||||
func GreaterOr[T comdef.Number](val, min, defVal T) T {
|
||||
if val > min {
|
||||
return val
|
||||
}
|
||||
@@ -67,15 +67,15 @@ func GreaterOr[T comdef.XintOrFloat](val, min, defVal T) T {
|
||||
//
|
||||
// GteOr(23, 0, 2) // 23
|
||||
// GteOr(0, 0, 2) // 0
|
||||
func GteOr[T comdef.XintOrFloat](val, min, defVal T) T {
|
||||
func GteOr[T comdef.Number](val, min, defVal T) T {
|
||||
if val >= min {
|
||||
return val
|
||||
}
|
||||
return defVal
|
||||
}
|
||||
|
||||
// Mul computes the a*b value, rounding the result.
|
||||
func Mul[T1, T2 comdef.XintOrFloat](a T1, b T2) float64 {
|
||||
// Mul computes the `a*b` value, rounding the result.
|
||||
func Mul[T1, T2 comdef.Number](a T1, b T2) float64 {
|
||||
return math.Round(SafeFloat(a) * SafeFloat(b))
|
||||
}
|
||||
|
||||
@@ -84,8 +84,8 @@ func MulF2i(a, b float64) int {
|
||||
return int(math.Round(a * b))
|
||||
}
|
||||
|
||||
// Div computes the a/b value, result use round handle.
|
||||
func Div[T1, T2 comdef.XintOrFloat](a T1, b T2) float64 {
|
||||
// Div computes the `a/b` value, result uses a round handle.
|
||||
func Div[T1, T2 comdef.Number](a T1, b T2) float64 {
|
||||
return math.Round(SafeFloat(a) / SafeFloat(b))
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ func DivF2i(a, b float64) int {
|
||||
return int(math.Round(a / b))
|
||||
}
|
||||
|
||||
// Percent returns a values percent of the total
|
||||
// Percent returns a value percentage of the total
|
||||
func Percent(val, total int) float64 {
|
||||
if total == 0 {
|
||||
return float64(0)
|
||||
|
||||
Reference in New Issue
Block a user