From d8c30c209ea88ad9678667580503537da4f8dbf4 Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Fri, 16 Jun 2017 06:08:31 -0400 Subject: [PATCH] Should fix #576 People were calling `"foo".toString() or ["foo", "bar"].toString()`, which returned the real JS string `"[object Object]"`, the stringified version of the replacements object. --- packages/babel-plugin-minify-constant-folding/src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-plugin-minify-constant-folding/src/index.js b/packages/babel-plugin-minify-constant-folding/src/index.js index 782d76be2..9f09489f2 100644 --- a/packages/babel-plugin-minify-constant-folding/src/index.js +++ b/packages/babel-plugin-minify-constant-folding/src/index.js @@ -22,7 +22,7 @@ function swap(path, member, handlers, ...args) { const key = getName(member); if (key === undefined) return; let handler = handlers[key]; - if (typeof handler !== "function") { + if (typeof handler !== "function" || !Object.hasOwnProperty.call(handlers, key)) { if (typeof handlers[FALLBACK_HANDLER] === "function") { handler = handlers[FALLBACK_HANDLER].bind(member.object, key); } else {