Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vic/pipe_here
An Elixir macro for easily piping arguments at any position.
https://github.com/vic/pipe_here
elixir macros pipe
Last synced: 3 months ago
JSON representation
An Elixir macro for easily piping arguments at any position.
- Host: GitHub
- URL: https://github.com/vic/pipe_here
- Owner: vic
- Created: 2016-01-21T16:37:46.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-20T22:54:47.000Z (almost 8 years ago)
- Last Synced: 2024-10-11T22:23:51.867Z (3 months ago)
- Topics: elixir, macros, pipe
- Language: Elixir
- Homepage: http://hex.pm/packages/pipe_here
- Size: 10.7 KB
- Stars: 34
- Watchers: 7
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - Easily pipe values into any argument position. (Macros)
- fucking-awesome-elixir - pipe_here - Easily pipe values into any argument position. (Macros)
- awesome-elixir - pipe_here - Easily pipe values into any argument position. (Macros)
README
# PipeHere
[![help maintain this lib](https://img.shields.io/badge/looking%20for%20maintainer-DM%20%40vborja-663399.svg)](https://twitter.com/vborja)An Elixir macro for easily piping arguments at any position.
## Usage
```elixir
import PipeHere
```The `pipe_here` macro lets you specify the argument position
while piping values by using the `_` placeholder.For example:
```elixir
pipe_here( 2 |> x(1, _, 3) )# expands to
x(1, 2, 3)
```The `pipe_here` macro can also be used at the end of a pipe:
```elixir
2 |> x(1, _, 3) |> pipe_here
```Note that while you can do stuff like:
```elixir
a |> b(1, _) |> c |> d.(2, _, 3) |> pipe_here
```every member of the pipe can at most have just one `_` placeholder.
## Installation
[Available in Hex](https://hex.pm/packages/pipe_here), the package can be installed as:
1. Add pipe_here to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:pipe_here, "~> 1.0.0"}]
end
```## Is it any good?
[Yes](https://news.ycombinator.com/item?id=3067434)
##### マクロス Makurosu
[[Elixir macros](https://github.com/h4cc/awesome-elixir#macros),] The things I do for beautiful code
― George Martin, Game of Thrones[#myelixirstatus](https://twitter.com/hashtag/myelixirstatus?src=hash)
[#FridayLiterally](http://futurice.com/blog/friday-literally)