Passed
Push — v3.0.0 ( 671bfc...c3fef3 )
by Serhii
01:12
created

config.go   A

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 12
dl 0
loc 24
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A timeago.Config.LocationIsSet 0 2 1
A timeago.NewConfig 0 5 1
1
package timeago
2
3
type Config struct {
4
	Language string
5
6
	// Location is the timezone location neeed for parsing
7
	// string date like "2019-01-01 00:00:00" to time.Time.
8
	// If Location is not set it will default to the server's.
9
	// Example: "America/New_York", "Asia/China"
10
	Location string
11
12
	Translations []Translation
13
}
14
15
func NewConfig(lang, loc string, trans []Translation) *Config {
16
	return &Config{
17
		Language:     lang,
18
		Location:     loc,
19
		Translations: trans,
20
	}
21
}
22
23
func (c Config) LocationIsSet() bool {
24
	return c.Location != ""
25
}
26