Tech News
← Back to articles

Working pipe operator today in pure JavaScript

read original related products more articles

asPipes: working pipelines today in pure JavaScript

1 Summary

asPipes is an experimental runtime abstraction that models the semantics of the proposed |> pipeline operator, implemented entirely in standard JavaScript (ES2020+). It demonstrates that pipeline-style composition can be expressed using the existing coercion semantics of the bitwise OR operator (|) and Symbol.toPrimitive.

The implementation is small (<50 lines) and supports both synchronous and asynchronous evaluation with a familiar syntax:

const greeting = pipe ( 'hello' ) | upper | ex ( '!!!' ) await greeting . run ( ) // → "HELLO!!!"

2 Motivation

The pipeline operator proposal (tc39/proposal-pipeline-operator) has been under discussion for several years, exploring multiple variants (F#, Smart, Hack, etc.). The asPipes experiment aims to:

prototype F#-style semantics directly in today’s JavaScript;

study ergonomics and readability in real-world code;

... continue reading