Re: [streams] Byte stream update, including reference implementation (#361)

> +    }
> +
> +    const stream = this._controlledReadableByteStream;
> +
> +    if (stream._closeRequested) {
> +      throw new TypeError('stream is closed or draining');
> +    }
> +    if (stream._state !== 'readable') {
> +      throw new TypeError('The stream is not in the readable state and cannot be enqueued to');
> +    }
> +
> +    const reader = stream._reader;
> +
> +    if (reader === undefined) {
> +      EnqueueInReadableByteStreamController(this, chunk);
> +      return;

IMO most of the early returns in this function would actually be simpler as if/elses. "If there's no reader, do X. Otherwise, do Y." Instead of "If there's no reader, do X and return. Do Y."

Just a style thing though, not important.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/361/files#r33550121

Received on Tuesday, 30 June 2015 08:22:11 UTC