aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/markbates/going/defaults/defaults.go
blob: 0d81de6f425efe80f3106ed456b51f4740f4744a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package defaults

func String(s1, s2 string) string {
	if s1 == "" {
		return s2
	}
	return s1
}

func Int(i1, i2 int) int {
	if i1 == 0 {
		return i2
	}
	return i1
}

func Int64(i1, i2 int64) int64 {
	if i1 == 0 {
		return i2
	}
	return i1
}

func Float32(i1, i2 float32) float32 {
	if i1 == 0.0 {
		return i2
	}
	return i1
}

func Float64(i1, i2 float64) float64 {
	if i1 == 0.0 {
		return i2
	}
	return i1
}