Passed
Pull Request — main (#40)
by Serhii
01:18
created

option.go   A

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 16
dl 0
loc 29
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A timeago.optionIsEnabled 0 8 3
A timeago.enableOption 0 2 1
A timeago.enableOptions 0 3 2
1
package timeago
2
3
const (
4
	Upcoming Option = "upcoming"
5
	Online   Option = "online"
6
	JustNow  Option = "justNow"
7
	NoSuffix Option = "noSuffix"
8
)
9
10
type Option string
11
12
func enableOption(opt Option) {
13
	options = append(options, opt)
14
}
15
16
func enableOptions(opts []Option) {
17
	for _, opt := range opts {
18
		enableOption(opt)
19
	}
20
}
21
22
func optionIsEnabled(opt Option) bool {
23
	for _, option := range options {
24
		if option == opt {
25
			return true
26
		}
27
	}
28
29
	return false
30
}
31