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 authored and pat841 committed Jun 26, 2018
1 parent 283a245 commit 568dc37
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 @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 568dc37

Please sign in to comment.