From: Feross Aboukhadijeh Date: Tue, 27 Aug 2019 21:42:50 +0000 (-0700) Subject: Cordova support: Check for existence of Symbol.for X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=c16e421ac69d37a23fddb9fa4f4a284e19a70b37;p=buffer.git Cordova support: Check for existence of Symbol.for Fixes: https://github.com/feross/buffer/issues/241 See: https://github.com/feross/buffer/pull/204#issuecomment-520986017 --- diff --git a/index.js b/index.js index 3a4fc7a..7c018b9 100644 --- a/index.js +++ b/index.js @@ -10,7 +10,10 @@ var base64 = require('base64-js') var ieee754 = require('ieee754') -var customInspectSymbol = typeof Symbol === 'function' ? Symbol.for('nodejs.util.inspect.custom') : null +var customInspectSymbol = + (typeof Symbol === 'function' && typeof Symbol.for === 'function') + ? Symbol.for('nodejs.util.inspect.custom') + : null exports.Buffer = Buffer exports.SlowBuffer = SlowBuffer