module Paddle.FieldModifier ( modifier , customJSONOptions ) where import Data.Aeson import Protolude import Prelude () import Data.Char (toLower, isUpper) modifier :: [Char] -> [Char] modifier :: [Char] -> [Char] modifier = (Char -> [Char]) -> [Char] -> [Char] forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b] concatMap (\Char x -> if Char -> Bool isUpper Char x then [Char '_', Char -> Char toLower Char x] else [Char x]) customJSONOptions :: Options customJSONOptions :: Options customJSONOptions = Options defaultOptions { fieldLabelModifier :: [Char] -> [Char] fieldLabelModifier = [Char] -> [Char] modifier }