console . log ( `pipe_map.ts` ) ; import { of , Observable , interval } from "rxjs" ; import { map , take } from "rxjs/operators" ; const emitter = of ( 1 , 2 , 3 , 4 ) ; const modulus = emitter . pipe ( map ( ( value ) => { console . log ( `received : ${ value }` ) ; return value % 2 ; } ) ) ; modulus . subscribe ( ( value ) => { console . log ( `modulus : ${ value }` ) ; } ) ; const stringMap = emitter . pipe ( map ( ( value ) => { return value * 2 ; } ) , map ( ( value ) => { return `str_${ value }` ; } ) ) ; stringMap . subscribe ( ( value ) => { console . log ( `stringMap emitted : ${ value }` ) ; } ) ; const emitOneTwo = of ( 1 , 2 ) ; const swallowedValues = emitOneTwo . pipe ( map ( ( value ) => { if ( value < 2 ) { return null ; } return value ; } ) ) ; swallowedValues . subscribe ( ( value ) => { console . log ( `subscriber received value: ${ value }` ) ; } ) ; const sourceInterval = interval ( 1000 ) ; const fiveNumbers = sourceInterval . pipe ( take ( 5 ) , map ( ( value ) => { console . log ( `map received : ${ value }` ) ; return `string_${ value * 2 }` ; } ) ) ; fiveNumbers . subscribe ( ( value ) => { console . log ( `${ new Date ( ) . toLocaleTimeString ( ) } ${ value }` ) ; } ) ;