module JsonToType.Format(capitalize, uncapitalize) where
import Data.Text(Text)
import qualified Data.Text as Text
capitalize :: Text -> Text
capitalize :: Text -> Text
capitalize Text
word = Text -> Text
Text.toUpper Text
first Text -> Text -> Text
`Text.append` Text
rest
where
(Text
first, Text
rest) = Int -> Text -> (Text, Text)
Text.splitAt Int
1 Text
word
uncapitalize :: Text -> Text
uncapitalize :: Text -> Text
uncapitalize Text
word = Text -> Text
Text.toLower Text
first Text -> Text -> Text
`Text.append` Text
rest
where
(Text
first, Text
rest) = Int -> Text -> (Text, Text)
Text.splitAt Int
1 Text
word