Skip to content

ankhers/argument_names

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Argument Names

An easy to use and pipe friendly way to have named arguments

Examples

Suppose we have the following module

defmodule Foo do
  require ArgumentNames
  import ArgumentNames
  
  defnamed div(first, second) do
    first / second
  end
end

We can then start using the first and second names within our function calls.

require Foo
Foo.div(second ~> 4, 2) => 0.5

We can also use this with pipes in order to change around our argument order

4 |> Foo.div(first ~> 2) => 0.5
2 |> Foo.div(second ~> 4) => 0.5

We can also use this function with pipes without having to name the arguments

2 |> Foo.div(4) => 0.5

Roadmap

These are just a couple things I would like to see added to this package in no particular order

  • Default arguments

Installation

If available in Hex, the package can be installed by adding argument_names to your list of dependencies in mix.exs:

def deps do
  [
    {:argument_names, "~> 0.2.0"}
  ]
end

About

An easy to use and pipe friendly way to have named arugments

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages