An open API service indexing awesome lists of open source software.

https://github.com/csvenke/pipe

Pipe implementation with (almost) variadic kinds
https://github.com/csvenke/pipe

composition javascript library npm-package pipe typescript

Last synced: 5 months ago
JSON representation

Pipe implementation with (almost) variadic kinds

Awesome Lists containing this project

README

        

@csvenke/pipe


Pipe implementation with (almost) variadic kinds




npm package


min bundle size


master workflow


semantic release


Install
Usage
Development
Credits
License

## Install

Using npm

```
npm install --save @csvenke/pipe
```

Using yarn

```
yarn add @csvenke/pipe
```

## Usage

With javascript

```js
import pipe from "@csvenke/pipe";

const getName = data => data.name;

const toUpperCase = str => str.toUpperCase();

const reverse = str => str.split("").reverse().join("");

const piped = pipe(getName, toUpperCase, reverse);

console.log(piped({ name: "John" })); // NHOJ
```

With typescript

```ts
import pipe from "@csvenke/pipe";

interface Data {
name: string;
}

const getName = (data: Data) => data.name;

const toUpperCase = (str: string) => str.toUpperCase();

const reverse = (str: string) => str.split("").reverse().join("");

const piped = pipe(getName, toUpperCase, reverse);

console.log(piped({ name: "John" })); // NHOJ
```

## Development

Installing dependencies

```
yarn install
```

Running tests

```
yarn test
```

## Credits

- This wouldn't have been possible without [jcalz](https://stackoverflow.com/questions/53173203/typescript-recursive-function-composition) amazing stack overflow answer!

## License

MIT