defmodule ZoeyscomputerWeb.GistLive.Languages do
  @languages [
    %{name: "JavaScript", val: "javascript"},
    %{name: "TypeScript", val: "typescript"},
    %{name: "Rust", val: "rust"},
    %{name: "Elixir", val: "elixir"}
  ]

  def search_languages(name) do
    @languages
    |> Enum.filter(fn language ->
      String.contains?(String.downcase(language.name), String.downcase(name))
    end)
  end
end
