From dfa51954b85712656f3ca5fa096bdb61acf223ed Mon Sep 17 00:00:00 2001 From: Lars Kappert Date: Tue, 6 Jan 2015 10:12:08 +0100 Subject: [PATCH] Use unaryExpression for typeof --- lib/6to5/transformation/modules/umd.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/6to5/transformation/modules/umd.js b/lib/6to5/transformation/modules/umd.js index 1a502a24a1..299a4aee22 100644 --- a/lib/6to5/transformation/modules/umd.js +++ b/lib/6to5/transformation/modules/umd.js @@ -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")];