Do not use constructor.name to check object
See original GitHub issueisAbortSignal
and isBlob
use constructor.name
only to check.
However, constructor.name
can be rewrited. So, for example, webpack4 with production mode will break constructor.name
of AbortSignal that will be rewritten to "s"
.
So, Expected signal to be an instanceof AbortSignal
Error was occured (ref: https://github.com/yumetodo/vscode-google-photos-uploader/issues/11 )
isURLSearchParams
is adopting good implementation (ref: https://github.com/bitinn/node-fetch/issues/296#issuecomment-307598143, https://github.com/bitinn/node-fetch/pull/297/commits/302992d68e75748a7781c52e868b4fde7925325f ). Object.prototype.toString()
will call Symbol.toStringTag
propaty which is not writable(see MDN)
Of course, I know that there are two workarounds for webpack4:
- Set
optimization.minimize
tofalse
(ref: https://github.com/webpack/webpack/issues/6841#issuecomment-376129163) - Specify minimizer manually and set
keep_fnames
totrue
(ref: https://github.com/CartoDB/carto-vl/pull/1066)
However, rely on constructor.name
is a bad idea, I think.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
Fixed in #673
OK, we will drop
constructor.name
in favor oftoStringTag
in v3 release where applicable.