Demo: mapTo
mapTo is a shorthand for map which we can use when the transformation logic is independent of the incoming values. For example:
- mapping to a constant value or
- mapping with a function independent of the incoming values.
mapTo(() => functionIndependentOfIncomingItem);
let input=timer(500,1500).pipe(take(4));
//Transform the value independent of the incoming values
//and emit into the resulting stream
let process=map(100);
let output=input.pipe(process).subscribe(v=>console.log(v));