Compare commits
2 Commits
b3f4317129
...
329cd65b69
Author | SHA1 | Date | |
---|---|---|---|
329cd65b69 | |||
144d86c0d9 |
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
@ -28,7 +28,7 @@
|
||||
"@angular/compiler-cli": "^18.2.3",
|
||||
"@types/jasmine": "~5.1.0",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"jasmine-core": "~5.1.0",
|
||||
"jasmine-core": "~5.4.0",
|
||||
"karma": "~6.4.0",
|
||||
"karma-chrome-launcher": "~3.2.0",
|
||||
"karma-coverage": "~2.2.0",
|
||||
@ -36,6 +36,6 @@
|
||||
"karma-jasmine-html-reporter": "~2.1.0",
|
||||
"postcss": "^8.4.41",
|
||||
"tailwindcss": "^3.4.10",
|
||||
"typescript": "~5.5.2"
|
||||
"typescript": "~5.6.0"
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,12 @@ import { AsyncPipe, UpperCasePipe } from '@angular/common';
|
||||
import { TextPipe } from '../text.pipe';
|
||||
import { HotelService } from './Parent/services/hotel.service';
|
||||
import { inject } from '@angular/core';
|
||||
import { filter, from, map, Observable, range, tap, toArray } from 'rxjs';
|
||||
import { filter, from, last, map, Observable, range, scan, tap, toArray } from 'rxjs';
|
||||
|
||||
interface User {
|
||||
name: string;
|
||||
age: number;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
@ -20,15 +25,35 @@ export class AppComponent {
|
||||
public hotelService: HotelService = inject(HotelService);
|
||||
|
||||
ngOnInit() {
|
||||
const stream: Observable<number | string> = from([5, 1, 2, 12, 5, 14, 17, 5, "testing"]);
|
||||
|
||||
const users = [
|
||||
{ name: "Max", age: 21 },
|
||||
{ name: "Peter", age: 31 },
|
||||
{ name: "Hans", age: 13 },
|
||||
{ name: "Klaus", age: 51 },
|
||||
{ name: "Dieter", age: 1 },
|
||||
{ name: "Jan-Marlon", age: 3 },
|
||||
]
|
||||
|
||||
|
||||
const stream: Observable<User> = from(users);
|
||||
|
||||
stream.pipe(
|
||||
filter((value) => typeof value === "number"),
|
||||
tap((value) => console.log("Zahl:" + value)),
|
||||
filter((value: number) => value % 2 === 0),
|
||||
tap((value) => console.log("Gerade Zahl: " + value)),
|
||||
toArray(),
|
||||
filter((user) => user.age > 18),
|
||||
scan((acc, user) => acc + user.age, 0),
|
||||
map((ageSum, index) => ageSum / (index + 1)),
|
||||
last(),
|
||||
).subscribe(console.log);
|
||||
|
||||
// const stream: Observable<number | string> = from([5, 1, 2, 12, 5, 14, 17, 5, "testing"]);
|
||||
|
||||
// stream.pipe(
|
||||
// filter((value) => typeof value === "number"),
|
||||
// tap((value) => console.log("Zahl:" + value)),
|
||||
// filter((value: number) => value % 2 === 0),
|
||||
// tap((value) => console.log("Gerade Zahl: " + value)),
|
||||
// toArray(),
|
||||
//).subscribe(console.log);
|
||||
}
|
||||
|
||||
public test() {
|
||||
|
Loading…
Reference in New Issue
Block a user