Hacker News new | ask | show | jobs
by mlajtos 259 days ago
Pipe "operator" for the rest of us:

    Object.prototype.pipe = function(fn) { return fn(this) }

    'hello'.pipe(upper).pipe(ex('!!!'))
Or code golf version:

    Object.prototype.P=function(...F){return F.reduce((v,f)=>f(v),this)}
    'hello'.P(upper,ex('!!!'))