Passed
Push — master ( 1dbab0...58c7cb )
by Serhii
02:41 queued 50s
created

timeago.SetConfig   A

Complexity

Conditions 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
dl 0
loc 6
rs 10
c 0
b 0
f 0
ccs 3
cts 3
cp 1
crap 2
nop 1
1
package timeago
2
3
type Config struct {
4
	Language string
5
	Location string
6
}
7
8
var config = Config{
9
	Language: "en",
10
	Location: "",
11
}
12
13
func SetConfig(conf Config) {
14 1
	if conf.Language == "" {
15 1
		conf.Language = config.Language
16
	}
17
18 1
	config = conf
19
}
20
21
func locationIsSet() bool {
22 1
	return config.Location != ""
23
}
24
25
func locationIsNotSet() bool {
26
	return !locationIsSet()
27
}
28