Skip to content

Commit

Permalink
Can't use Uint8Array#set on node < 6 buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Dec 10, 2016
1 parent c3c70fe commit b510ba2
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 17 deletions.
12 changes: 5 additions & 7 deletions dist/protobuf.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/protobuf.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/protobuf.min.js

Large diffs are not rendered by default.

Binary file modified dist/protobuf.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/protobuf.min.js.map

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions src/writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -602,12 +602,10 @@ BufferWriterPrototype.double = function write_double_buffer(value) {
return this.push(writeDoubleBuffer, 8, value);
};

var writeBytesBuffer = util.Buffer && util.Buffer.prototype.set // set is faster (node 6.9.1)
? writeBytes_set
: function writeBytes_copy(buf, pos, val) {
if (val.length)
val.copy(buf, pos, 0, val.length);
};
function writeBytesBuffer(buf, pos, val) {
if (val.length)
val.copy(buf, pos, 0, val.length);
};

/**
* @override
Expand Down

0 comments on commit b510ba2

Please sign in to comment.