mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-23 20:03:31 +03:00
Handle endings in toModuleName.
This commit is contained in:
parent
ac57661c61
commit
3bb7c37e4a
@ -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
|
||||
|
@ -204,6 +204,7 @@ routeModuleNameFuzzer =
|
||||
Fuzz.oneOf
|
||||
[ Fuzz.constant [ "Index" ]
|
||||
, Fuzz.constant [ "User", "Id_" ]
|
||||
, Fuzz.constant [ "Docs", "Section__" ]
|
||||
]
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user