Fix minify-booleans transform. Fixes #2736

This commit is contained in:
James Kyle
2015-11-02 00:24:45 -08:00
parent 72f384bb29
commit b32e0f540c

View File

@@ -1,9 +1,9 @@
export default function ({ types: t }) {
return {
visitor: {
Literal(node) {
if (typeof node.value === "boolean") {
return t.unaryExpression("!", t.literal(+!node.value), true);
Literal(path) {
if (typeof path.node.value === "boolean") {
path.replaceWith(t.unaryExpression("!", t.numberLiteral(+!path.node.value), true));
}
}
}