Skip to content

Elixir utility to safely convert string an atom in set

Notifications You must be signed in to change notification settings

JohnJocoo/to_atom_in

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ToAtomIn

Small utility to safely convert strings to a limited set of atoms.

require TAI

TAI.to_atom_in("world", [:hello, :world])
:world
import TAI

to_atom_in("world", ~w(hello world)a)
:world
import TAI

to_atom_in("three", ~w(one two)a)
# ** (ArgumentError) The atom three is not in the [:one, :two]

Installation

The package can be installed by adding to_atom_in to your list of dependencies in mix.exs:

def deps do
  [
    {:to_atom_in, "~> 0.1.0"}
  ]
end

The docs can be found at https://hexdocs.pm/to_atom_in.

About

Elixir utility to safely convert string an atom in set

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages