Extend Object prototype with pipe function.
Installation
yarn add object-pipe
or
npm install object-pipe
Usage
Nothing else needed, this will mutate the Object prototype.
By default the pipe function is named do
and it's used like this in the examples below.
But you can setup another name for it
'pipe'// the pipe function will be 'pipe'
Examples
Double
{ return this + this // 'this' is referring to the object calling the pipe function} console // 10 console // "HeyHey" console // "1,2,31,2,3"
Reduce on string
const reduce = Arrayprototypereduceconst sumFunction = accumulator + let sum = '13544862' console // 33 sum = sum console // 6