|
|
|
|
|
by TheHeasman
294 days ago
|
|
Uh, there are arrow operators in JS. D3.JS in Action Third Edition exclusively uses arrow operators. (Trust me. I don't know jack about JavaScript, I had to get through the MDN docs to understand what they were, and once I did, made a whole lot more sense). |
|
JS does not have a straightforward equivalent. The old and deprecated `with` keyword might seem similar but it's only a surface resemblance as it does not perform the return-value threading that makes the above pattern useful, it was meant for methods that mutate object state. There's a TC39 proposal[2] to add a pipe operator that would accomplish a similar thing to threading macros via an infix operator but it's still a draft.
[1]: https://clojure.org/guides/threading_macros
[2]: https://github.com/tc39/proposal-pipeline-operator