0% found this document useful (0 votes)
113 views

Rxjs Operators Slides

The document discusses RxJS operators map, tap, and take. Map transforms each item by applying a function, tap logs output without changing items, and take limits the number of items emitted. An example uses of(2, 4, 6) with pipe to apply map to double values, tap to log, and take to limit to 2 items.

Uploaded by

king kane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
113 views

Rxjs Operators Slides

The document discusses RxJS operators map, tap, and take. Map transforms each item by applying a function, tap logs output without changing items, and take limits the number of items emitted. An example uses of(2, 4, 6) with pipe to apply map to double values, tap to log, and take to limit to 2 items.

Uploaded by

king kane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

-

-
-
map
tap
take
of(2, 4, 6)
.pipe(
map(item => item * 2),
tap(item => console.log(item)),
take(2)
).subscribe(console.log);
map

map(item => item * 2)

-
map
246
of(2, 4, 6)
.pipe(
map(item => item * 2)
).subscribe(console.log);
item * 2 8
4
12
map
of(2, 4, 6)
.pipe(
map(item => item * 2),
2)
map(item => item - 3)
).subscribe(console.log);
).subscribe(console.log); map(item => item * 2)

map(item => item - 3)


map

map
-
-

-
tap

tap(item => console.log(item))

-
-
tap
of(2, 4, 6)
.pipe(
tap(item => console.log(item)),
map(item => item * 2),
tap(item => console.log(item)),
map(item => item - 3),
tap(item => console.log(item))
).subscribe();
tap
of(2, 4, 6)
.pipe(
tap(i => console.log(i))
).subscribe(console.log);
tap(i => console.log(i))
tap

tap
-
-

-
take

take(2)

-
-
of(2, 4, 6)
.pipe(
take(2)
).subscribe(console.log); // 2 4

of(2, 4, 6)
.pipe(
tap(item => console.log(item)),
map(item => item * 2),
take(2),
map(item => item - 3),
tap(item => console.log(item))
).subscribe();
map take
of(2, 4, 6)
.pipe(
map(item => item * 2),
take(2)
).subscribe(console.log); map(item => item * 2)

take(2)
take
take
-
-

-


- map
- tap
- take
from([20, 15, 10, 5]).pipe(
tap(item => console.log(item)),
take(3),
map(item => item * 2),
map(item => item - 10),
map(item => {
if (item === 0) {
throw new Error('zero detected');
}
return item;
})
);
map
map(item => item * 2)

tap

tap(item => console.log(item))

take

take(2)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy