
This commit adds missing unit tests for all rx-library examples from the docs. Closes #28017 PR Close #38905
26 lines
549 B
TypeScript
26 lines
549 B
TypeScript
// #docplaster
|
|
/*
|
|
Because of how the code is merged together using the doc regions,
|
|
we need to indent the imports with the function below.
|
|
*/
|
|
/* tslint:disable:align */
|
|
// #docregion
|
|
import { of } from 'rxjs';
|
|
import { filter, map } from 'rxjs/operators';
|
|
|
|
// #enddocregion
|
|
|
|
export function docRegionDefault(console) {
|
|
// #docregion
|
|
const squareOdd = of(1, 2, 3, 4, 5)
|
|
.pipe(
|
|
filter(n => n % 2 !== 0),
|
|
map(n => n * n)
|
|
);
|
|
|
|
// Subscribe to get values
|
|
squareOdd.subscribe(x => console.log(x));
|
|
|
|
// #enddocregion
|
|
}
|