Comment

Comment by nticompass

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!!!"
parent nticompass 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton