Working pipe operator today in pure JavaScript
1–10 of 109 posts
Re: Working pipe operator today in pure JavaScript
#2Since this library leverages Symbol.toPrimitive, you may also use operators besides bitwise-OR. Additionally, the library does not seem to dispatch on the `hint` parameter[0]. Now I want to open a JS REPL, try placing this library's pipe object into string template literals, and see what happens.
Overall, cool library.
[0] https://tc39.es/ecma262/multipage/abstract-operations.html#s...
Re: Working pipe operator today in pure JavaScript
#3Very appealing.
Re: Working pipe operator today in pure JavaScript
#4[dead]
Re: Working pipe operator today in pure JavaScript
#5Cool work!
Re: Working pipe operator today in pure JavaScript
#6this is sick
Re: Working pipe operator today in pure JavaScript
#7Sad that the pipe operator proposal seems to have stalled.
The F# version of the proposal was probably the simplest choice.
Re: Working pipe operator today in pure JavaScript
#8Further proof that JavaScript accidentally became the new C++.
“Aren’t you surprised that this syntax works?” is not praise for a language design.
Re: Working pipe operator today in pure JavaScript
#9Nice! I love it when a language introduces new syntax for things that weren't remotely difficult in the first place!
Re: Working pipe operator today in pure JavaScript
#10First example doesn't work though:
const greeting = pipe('hello')
| upper
| ex('!!!')
await greeting.run() // → "HELLO!!!"
If you look at the tests file, it needs to be written like this to make it work: let greeting;
(greeting = pipe('hello')) | upper | ex('!!!');
await greeting.run();
Which is not anymore as ergonomic.