# @bitty/pipe

> A pipe function to perform function composition in LTR (Left To Right) direction.

Latest version **0.4.0** (published 2025-07-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @bitty/pipe
pnpm add @bitty/pipe
yarn add @bitty/pipe
bun add @bitty/pipe
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2025-07-07 |
| First published | 2020-04-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 22.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 30 |
| Author | Vitor Luiz Cavalcanti |
| Maintainers | vitorluizc, bitty |
| Keywords | pipe, compose, composition, flow, pipeline, fp, functional programming, chain, function, functional, serial |

## Links

- npm: https://www.npmjs.com/package/@bitty/pipe
- Repository: https://github.com/VitorLuizC/bitty
- Homepage: https://github.com/VitorLuizC/bitty/tree/master/packages/pipe
- Issues: https://github.com/VitorLuizC/bitty/issues
- npm.io page: https://npm.io/package/@bitty/pipe

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 0.4.0 (latest) — 2025-07-07
- 0.0.5 (pnpm-temp) — 2020-08-10
- 0.3.0 — 2022-01-09
- 0.2.2 — 2021-11-18
- 0.2.1 — 2021-01-24
- 0.1.0 — 2020-11-03
- 0.0.7 — 2020-10-20
- 0.0.6 — 2020-09-06
- 0.0.4 — 2020-04-14
- 0.0.3 — 2020-04-12
- 0.0.2 — 2020-04-12
- 0.0.1 — 2020-04-12
- 0.0.0 — 2020-04-12

## README

# `@bitty/pipe`

[![Bundle minified size](https://badgen.net/bundlephobia/min/@bitty/pipe)](https://bundlephobia.com/result?p=@bitty/pipe)
[![Bundle minified and gzipped size](https://badgen.net/bundlephobia/minzip/@bitty/pipe)](https://bundlephobia.com/result?p=@bitty/pipe)

A pipe function to perform function composition in LTR (Left-To-Right) direction.

- 📦 Distributions in ESM, CommonJS, UMD and UMD _minified_ formats.

- ⚡ Lightweight:
  - Weighs less than 0.3KB (min + gzip).
  - 3x smaller than `ramda.pipe`.
  - Tree-shakeable.
  - Side-effects free.

- 🔋 Bateries included:
  - No dependencies.
  - Its not based on newer browser's APIs or es2015+ features.

- 🏷 Safe:
  - JSDocs and type declarations for IDEs and editor's autocomplete/intellisense.
  - Made with TypeScript as strict as possible.
  - Unit tests with AVA.

## Installation

This library is published in the NPM registry and can be installed using any compatible package manager.

```sh
npm install @bitty/pipe --save

# For Yarn, use the command below.
yarn add @bitty/pipe
```

### Installation from CDN

This module has a UMD bundle available through JSDelivr and Unpkg CDNs.

```html
<!-- For UNPKG use the code below. -->
<script src="https://unpkg.com/@bitty/pipe"></script>

<!-- For JSDelivr use the code below. -->
<script src="https://cdn.jsdelivr.net/npm/@bitty/pipe"></script>

<script>
  // UMD module is exposed through the "pipe" global function.
  console.log(pipe);
  //=> "[Function: pipe]"
</script>
```

## Getting Started

Import `pipe` from package and just compose your functions with it.

```ts
import pipe from '@bitty/pipe';

const resolveToNumber = pipe(
  (value: unknown) => typeof value === 'number' ? value : parseFloat(value),
  (value: number) => Number.isNaN(value) ? 0 : value,
);

resolveToNumber('12389');
//=> 12389
```

The first pipe argument is an arity N function, so you can receive more than one argument in the composition.

```ts
import pipe from '@bitty/pipe';

const fromTextToWords = (text: string, wordsToIgnore: string[] = []) =>
  text
    .trim()
    .split(/\s+/)
    .filter((word) => !wordsToIgnore.includes(word));

const formatToInitials = pipe(
  fromTextToWords,
  (words) => words.map((word) => word.charAt(0)),
  (initials) => initials.join('').toUpperCase(),
);

formatToInitials('abraão  william de santana ', ['de']);
//=> "AWS"
```

## License

Released under [MIT License](./LICENSE).

---
_Source: https://npm.io/package/@bitty/pipe · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
