pied

1.2.1 • Public • Published

Why is it Awesome?

Install

npm install pied --save

Usage

import pipe from 'pied';
 
// -- Working with primitives
 
let double = x => x + x;
let square = x => x * x;
 
let val = pipe(5).to(double).to(square);
 
console.log( Number(val) ); // 100
 
// -- Working with non primitives
 
let dubs = x => x.concat(x);
 
let piped = pipe([1, 2]).to(dubs);
 
console.log( piped.length ); // 4

No Kicker

pipe(5).to(double) * 2; // 20

Accessing Values Between Pipes

let piped = pipe([1, 2]).to(dubs);
 
// accessing the array directly
piped.push(3);
 
console.log( piped.length ); // 5
 
// piping again
piped.to(dubs);
 
console.log( piped.length ); // 10

Note: This feature requires Proxy. If you do not have access to Proxy you can use pipe([1, 2]).to(dubs).valueOf() to access the inner array directly.

Readme

Keywords

none

Package Sidebar

Install

npm i pied

Weekly Downloads

0

Version

1.2.1

License

ISC

Last publish

Collaborators

  • jisaacks