Skip to content

Commit

Permalink
Merge pull request #5433 from davido/remove_mention_of_buffer_in_util…
Browse files Browse the repository at this point in the history
…s.js

Remove mention of Buffer in utils.js
  • Loading branch information
acozzette authored Dec 8, 2018
2 parents b829ff2 + da775bc commit 66dc42d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions js/binary/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -971,9 +971,10 @@ jspb.utils.byteSourceToUint8Array = function(data) {
return /** @type {!Uint8Array} */(new Uint8Array(data));
}

if (data.constructor === Buffer) {
return /** @type {!Uint8Array} */(new Uint8Array(data));
}
if (typeof Buffer != 'undefined' && data.constructor === Buffer) {
return /** @type {!Uint8Array} */ (
new Uint8Array(/** @type {?} */ (data)));
}

if (data.constructor === Array) {
data = /** @type {!Array<number>} */(data);
Expand Down

0 comments on commit 66dc42d

Please sign in to comment.