# ts-compose

> Performs right-to-left function composition.

Latest version **1.0.0** (published 2021-02-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install ts-compose
pnpm add ts-compose
yarn add ts-compose
bun add ts-compose
```

## Health

**Score 30/100 (F)** — status: abandoned.

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-02-28 |
| First published | 2021-02-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Viktor Pasynok |
| Maintainers | binjospookie |
| Keywords | compose, typescript compose, functional programming, functional, pipe, reverse pipe |

## Links

- npm: https://www.npmjs.com/package/ts-compose
- Repository: https://github.com/binjospookie/ts-compose
- Homepage: https://github.com/binjospookie/ts-compose#readme
- Issues: https://github.com/binjospookie/ts-compose/issues
- npm.io page: https://npm.io/package/ts-compose

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2021-02-28
- 0.0.1 — 2021-02-28

## README

# ts-compose

```
((y → z), (x → y), …, (o → p), ((a, b, …, n) → o)) → ((a, b, …, n) → z)
```

Performs right-to-left function composition.

```typescript
import { compose } from 'ts-compose';

const addOne = (x: number) => x + 1;
const double = (x: number) => x * 2;

compose(Math.abs, addOne, double)(-4) //=> 7

const toUpper = (x: string) => x.toUpperCase();
const classyGreeting = (firstName: string, lastName: string) => "The name's " + lastName + ", " + firstName + " " + lastName
const yellGreeting = compose(toUpper, classyGreeting);
yellGreeting('James', 'Bond'); //=> "THE NAME'S BOND, JAMES BOND"
```

[Try it]()

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