From 580c62383133c790686281f25bcb83bef5b7c7e2 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Thu, 2 Feb 2017 12:00:48 -0800 Subject: [PATCH] check for console.error before using it (for IE5-7) Fixes: https://github.com/feross/buffer/issues/152 --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 () { -- 2.34.1