News for hackers. Stuff that matters.
Re:Pipe Operator (|>) For JavaScript by tgv on Friday January 20, 2023 @11:20AM (#34455282)
So their argument in favor of this fugly new operator is that some people write unreadable code? That's not the language's fault. As they say, you can write FORTRAN in any language. This just gives them a new tool to make things even worse.

     chalk.dim(Object.keys(envars)
       .map(envar => `${envar}=${envars[envar]}`)
       .join(' ')
       |> `$ ${%}`, 'node', args.join(' '))
     |> console.log(%);
And it doesn't even work on objects. Lame. I know the reason: JS has no typing. Still is lame.
Re:Pipe Operator (|>) For JavaScript by 8note on Friday January 20, 2023 @03:43PM (#34459638)
I'm trying to compare this to the jQuery kinda syntax

X

.this()

.that()

.then()

.do()

.a()

.thing()

And I expect this to let me keep that chain going for when I need to run a static function against the chain

X

.this()

.that()

.then()

.do()

.a()

.thing()

|>JSON.stringify(%)

Re:Pipe Operator (|>) For JavaScript by mkl on Friday January 20, 2023 @05:35PM (#34461055)
To format code as code, indent two spaces: https://news.ycombinator.com/formatdoc