Closed cjihrig closed 7 years ago
The only way to reliably polyfill the ability to brand check is with try/catch.
See http://npmjs.com/is-string, https://www.npmjs.com/package/is-number-object, https://www.npmjs.com/package/is-typed-array, https://www.npmjs.com/package/is-symbol, etc.
I believe the current proposal handles this issue. So long as a reference to the default @@builtin
function is grabbed, it should be possible to reliably check for the existence of the [[Builtin]]
internal slot despite user monkeypatching.
This is another thing that causes problems. Node's
util
functions used to check the result oftoString()
, but that is no longer feasible because ofSymbol.toStringTag
.See the note and example on this in https://nodejs.org/api/util.html#util_util_iserror_object.