-
Notifications
You must be signed in to change notification settings - Fork 97
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
Make Kefir.combine() also accept sources as objects #143
Comments
Hi ! I'm interested into this. What do you think about passive sources ? |
Hey, @niahoo! I think passive sources should work as well e.g., we should be able to do |
I'm looking at implementing this, as this would be really useful for something I'm working on. This one is easy enough: Kefir.combine({a: aStream, b: bStream}).log()
// <value> {a: 1, b: 2} How do we output the instance method? aStream.combine({b: bStream}).log()
// <value> {[key?]: 1, b: 2} |
I think we should add support only to the static method. |
Thanks that you're looking into it, btw! |
https://github.com/iofjuupasli/kefir-combine-object It's far from perfect (Ramda dependency), but if you need object combine right now, this can be helpful |
When we get https://github.com/rpominov/kefir/issues/143 in, we can kill the function that combines them into an object, and either wrap or pass combinator in directly without all of this ceremony inline.
A small wrapper on top of combine() to support handling objects instead of arrays. A potential resolution to kefirjs#143…
I've pulled out a wrapper that I often use; does it need to alter the existing Was thinking about rolling the implemenation together, but then was kind of weirded out about mixed signatures:
|
I'm on the fence. We certainly should not support combining objects with arrays, so if we overload Really not sure what is the best call here, if you're about to make a PR just do what feels right for you 😄 One more thing: I think this method should not wrap existing |
Sounds good. I'll marinate on it a bit and then make a proper pr
|
This landed already so we can close this one. |
Currently combine accepts source observables in arrays, but nothing stops us from also supporting objects as containers for sources.
For instance:
This basically will make combine support named parameters, which is better than parameters as a list.
Also this will work:
Note: not proposing supporting nested objects, or simple values beside observables, as Bacon. combineTemplate() does. Only shallow "maps" of
{[string]: Observable}
.If someone wants to do this, PR is very welcomed!
The text was updated successfully, but these errors were encountered: