]> zoso.dev Git - buffer.git/commitdiff
[Fix] `Symbol.for` is a syntax error in older browsers
authorJordan Harband <ljharb@gmail.com>
Fri, 20 Dec 2019 07:13:14 +0000 (23:13 -0800)
committerGitHub <noreply@github.com>
Fri, 20 Dec 2019 07:13:14 +0000 (23:13 -0800)
For example, Opera 10.6.

Introduced when fixing #241.

index.js

index 19b0468a0abe20e311c0015cb694415e45fed5a7..115e46414898bea3c50191be7134c45fde6b5c14 100644 (file)
--- a/index.js
+++ b/index.js
@@ -11,8 +11,8 @@
 var base64 = require('base64-js')
 var ieee754 = require('ieee754')
 var customInspectSymbol =
-  (typeof Symbol === 'function' && typeof Symbol.for === 'function')
-    ? Symbol.for('nodejs.util.inspect.custom')
+  (typeof Symbol === 'function' && typeof Symbol['for'] === 'function')
+    ? Symbol['for']('nodejs.util.inspect.custom')
     : null
 
 exports.Buffer = Buffer