0.2.5 • Published 3 years ago

@harbr/functional v0.2.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Functional · Build Status

Contains methods for functional JavaScript patterns.

Installation

npm install @harbr/functional

Usage

Pipe and compose methods combine functions; calling each function with the output of the last one.

The primary difference is that a pipe is from left-to-right (top-to-bottom), where as compose is right-to-left (bottom-to-top).

pipe

const returnValue = pipe(
    (x) => x + 2,
    (x) => x * 3
)(1);
// returnValue = 9

compose

const returnValue = compose(
    (x) => x + 2,
    (x) => x * 3
)(1);
// returnValue = 5

Async Versions

pipeAsync and composeAsync can be used if any one of the methods in the chain is async or returns a promise.

0.2.5

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.0

3 years ago