From: Feross Aboukhadijeh Date: Thu, 2 Feb 2017 20:00:48 +0000 (-0800) Subject: check for console.error before using it (for IE5-7) X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=580c62383133c790686281f25bcb83bef5b7c7e2;p=buffer.git check for console.error before using it (for IE5-7) Fixes: https://github.com/feross/buffer/issues/152 --- diff --git a/index.js b/index.js index fb0fc6f..5dea89c 100644 --- a/index.js +++ b/index.js @@ -34,10 +34,12 @@ exports.kMaxLength = K_MAX_LENGTH */ Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport() -if (!Buffer.TYPED_ARRAY_SUPPORT) { +if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && + typeof console.error === 'function') { console.error( 'This browser lacks typed array (Uint8Array) support which is required by ' + - '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.') + '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.' + ) } function typedArraySupport () {