Skip to content

Instantly share code, notes, and snippets.

@yelouafi
Created July 17, 2015 02:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yelouafi/8cea6952db587673de0b to your computer and use it in GitHub Desktop.
Save yelouafi/8cea6952db587673de0b to your computer and use it in GitHub Desktop.
Stream.prototype.takeUntil = function(untilP) {
...
// isFuture
Stream.Future(
Promise.race([
untilP.then( _ => () => Stream.Empty, Stream.Abort ),
this.promise.then( s => () => s.takeUntil(promise), Stream.Abort )
]).then( lazy => lazy()))
}
@takemyoxygen
Copy link

shouldn't the second element in Promise.race array be ...s => () => s.takeUntil(untilP), instead of ...s => () => s.takeUntil(promise)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment