News for hackers. Stuff that matters.
Re:Pipe Operator (|>) For JavaScript by WastingMyTime89 on Friday January 20, 2023 @10:59AM (#34454846)
On the one hand, I tend to agree and I dislike making JS syntax even more complex than it already is.

On the other hand, it works well in F# (and the ML that then borrowed it from F#) because it’s just a standard infix operator there and everything is already curried which is definitely not the case with JS. It means you will nearly always have to use a lambda when piping in JS which is honestly a bit tedious.

Re:Pipe Operator (|>) For JavaScript by substation13 on Friday January 20, 2023 @11:03AM (#34454943)
You do for member access, e.g.

    let firstName = 
      person
      |> fun x -> x.FirstName
      |> trim
Some languages allow:

    let firstName = 
      person
      |> .FirstName
      |> trim
But you're right, expression-orientation and currying make this much more natural.