From 568dc37ead9fac92794880630a9709f04e01e596 Mon Sep 17 00:00:00 2001 From: JeffSlutz Date: Thu, 14 Jun 2018 11:27:23 -0600 Subject: [PATCH] feat(build): add cast-to-string for comparisons It will be safer to use String() rather than depend on the presence of toString() methods on the objects. This is believed to be a non-breaking change. --- src/AureliaDependenciesPlugin.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/AureliaDependenciesPlugin.ts b/src/AureliaDependenciesPlugin.ts index d8394d7..34e2c4f 100644 --- a/src/AureliaDependenciesPlugin.ts +++ b/src/AureliaDependenciesPlugin.ts @@ -48,7 +48,7 @@ class ParserPlugin { hooks.evaluateIdentifier.tap("imported var.moduleName", TAP_NAME, (expr: Webpack.MemberExpression) => { if (expr.property.name === "moduleName" && expr.object.name === "PLATFORM" && - expr.object.type.toString() === "Identifier") { + String(expr.object.type) === "Identifier") { return new BasicEvaluatedExpression().setIdentifier("PLATFORM.moduleName").setRange(expr.range); } return undefined; @@ -62,8 +62,8 @@ class ParserPlugin { // PLATFORM.moduleName("id"); hooks.evaluate.tap("MemberExpression", TAP_NAME, expr => { if (expr.property.name === "moduleName" && - (expr.object.type === "MemberExpression" && expr.object.property.name === "PLATFORM" || - expr.object.type.toString() === "Identifier" && expr.object.name === "PLATFORM")) { + (String(expr.object.type) === "MemberExpression" && expr.object.property.name === "PLATFORM" || + String(expr.object.type) === "Identifier" && expr.object.name === "PLATFORM")) { return new BasicEvaluatedExpression().setIdentifier("PLATFORM.moduleName").setRange(expr.range); } return undefined;