Skip to content

Elixir macros to easily manipulate map/list state

Notifications You must be signed in to change notification settings

mlankenau/stati

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stati

Stati is a set of macros to do simple state manipulation, where state is a mixture of encapsulated maps and arrays.

Lets assume there is a variable state with the value

  state = %{ user: %{name: "foo", password: "bar"}, something: %{else: "bar"} }

and you want to change the password to "BAR" then you would normally do

  ${state | user: %{ state.user | password: "BAR" }}

which is kind of ugly and becomes even worse if you have more levels. With Stati it is done by

  Stati.change(state.user.password = "BAR")

Installation

If available in Hex, the package can be installed as:

  1. Add stati to your list of dependencies in mix.exs:

    def deps do [{:stati, "~> 0.0.1"}] end

  2. Ensure stati is started before your application:

    def application do [applications: [:stati]] end

About

Elixir macros to easily manipulate map/list state

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages