-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcase_configuration.go
More file actions
65 lines (62 loc) · 899 Bytes
/
Copy pathcase_configuration.go
File metadata and controls
65 lines (62 loc) · 899 Bytes
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package main
import "github.com/iancoleman/strcase"
type caseConfiguration struct {
name caseName
convert func(string) string
head delimiter
tail delimiter
}
var caseConfigurations = []*caseConfiguration{
{
upperCamel,
strcase.ToCamel,
lowerCase,
upperCase,
},
{
camel,
strcase.ToLowerCamel,
nonAlphabet,
upperCase,
},
{
kebab,
strcase.ToKebab,
nonAlphabet,
nonAlphabet,
},
{
upperKebab,
strcase.ToScreamingKebab,
nonAlphabet,
nonAlphabet,
},
{
snake,
strcase.ToSnake,
nonAlphabet,
nonAlphabet,
},
{
upperSnake,
strcase.ToScreamingSnake,
nonAlphabet,
nonAlphabet,
},
{
space,
func(s string) string {
return strcase.ToDelimited(s, ' ')
},
nonAlphabet,
nonAlphabet,
},
{
upperSpace,
func(s string) string {
return strcase.ToScreamingDelimited(s, ' ', "", true)
},
nonAlphabet,
nonAlphabet,
},
}