-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.go
27 lines (22 loc) · 893 Bytes
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package uniquenamegenerator
type Transformer func(s string) string
type option func(ung *UniqueNameGenerator)
// WithSeparator specifies the separator to be used to separate each selected dictionary word in the resulting name
func WithSeparator(separator string) option {
return func(ung *UniqueNameGenerator) {
ung.separator = separator
}
}
// WithDictionaries sets the order specific dictionaries to be used in name generation
func WithDictionaries(dictionaries [][]string) option {
return func(ung *UniqueNameGenerator) {
ung.dictionaries = dictionaries
}
}
// WithTransformer specifies a function to be applied against dictionary words selected for the unique name
// this is useful if the dictionaries are retrieved from uncontrolled sources
func WithTransformer(transformer Transformer) option {
return func(ung *UniqueNameGenerator) {
ung.transformer = transformer
}
}