module Vimeta.UI.Term.Common
( notBlank,
)
where
import Byline
import qualified Data.Text as Text
notBlank :: Stylized Text -> Text -> Either (Stylized Text) Text
notBlank :: Stylized Text -> Text -> Either (Stylized Text) Text
notBlank Stylized Text
errortxt Text
input =
let clean :: Text
clean = Text -> Text
Text.strip Text
input
in if Text -> Bool
Text.null Text
clean
then Stylized Text -> Either (Stylized Text) Text
forall a b. a -> Either a b
Left Stylized Text
errortxt
else Text -> Either (Stylized Text) Text
forall a b. b -> Either a b
Right Text
clean