1.1.0 • Published 6 years ago

popipe v1.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

popipe

Build Status Coverage Status Maintainability

Small method that behaves like the pipe operator of functional languages.

how to install

$ npm install --save popipe

how to use it

The pipe method takes a variable number of arguments and apply them as transformations to the first argument in a clean way, instead of method calls fall.

import pipe from "popipe"
// or var pipe = require("pipe")

// transformation methods
const doubler = x => x * 2
const incrementer = x => x + 1

const answerOfLife = pipe(5, doubler, doubler, incrementer, doubler)
// 42

If you want to apply additional arguments to transformation methods, use the currying technique having a function that accepts a single parameter as your final result.

const multiplier = y => x => x * y

const answerOfLife = pipe(5, doubler, multiplier(2), incrementer, doubler)
// 42
1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.1

6 years ago