Skip to content

Commit

Permalink
Fixed: Reader#bytes should also support plain arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Apr 11, 2017
1 parent 0c6e639 commit ed34b09
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ Reader.prototype.bytes = function read_bytes() {
throw indexOutOfRange(this, length);

this.pos += length;
if (Array.isArray(this.buf)) // plain array
return this.buf.slice(start, end);
return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1
? new this.buf.constructor(0)
: this._slice.call(this.buf, start, end);
Expand Down

0 comments on commit ed34b09

Please sign in to comment.