Created
January 19, 2023 14:47
-
-
Save jorgevilaca82/abc9118180db5a1fd83e0387dab747c1 to your computer and use it in GitHub Desktop.
check for blank values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Utils do | |
def is_blank(nil), do: true | |
def is_blank(val) when val == %{}, do: true | |
def is_blank(val) when val == [], do: true | |
def is_blank(val) when is_binary(val), do: String.trim(val) == "" | |
def is_blank(val), do: false | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment