mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-28 06:05:31 +03:00
Rename functions.
This commit is contained in:
parent
ccbab4f685
commit
2c695ce165
@ -73,8 +73,8 @@ succeed a =
|
||||
-- Debug.todo ""
|
||||
|
||||
|
||||
literalSegment : String -> Handler a constructor -> Handler a constructor
|
||||
literalSegment segment (Handler pattern handler toString constructor) =
|
||||
literal : String -> Handler a constructor -> Handler a constructor
|
||||
literal segment (Handler pattern handler toString constructor) =
|
||||
Handler (pattern ++ segment) handler (\values -> toString values ++ segment) constructor
|
||||
|
||||
|
||||
@ -134,7 +134,7 @@ slash (Handler pattern handler toString constructor) =
|
||||
-- b
|
||||
|
||||
|
||||
captureNew :
|
||||
capture :
|
||||
Handler
|
||||
(String -> a)
|
||||
constructor
|
||||
@ -142,7 +142,7 @@ captureNew :
|
||||
Handler
|
||||
a
|
||||
(String -> constructor)
|
||||
captureNew (Handler pattern previousHandler toString constructor) =
|
||||
capture (Handler pattern previousHandler toString constructor) =
|
||||
Handler
|
||||
(pattern ++ "(.*)")
|
||||
--(Debug.todo "")
|
||||
|
@ -13,7 +13,7 @@ all =
|
||||
(\userId ->
|
||||
{ body = "Data for user " ++ userId }
|
||||
)
|
||||
|> captureNew
|
||||
|> capture
|
||||
|> tryMatch "123"
|
||||
|> Expect.equal (Just { body = "Data for user 123" })
|
||||
, test "file with extension" <|
|
||||
@ -22,8 +22,8 @@ all =
|
||||
(\userId ->
|
||||
{ body = "Data for user " ++ userId }
|
||||
)
|
||||
|> captureNew
|
||||
|> literalSegment ".json"
|
||||
|> capture
|
||||
|> literal ".json"
|
||||
|> tryMatch "124.json"
|
||||
|> Expect.equal (Just { body = "Data for user 124" })
|
||||
, test "file path with multiple segments" <|
|
||||
@ -32,10 +32,10 @@ all =
|
||||
(\userId ->
|
||||
{ body = "Data for user " ++ userId }
|
||||
)
|
||||
|> literalSegment "users"
|
||||
|> literal "users"
|
||||
|> slash
|
||||
|> captureNew
|
||||
|> literalSegment ".json"
|
||||
|> capture
|
||||
|> literal ".json"
|
||||
|> tryMatch "users/123.json"
|
||||
|> Expect.equal (Just { body = "Data for user 123" })
|
||||
, test "routes" <|
|
||||
@ -44,10 +44,10 @@ all =
|
||||
(\userId ->
|
||||
{ body = "Data for user " ++ userId }
|
||||
)
|
||||
|> literalSegment "users"
|
||||
|> literal "users"
|
||||
|> slash
|
||||
|> captureNew
|
||||
|> literalSegment ".json"
|
||||
|> capture
|
||||
|> literal ".json"
|
||||
|> withRoutes
|
||||
(\constructor ->
|
||||
[ constructor "100"
|
||||
@ -65,12 +65,12 @@ all =
|
||||
(\userName repoName ->
|
||||
{ body = "Data for user" }
|
||||
)
|
||||
|> literalSegment "repos"
|
||||
|> literal "repos"
|
||||
|> slash
|
||||
|> captureNew
|
||||
|> capture
|
||||
|> slash
|
||||
|> captureNew
|
||||
|> literalSegment ".json"
|
||||
|> capture
|
||||
|> literal ".json"
|
||||
|> withRoutes
|
||||
(\a ->
|
||||
[ a "dillonkearns" "elm-pages"
|
||||
@ -87,13 +87,13 @@ all =
|
||||
(\username repo branch ->
|
||||
{ body = [ username, repo, branch ] |> String.join " - " }
|
||||
)
|
||||
|> literalSegment "repos"
|
||||
|> literal "repos"
|
||||
|> slash
|
||||
|> captureNew
|
||||
|> capture
|
||||
|> slash
|
||||
|> captureNew
|
||||
|> capture
|
||||
|> slash
|
||||
|> captureNew
|
||||
|> capture
|
||||
|> withRoutes
|
||||
(\constructor ->
|
||||
[ constructor "dillonkearns" "elm-pages" "static-files" ]
|
||||
|
Loading…
Reference in New Issue
Block a user