Skip to content

Commit

Permalink
refactor: rename Condition to If
Browse files Browse the repository at this point in the history
  • Loading branch information
sjsdfg committed Sep 3, 2020
1 parent b38779a commit e24049c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Float32Utils/compare_float32.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ func Min(list ...float32) float32 {
return min
}

func Condition(condition bool, ifTrue, ifFalse float32) float32 {
func If(condition bool, ifTrue, ifFalse float32) float32 {
if condition {
return ifTrue
}
return ifFalse
}

func Abs(a float32) float32 {
return Condition(a > 0, a, -a)
return If(a > 0, a, -a)
}

func Equal(a, b float32) bool {
Expand Down
4 changes: 2 additions & 2 deletions Float64Utils/compare_float64.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ func Min(list ...float64) float64 {
return min
}

func Condition(condition bool, ifTrue, ifFalse float64) float64 {
func If(condition bool, ifTrue, ifFalse float64) float64 {
if condition {
return ifTrue
}
return ifFalse
}

func Abs(a float64) float64 {
return Condition(a > 0, a, -a)
return If(a > 0, a, -a)
}

func Equal(a, b float64) bool {
Expand Down
4 changes: 2 additions & 2 deletions Int64Utils/compare_int64.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ func Min(list ...int64) int64 {
return min
}

func Condition(condition bool, ifTrue, ifFalse int64) int64 {
func If(condition bool, ifTrue, ifFalse int64) int64 {
if condition {
return ifTrue
}
return ifFalse
}

func Abs(a int64) int64 {
return Condition(a > 0, a, -a)
return If(a > 0, a, -a)
}
4 changes: 2 additions & 2 deletions IntUtils/compare_int.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ func Min(list ...int) int {
return min
}

func Condition(condition bool, ifTrue, ifFalse int) int {
func If(condition bool, ifTrue, ifFalse int) int {
if condition {
return ifTrue
}
return ifFalse
}

func Abs(a int) int {
return Condition(a > 0, a, -a)
return If(a > 0, a, -a)
}
4 changes: 2 additions & 2 deletions StringUtils/string_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ func IsDigital(str string) bool {
}

func DefaultIfEmpty(str, defaultStr string) string {
return Condition(IsNotEmpty(str), str, defaultStr)
return If(IsNotEmpty(str), str, defaultStr)
}

func Condition(condition bool, ifTrue, ifFalse string) string {
func If(condition bool, ifTrue, ifFalse string) string {
if condition {
return ifTrue
}
Expand Down
2 changes: 1 addition & 1 deletion TimeUtils/time_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func Min(list ...time.Time) time.Time {
return min
}

func Condition(condition bool, ifTrue, ifFalse time.Time) time.Time {
func If(condition bool, ifTrue, ifFalse time.Time) time.Time {
if condition {
return ifTrue
}
Expand Down

0 comments on commit e24049c

Please sign in to comment.