@bakkerjoeri/fp

npm install @bakkerjoeri/fp

Usage no npm install needed!

<script type="module">
  import bakkerjoeriFp from 'https://cdn.skypack.dev/@bakkerjoeri/fp';
</script>

README

fp

Installation

npm install @bakkerjoeri/fp

Usage

compose

Returns a composed function:

import { compose } from '@bakkerjoeri/fp';

const timesTwo = (a: number) => {
    return a * 2;
};

const plusTwo = (a: number) => {
    return a + 2;
};

const result = compose(timesTwo, plusTwo)(2) // => 8

pipe

Returns a piped function:

import { pipe } from '@bakkerjoeri/fp';

const timesTwo = (a: number) => {
    return a * 2;
};

const plusTwo = (a: number) => {
    return a + 2;
};

const result = pipe(timesTwo, plusTwo)(2) // => 6