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

timeago.optionIsEnabled   A

Complexity

Conditions 3

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 5
dl 0
loc 8
rs 10
c 0
b 0
f 0
nop 1
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