https://github.com/am-kantox/tubo
Tiny module providing a wrapper functionality for functions to easy chain those into pipelines.
https://github.com/am-kantox/tubo
elixir elixir-lang pipe pipeline
Last synced: 23 days ago
JSON representation
Tiny module providing a wrapper functionality for functions to easy chain those into pipelines.
- Host: GitHub
- URL: https://github.com/am-kantox/tubo
- Owner: am-kantox
- Created: 2017-04-04T13:05:17.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-04T13:14:52.000Z (about 8 years ago)
- Last Synced: 2025-03-09T21:46:45.021Z (about 2 months ago)
- Topics: elixir, elixir-lang, pipe, pipeline
- Language: Elixir
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Tubo
[](https://travis-ci.org/am-kantox/tubo)
**`Tubo`** is a tiny module providing a wrapper functionality for functions
to easy chain those into pipelines.## Examples
```elixir
iex> "Hello, world!"
...> |> Tubo.pipe(&Regex.replace/3, [~r/l|o/, "★"])
"He★★★, w★r★d!"
```In the example above, `Regex.replace/3` expects the first param to be a regular
expression and that’s why plain piping won’t work.```elixir
iex> "Hello, world!"
...> |> Tubo.spawn(&IO.puts(&1), [])
"Hello, world!"
```Here we spawn a logger, printing out the piped value, while continuing with the
pipeline. More or less similar behaviour might be achieved with `IO.inspect`,
but `Tubo.spawn/4` spawns the execution (it might be handy for e. g. sending
emails,) and `Tubo.bypass/4` is controlled by the settings and might be compiled
to nothing in production. By default the stub is produced for it.## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `tubo` to your list of dependencies in `mix.exs`:```elixir
def deps do
[{:tubo, "~> 0.1.0"}]
end
```Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at [https://hexdocs.pm/tubo](https://hexdocs.pm/tubo).