Skip to content

Commit ff00c74

Browse files
authored
Merge pull request #33 from menelaos/rename-matchhash
Rename `matchHash` and `matchHash'`
2 parents 967af5a + 269266a commit ff00c74

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/Routing.purs

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ module Routing (
33
hashes,
44
matches,
55
matches',
6-
matchHash,
7-
matchHash',
6+
match,
7+
matchWith,
88
matchesAff,
99
matchesAff'
1010
) where
@@ -46,7 +46,7 @@ matches = matches' decodeURIComponent
4646
matches' :: forall e a. (String -> String) ->
4747
Match a -> (Maybe a -> a -> Eff e Unit) -> Eff e Unit
4848
matches' decoder routing cb = hashes $ \old new ->
49-
let mr = matchHash' decoder routing
49+
let mr = matchWith decoder routing
5050
fst = either (const Nothing) Just $ mr old
5151
in either (const $ pure unit) (cb fst) $ mr new
5252

@@ -61,8 +61,8 @@ matchesAff :: forall e a. Match a -> Aff e (Tuple (Maybe a) a)
6161
matchesAff = matchesAff' decodeURIComponent
6262

6363

64-
matchHash :: forall a. Match a -> String -> Either String a
65-
matchHash = matchHash' decodeURIComponent
64+
match :: forall a. Match a -> String -> Either String a
65+
match = matchWith decodeURIComponent
6666

67-
matchHash' :: forall a. (String -> String) -> Match a -> String -> Either String a
68-
matchHash' decoder matcher hash = runMatch matcher $ parse decoder hash
67+
matchWith :: forall a. (String -> String) -> Match a -> String -> Either String a
68+
matchWith decoder matcher hash = runMatch matcher $ parse decoder hash

test/Test/Main.purs

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Data.List (List)
88
import Data.Map as M
99

1010

11-
import Routing (matchHash)
11+
import Routing (match)
1212
import Routing.Match (Match, list)
1313
import Routing.Match.Class (num, int, param, bool, lit, params)
1414

@@ -34,8 +34,8 @@ routing =
3434

3535
main :: Eff (console :: CONSOLE) Unit
3636
main = do
37-
logShow $ matchHash routing "foo/12/?welp='hi'&b=false"
38-
logShow $ matchHash routing "/quux/42"
37+
logShow $ match routing "foo/12/?welp='hi'&b=false"
38+
logShow $ match routing "/quux/42"
3939

4040
-- (minimal test for browser)
4141

0 commit comments

Comments
 (0)