Created
February 10, 2021 15:09
-
-
Save ThomasKruegl/cb0543c48e5a252925393c0bd2acef2e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { interval, of, from } = Rx; | |
const { take, delay, map, switchMap, groupBy, mergeMap, toArray } = RxOperators; | |
const foo1 = { | |
items: [] | |
}; | |
const foo2 = { | |
items: [1,2,3] | |
}; | |
const foo3 = { | |
items: [1,2,2] | |
}; | |
const foo4 = { | |
items: [1,1,1,2,2,2,2] | |
}; | |
const input = [foo1, foo2, foo3, foo4]; | |
interval(1000) | |
.pipe( | |
take(4), | |
map(i => input[i]), | |
map(obj => obj.items), | |
switchMap( arr => from(arr)), | |
groupBy(num => num), | |
// mergeMap(group => group.pipe(toArray())) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment