Skip to content

Commit

Permalink
feat(build): add cast-to-string for comparisons
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jsleuth committed Jun 14, 2018
1 parent 7049f27 commit 493ddd3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/AureliaDependenciesPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ParserPlugin {
parser.plugin("evaluate Identifier imported var.moduleName", (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;
Expand All @@ -58,8 +58,8 @@ class ParserPlugin {
// PLATFORM.moduleName("id");
parser.plugin("evaluate MemberExpression", (expr: Webpack.MemberExpression) => {
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;
Expand Down

0 comments on commit 493ddd3

Please sign in to comment.