Closed shannonmoeller closed 9 years ago
That's a neat trick for storing the next value. Do you have a use case for this functionality?
I've written a map-stream
implementation where async-done
is used to resolve the mapping function. This allows transform stream authors to choose whatever async pattern suits their fancy:
That's awesome. Merging :100:
Thank you, sir!
Published as 1.2.0 - Thanks for the awesome implementation
Cool. What I did was detecting ret.value
instead of .state
from onNext
.
Is it better or? Thoughts?
for example: few lines from letta-value
and tests are currently in always-done (always-done pass 100% of async-done tests)
Thanks.
@tunnckoCore I'm not sure what you mean. I only used onNext.state
as a convenient place to store a value that is specific to the observable use case. Could have stored it in a scope variable, but I liked how this kept things tidy.
@shannonmoeller nevermind. I'm just saying that i think this thing can be done like that
if(result && typeof result.subscribe === 'function'){
if (result.value) return done(null, result.value)
// assume RxJS observable
result.subscribe(noop, onError, onSuccess);
return;
}
Nevermind :) Both ways seems to work.
@tunnckoCore Using result.value
in that way would only work with truthy values, but storing the latest value received by the onNext handler is guaranteed to be the right thing.
Also, is .value
a standard observable thing? I can't find any documentation on it.
in that way would only work with truthy values
haha, good catch, i should fix it.
I can't find any documentation on it.
Same here. I just noticed that it is the thing that is needed.
Also, is .value a standard observable thing?
I'm not sure, I'm not familiar with RX.
Tried to keep it minimal and framework agnostic. Tests passed without change (only dropped the
.skip
).