const noop = () => {} | |
Stream.prototype.forEach = function(onNext, onError=noop, onComplete=noop) { | |
return this.isEmpty ? onComplete() | |
: this.isAbort ? onError(this.error) : | |
: this.isCons ? ( | |
onNext(this.head), | |
this.tail.forEach(onNext, onError, onComplete)) | |
: this.promise.then( | |
stream => stream.forEach(onNext, onError, onComplete), | |
onError); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment