Skip to content

Commit

Permalink
utils.js: Fix closure compiler error
Browse files Browse the repository at this point in the history
Apply changes from this commit:

"Integrated internal changes from Google"
13fd045
  • Loading branch information
davido committed Dec 7, 2018
1 parent 3cb0aec commit da775bc
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 da775bc

Please sign in to comment.