1.1.0 • Published 12 months ago

@slicr97/pipe v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

Pipe

Description

Small library providing a pipe function to compose functions from left to right.

Installation

Using npm:

npm install @slicr97/pipe

Using yarn:

yarn add @slicr97/pipe

Usage

To give you an example of how this library works, look at the following code snippet:

import { pipe } from '@slicr97/pipe'

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

const addOneAndMultiplyByTwo = pipe(addOne, multiplyByTwo)

const result = addOneAndMultiplyByTwo(2) // 6

Globalizing

If you want to globalize the pipe function, you can do so by adding the following line to your code at the top of your entrypoint:

import '@slicr97/pipe/globalize'
1.1.0

12 months ago

1.0.0

12 months ago