Skip to content

csvenke/pipe

Repository files navigation

@csvenke/pipe

Pipe implementation with (almost) variadic kinds

npm package min bundle size master workflow semantic release

InstallUsageDevelopmentCreditsLicense

Install

Using npm

npm install --save @csvenke/pipe

Using yarn

yarn add @csvenke/pipe

Usage

With javascript

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

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 amazing stack overflow answer!

License

MIT