RxJS with pipeline |> operator proposal

 

EXPERIMENTAL

Pipeline operator |> is a new proposal to ECMAScript that simplifies "piping" a value through several functions.
And it nicely fits into RxJS' pipe flow:

// proposal-pipeline-operator
const { rxObserver } = require('api/v0.3');
const { timer } = require('rxjs');
const { take, map } = require('rxjs/operators');

const msg = 'awesome';

timer(0, 5)
  |> take(msg.length)
  |> map(index=>msg[index])
  |> subscribe(rxObserver())
  ;

function subscribe(observer){
  return stream$ => stream$.subscribe(observer);
}

NOTE: the code should start with // proposal-pipeline-operator comment to properly parse the pipeline operator in this playground

See TC-39 pipeline operator proposal for more details