The "Pipeline" Operator - Making multiple function calls look great

Coroutines coroutines at
Mon Dec 14 08:55:33 UTC 2015

On Sun, Dec 13, 2015 at 10:32 PM, Kevin Smith <zenparsing at> wrote:

> (someArray
>   .filter(...)
>   .map(...)
>   |> someOtherArrayOp
>   ).forEach(...)
> Note the extra parens before the "forEach" invocation.

For the record I think a pipe operator is silly - I wish | were
available because that is the only operator I will ever think of as a

That said, if you want to get silly - you could have a pipe operator
which uses the current `this`, and one that compiles to use
.call(lhs_argument, ...).

<> (uses the left-hand-side value as `this` for the next function)
|> (simply passes the left-hand-side value to the right preserving this)

Yes.  I"m using the spaceship operator for this because why not, I
already think this is silly.

[ 'a', 'b', 'c' ] <> filter(...) <> map(...) |> someOtherNonArrayFunc
<> forEach(...)

More information about the es-discuss mailing list