Avoid exception when typeof is in anonymous function declaration.
This commit is contained in:
parent
8bea5f4f16
commit
9b0f509433
@ -33,7 +33,9 @@ export default function({ types: t }) {
|
||||
const isUnderHelper = path.findParent(path => {
|
||||
return (
|
||||
(path.isVariableDeclarator() && path.node.id === helper) ||
|
||||
(path.isFunctionDeclaration() && path.node.id.name === helper.name)
|
||||
(path.isFunctionDeclaration() &&
|
||||
path.node.id &&
|
||||
path.node.id.name === helper.name)
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
export default function() {
|
||||
typeof {} === "object";
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
export default function () {
|
||||
_typeof({}) === "object";
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["transform-es2015-typeof-symbol"]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user