Use unaryExpression for typeof

This commit is contained in:
Lars Kappert
2015-01-06 10:12:08 +01:00
parent 216b8c2fd1
commit dfa51954b8

View File

@@ -39,8 +39,8 @@ UMDFormatter.prototype.transform = function (ast) {
defineArgs = [t.arrayExpression(defineArgs)];
// typeof exports !== "undefined" && typeof module !== "undefined"
var testExports = t.binaryExpression("!==", t.typeOfExpression(t.identifier("exports")), t.literal("undefined")),
testModule = t.binaryExpression("!==", t.typeOfExpression(t.identifier("module")), t.literal("undefined")),
var testExports = t.binaryExpression("!==", t.unaryExpression("typeof", t.identifier("exports"), true), t.literal("undefined")),
testModule = t.binaryExpression("!==", t.unaryExpression("typeof", t.identifier("module"), true), t.literal("undefined")),
commonTests = this.passModuleArg ? t.logicalExpression("&&", testExports, testModule) : testExports;
var commonArgs = [t.identifier("exports")];