I can see this being useful but boy does it look ugly
Show HN: A JavaScript function that looks and behaves like a pipe operator
31–40 of 148 posts
Re: Show HN: A JavaScript function that looks and behaves like a pipe operator
#32The following example code is a bit hard to read: const { status } = await send(capitalize(greeting) + "!") console.log(status) I disagree, I find this example code very easy to read because it reads like idiomatic Javascript. Unlike this library.
const msg = capitalize(greeting) + “!”;
const { status } = await send(msg);
console.log(status);
Now it’s perfectly readable, no weird shenanigans required.Re: Show HN: A JavaScript function that looks and behaves like a pipe operator
#33The following example code is a bit hard to read: const { status } = await send(capitalize(greeting) + "!") console.log(status) I disagree, I find this example code very easy to read because it reads like idiomatic Javascript. Unlike this library.
Right - because this library tries to fake a new language syntax feature without the actual support for it, it ends up being the worst of both worlds. Even ignoring the lines-of-code explosion, the non-standard use of parens/spacing makes it incredible difficult for me to parse. Props to the author for trying out something neat, but this is probably a bit to clever for my liking.
Same here. Not to mention this wouldn't work in a codebase with an autoformatter.The idea/API is clever. So, a pretty cool experiment I suppose
Re: Show HN: A JavaScript function that looks and behaves like a pipe operator
#34The following example code is a bit hard to read: const { status } = await send(capitalize(greeting) + "!") console.log(status) I disagree, I find this example code very easy to read because it reads like idiomatic Javascript. Unlike this library.
I agree with the author that it’s a little confusing, but that’s why I wouldn’t write code like that. const msg = capitalize(greeting) + “!”; const { status } = await send(msg); console.log(status); Now it’s perfectly readable, no weird shenanigans required.
Re: Show HN: A JavaScript function that looks and behaves like a pipe operator
#35The following example code is a bit hard to read: const { status } = await send(capitalize(greeting) + "!") console.log(status) I disagree, I find this example code very easy to read because it reads like idiomatic Javascript. Unlike this library.
If you read all the text, it seems like the entire repo is intended to be a satire on https://github.com/tc39/proposal-pipeline-operator .
I love JavaScript but this pipe thing is horrific.
Re: Show HN: A JavaScript function that looks and behaves like a pipe operator
#36Re: Show HN: A JavaScript function that looks and behaves like a pipe operator
#37Re: Show HN: A JavaScript function that looks and behaves like a pipe operator
#38Earlier quoted context omitted.
I agree with the author that it’s a little confusing, but that’s why I wouldn’t write code like that. const msg = capitalize(greeting) + “!”; const { status } = await send(msg); console.log(status); Now it’s perfectly readable, no weird shenanigans required.
But at what cost? You had to name two intermediate variables - and naming things is hard.
Re: Show HN: A JavaScript function that looks and behaves like a pipe operator
#39Earlier quoted context omitted.
I agree with the author that it’s a little confusing, but that’s why I wouldn’t write code like that. const msg = capitalize(greeting) + “!”; const { status } = await send(msg); console.log(status); Now it’s perfectly readable, no weird shenanigans required.
But at what cost? You had to name two intermediate variables - and naming things is hard.
Re: Show HN: A JavaScript function that looks and behaves like a pipe operator
#40Earlier quoted context omitted.
I agree with the author that it’s a little confusing, but that’s why I wouldn’t write code like that. const msg = capitalize(greeting) + “!”; const { status } = await send(msg); console.log(status); Now it’s perfectly readable, no weird shenanigans required.
But at what cost? You had to name two intermediate variables - and naming things is hard.
You don't have to write something like "this is the message", you can see it.