Skip to content

Commit

Permalink
stupid folder logic
Browse files Browse the repository at this point in the history
  • Loading branch information
markbates committed Jan 17, 2019
1 parent bea7f92 commit a62e61d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion name/folder.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ func Folder(s string, exts ...string) string {
func (i Ident) Folder(exts ...string) Ident {
var parts []string

for _, part := range strings.Split(i.Original, "/") {
s := i.Original
if i.Pascalize().String() == s {
s = i.Underscore().String()
s = strings.Replace(s, "_", "/", -1)
}
for _, part := range strings.Split(s, "/") {
part = strings.ToLower(part)
part = alphanum.ReplaceAllString(part, "")
parts = append(parts, part)
Expand Down
1 change: 1 addition & 0 deletions name/folder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func Test_Folder(t *testing.T) {
{"widgets", "widgets"},
{"User", "user"},
{"U$er", "uer"},
{"AdminUser", "admin/user"},
}

for _, tt := range table {
Expand Down

0 comments on commit a62e61d

Please sign in to comment.