add undefinedToVoid optional transformer

This commit is contained in:
Sebastian McKenzie
2015-01-02 00:41:33 +11:00
parent 41d60a85e9
commit 777f2be14e

View File

@@ -0,0 +1,9 @@
var t = require("../../types");
exports.optional = true;
exports.Identifier = function (node, parent) {
if (node.name === "undefined" && t.isReferenced(node, parent)) {
return t.unaryExpression("void", t.literal(0), true);
}
};