Skip to content

Instantly share code, notes, and snippets.

@ktravers
Created July 12, 2018 03:01
Show Gist options
  • Save ktravers/ad325b32fb46e8d45d504aafe905116f to your computer and use it in GitHub Desktop.
Save ktravers/ad325b32fb46e8d45d504aafe905116f to your computer and use it in GitHub Desktop.
defmodule Account do
def display_name(%{first: first, last: last}) do
String.trim("#{first} #{last}")
end
def display_name(%{username: username}), do: "#{username}"
def display_name(_), do: "New User"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment