Revert "Adds conditional"

This reverts commit 01b6f83bb8.
This commit is contained in:
Tessa Kelly 2022-08-25 15:44:18 -07:00
parent d46560f876
commit b8958b9f18

View File

@ -8,7 +8,6 @@ module Code exposing
, record, recordMultiline
, newlineWithIndent
, withParens
, conditional
)
{-|
@ -22,7 +21,6 @@ module Code exposing
@docs record, recordMultiline
@docs newlineWithIndent
@docs withParens
@docs conditional
-}
@ -140,29 +138,3 @@ newlineWithIndent indent =
withParens : String -> String
withParens val =
"(" ++ val ++ ")"
{-| pass in a list of tuples of (condition, result) and an else option.
-}
conditional : List ( String, String ) -> String -> Int -> String
conditional options else_ indent =
let
conditionalBranch type_ ( condition, result ) =
[ type_ ++ " " ++ condition ++ " then"
, newlineWithIndent indent
, result
]
in
case options of
[] ->
else_
if_ :: elseIfs ->
(conditionalBranch "if" if_
++ List.concatMap (conditionalBranch "else if") elseIfs
++ [ "else"
, newlineWithIndent indent
, else_
]
)
|> String.join ""