From 205978f32a33b20875b4f8998e645778ff1d9da2 Mon Sep 17 00:00:00 2001 From: Dan Wolff Date: Sun, 4 Feb 2018 22:46:51 +0100 Subject: [PATCH] move up shorter if clause --- lib/compress.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/compress.js b/lib/compress.js index cd74389b..688c0c74 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -4807,8 +4807,12 @@ merge(Compressor.prototype, { // XXX: intentionally falling down to the next case case "==": case "!=": + // void 0 == x => null == x + if (!is_strict_comparison && is_undefined(self.left, compressor)) { + self.left = make_node(AST_Null, self.left); + } // "undefined" == typeof x => undefined === x - if (compressor.option("typeofs") + else if (compressor.option("typeofs") && self.left instanceof AST_String && self.left.value == "undefined" && self.right instanceof AST_UnaryPrefix @@ -4828,10 +4832,6 @@ merge(Compressor.prototype, { && is_object(self.left.fixed_value())) { return make_node(self.operator[0] == "=" ? AST_True : AST_False, self); } - // void 0 == x => null == x - else if (!is_strict_comparison && is_undefined(self.left, compressor)) { - self.left = make_node(AST_Null, self.left); - } break; case "&&": case "||":