2018-03-14 12:38:02 -07:00

17 lines
284 B
TypeScript

import { Observable, of } from 'rxjs';
// #docregion
import { filter, map } from 'rxjs/operators';
const squareOdd = of(1, 2, 3, 4, 5)
.pipe(
filter(n => n % 2),
map(n => n * n)
);
// Subscribe to get values
squareOdd.subscribe(x => console.log(x));
// #enddocregion