mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-09-22 04:39:59 +03:00
parent
d46560f876
commit
b8958b9f18
@ -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 ""
|
||||
|
Loading…
Reference in New Issue
Block a user