Live data from Hacker News

The JavaScript Pipeline Operator

yanis.blog

1–10 of 63 posts

Re: The JavaScript Pipeline Operator

#6
post #3

rxjs is already available and allows to perform chained transformations by using wide variety of methods.

Good point. I've heard about it but never could quite understand if it's useful enough. Can you share some public repos where it's being used?

the official web-site is pretty informative and has a ton of samples..https://rxjs-dev.firebaseapp.com/api - take a look at operators section for example. as for public repos - nowadays any modern front-end app that is built with Angular is using rxjs - it's de factor standard for data processing in angular world.

Re: The JavaScript Pipeline Operator

#8
>The difference is in how we read it. With pipeline operator data flows from left to the right, and thus making it much more comprehensible without the need to introduce extra variables.

Why you need operator? Can't it be done with a function?

    pipe(64,Math.sqrt)

Re: The JavaScript Pipeline Operator

#9
Been using this in LiveScript for awhile (ls also provides it in the opposite direction <| ). Very useful for chaining functions in a logical order and without unnecessary () nesting. Absolutely needs to be paired with partial application though for multiple argument functions.

Re: The JavaScript Pipeline Operator

#10
post #8

>The difference is in how we read it. With pipeline operator data flows from left to the right, and thus making it much more comprehensible without the need to introduce extra variables. Why you need operator? Can't it be done with a function? pipe(64,Math.sqrt)

Your example falls apart when making multiple function calls.
Post reply on HN