map
signature: map(project: Function, thisArg: any): Observable
map(project: Function, thisArg: any): Observable각각의 값에 넘겨받은 콜백을 적용합니다.
예시
// RxJS v6+
import { from } from 'rxjs';
import { map } from 'rxjs/operators';
//(1,2,3,4,5) 발생시킵니다
const source = from([1, 2, 3, 4, 5]);
//각각의 값에 10을 더합니다
const example = source.pipe(map(val => val + 10));
//결과: 11,12,13,14,15
const subscribe = example.subscribe(val => console.log(val));관련된 사용법
추가 자료
Last updated
Was this helpful?