News for hackers. Stuff that matters.
Re:Pipe Operator (|>) For JavaScript by progx on Friday January 20, 2023 @11:03AM (#34454926)
For me not. In the Pipe example you must read first that something is done with the object and that it will be output at the end.

If i read a code and i want to now what it will do, i wanna first read that it will output something. If that is what i search for, i read the nested code.

With the pipe style i waste more time, even if the code looks clearer.

I not overused example could look like this:

  console.log(
    Object.keys(envars)
      .map(envar => `${envar}=${envars[envar]}`)
      .join(' ')
    |> `$ ${%}`
    |> chalk.dim(%, 'node', args.join(' '))
  )
If i don't care about console.log, i don't have to read the nested code.

There are no comments on this comment yet.