pipeoperator
0.1.1 • Public • Published pipeoperator
A library that creates pipelines in JavaScript. It works exactly like the pipe operator from Elixir or Bash.
Installation
npm install pipeoperator
import { pipeline } from 'pipeoperator';
Usage
const pipedValue = pipeline(value)
.pipe(doSomething)
.pipe(doSomethingElse)
.pipe(doAnotherThing)
.pipe(value => value.map(v => v.property))
.result();
function doSomething(arg) { }
function doSomethingElse(arg) { }
function doAnotherThing(arg) { }
pipe()
also takes additional arguments that are passed into the called function:
const total = pipeline(1)
.pipe(sum, 3, 2)
.pipe(sum, 4)
.result();
function sum(...args) {
return args.reduce((total, number) => {
return total + number;
}, 0);
}
Versions
Current Tags
- VersionDownloads (Last 7 Days)
- 0.1.1
0
Version History
Package Sidebar
Install
Weekly Downloads