Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow merge/flatMap and variants to support arrays or iterator in addition to observables #174

Open
davidwdan opened this issue May 19, 2017 · 1 comment

Comments

@davidwdan
Copy link
Member

davidwdan commented May 19, 2017

Example:

->flatMap(function(array $x){
    return $x;
})
@ReactiveX ReactiveX deleted a comment from Azhovan Oct 21, 2018
@makomweb
Copy link

makomweb commented Feb 7, 2023

From the subject of this issue I guess you mean something like this, @davidwdan right?

$sequence = Observable::fromArray([[1,2], [3,4], [5,6]]);

$sequence
    ->flatMap(static fn (array $items) => Observable::fromArray($items))
    ->do(static fn (int $item) => $io->note(sprintf('Item: %d', $item)))
    ->subscribe();

// prints:
// Item: 1
// Item: 2
// Item: 3
// Item: 4
// Item: 5
// Item: 6

Is that what you are looking for? Otherwise could you provide a more verbose example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants