Packages

Playwright is an Elixir library to automate Chromium, Firefox and WebKit browsers with a single API. Playwright delivers automation that is ever-green, capable, reliable and fast.

Current section

Files

Jump to
playwrightais lib playwright extra atom.ex
Raw

lib/playwright/extra/atom.ex

defmodule Playwright.Extra.Atom do
@moduledoc false
def from_string(nil), do: raise(ArgumentError, message: "Unable to convert nil into an atom")
def from_string(s) when is_binary(s), do: String.to_atom(s)
def from_string(a) when is_atom(a), do: a
def to_string(nil), do: raise(ArgumentError, message: "Unable to convert nil into a string")
def to_string(a) when is_atom(a), do: Atom.to_string(a)
def to_string(s) when is_binary(s), do: s
def snakecased(s) when is_binary(s), do: Recase.to_snake(s) |> from_string()
end