Packages

A collection of helpers to operate on nested maps. See README for the complete list of helpers. The test suite is also helpful.

Current section

Files

Jump to
digger lib impl snake_caser string.ex
Raw

lib/impl/snake_caser/string.ex

defimpl Digger.SnakeCaser.Protocol, for: BitString do
def underscore(string) do
string
|> String.replace(~r/([A-Z\d]+)([A-Z][a-z])/, "\\1_\\2")
|> String.replace(~r/([a-z\d])([A-Z])/, "\\1_\\2")
|> String.replace(~r/-/, "_")
|> String.downcase
end
end