Metadata-Version: 2.5
Name: iifunc
Version: 0.0.2
Summary: Compose functions into a pipeline, right to left or left to right.
Project-URL: Homepage, https://github.com/lqxnjk/iifunc
Author: lqxnjk
License: MIT
License-File: LICENSE
Keywords: compose,functional,higher-order,pipe,pipeline
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# iifunc

Build a pipeline out of plain functions, without a class or a framework.

## Install

```console
pip install iifunc
```

## Usage

```python
from iifunc import compose, pipe

def double(x): return x * 2
def bump(x): return x + 1

pipe(double, bump)(3)      # bump(double(3)) == 7
compose(double, bump)(3)   # double(bump(3)) == 8

clean = pipe(str.strip, str.lower)
clean("  ABC  ")           # 'abc'

identity = pipe()          # no functions -> identity
identity(5)                # 5
```

## Direction

| Helper | Reading order | `f, g` applied to `x` |
| --- | --- | --- |
| `pipe` | left to right | `g(f(x))` |
| `compose` | right to left | `f(g(x))` |

Both only receive extra positional or keyword arguments on the **first**
function called. Later stages take exactly one value, which is what keeps a
pipeline readable.

## License

MIT
