Skip to content

Commit 88d4b22

Browse files
committed
Fix whenPathIs and add whenFieldIs
1 parent 400cd0d commit 88d4b22

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Lib/Util.elm

+6-1
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,16 @@ whenTagIs val =
9696
whenPathIs [ "tag" ] val
9797

9898

99-
whenPathIs : List String -> String -> Decode.Decoder String -> Decode.Decoder String
99+
whenPathIs : List String -> String -> Decode.Decoder a -> Decode.Decoder a
100100
whenPathIs path val =
101101
when (Decode.at path Decode.string) ((==) val)
102102

103103

104+
whenFieldIs : String -> String -> Decode.Decoder a -> Decode.Decoder a
105+
whenFieldIs fieldName val =
106+
when (Decode.field fieldName Decode.string) ((==) val)
107+
108+
104109
decodeUrl : Decode.Decoder Url
105110
decodeUrl =
106111
let

0 commit comments

Comments
 (0)