Appearance
Appearance
Applies a projection function to each emitted value and passes the result downstream.
map<T, R>(project: (value: T, index: number) => R): OperatorFunction<T, R>source: --1----2----3----|
map(x => x * 2)
result: --2----4----6----|
import { of } from 'rxjs'
import { map } from 'rxjs/operators'
of(1, 2, 3).pipe(
map(x => x * 2)
).subscribe(console.log)
// Output: 2, 4, 6