|
|
|
|
|
by nticompass
260 days ago
|
|
I was playing with it, and you can do this, which looks a little better. const greeting = pipe('hello');
greeting | upper | ex('!!!');
await greeting.run(); // → "HELLO!!!"
Since it uses the "Symbol.toPrimitive" method, you can use any operator (not just "bitwise OR" (|)). const greeting = pipe('hello');
greeting / upper * ex('!!!');
await greeting.run(); // → "HELLO!!!"
|
|
Mutating your inputs is not functional programming. And pipes are effectively compact list comprehensions. Comprehensions without FP is Frankensteinian.