Handle endings in toModuleName.

This commit is contained in:
Dillon Kearns 2022-09-15 10:39:22 -07:00
parent ac57661c61
commit 3bb7c37e4a
2 changed files with 10 additions and 4 deletions

View File

@ -25,8 +25,9 @@ type alias RoutePattern =
toModuleName : RoutePattern -> List String
toModuleName route =
case route.ending of
Nothing ->
let
segmentsAsModuleParts : List String
segmentsAsModuleParts =
route.segments
|> List.foldl
(\segment soFar ->
@ -38,9 +39,13 @@ toModuleName route =
soFar ++ [ name ++ "_" ]
)
[]
in
case route.ending of
Nothing ->
segmentsAsModuleParts
_ ->
[ "Unhandled2" ]
Just ending ->
segmentsAsModuleParts ++ [ endingToVariantName ending |> Tuple.first ]
fromModuleName : List String -> Maybe RoutePattern

View File

@ -204,6 +204,7 @@ routeModuleNameFuzzer =
Fuzz.oneOf
[ Fuzz.constant [ "Index" ]
, Fuzz.constant [ "User", "Id_" ]
, Fuzz.constant [ "Docs", "Section__" ]
]