From c16e421ac69d37a23fddb9fa4f4a284e19a70b37 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Tue, 27 Aug 2019 14:42:50 -0700 Subject: [PATCH] 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 --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- 2.34.1