Passed
Push — v3.0.0 ( 268334 )
by Serhii
01:47
created

option_utils.go   A

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 12
dl 0
loc 22
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
import "github.com/SerhiiCho/timeago/v3/option"
4
5
func enableOption(opt option.Option) {
6
	options = append(options, opt)
7
}
8
9
func enableOptions(opts []option.Option) {
10
	for _, opt := range opts {
11
		enableOption(opt)
12
	}
13
}
14
15
func optionIsEnabled(opt option.Option) bool {
16
	for _, option := range options {
17
		if option == opt {
18
			return true
19
		}
20
	}
21
22
	return false
23
}
24