top | item 45520812

(no title)

mlajtos | 4 months 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('!!!'))

discuss

order

No comments yet.