]> zoso.dev Git - buffer.git/commitdiff
Cordova support: Check for existence of Symbol.for
authorFeross Aboukhadijeh <feross@feross.org>
Tue, 27 Aug 2019 21:42:50 +0000 (14:42 -0700)
committerFeross Aboukhadijeh <feross@feross.org>
Tue, 27 Aug 2019 21:42:50 +0000 (14:42 -0700)
Fixes: https://github.com/feross/buffer/issues/241
See: https://github.com/feross/buffer/pull/204#issuecomment-520986017

index.js

index 3a4fc7aa9f8c74b0955bb279769facef4d72550a..7c018b9c986ef9db6a368f1488d25cd8bdb8a034 100644 (file)
--- a/index.js
+++ b/index.js
 
 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