Skip to content

Commit a1b7edf

Browse files
ssutarpzuraq
authored andcommitted
Append the object type by default to the transformed class (#49)
In earlier implementation type would be appended to the class only in case of name collision between class name and super class. With this PR we're appending the type to class name by default, in case of collision the type would be dropped
1 parent 70dce07 commit a1b7edf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

transforms/helpers/parse-helper.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,14 +470,16 @@ function getClassName(
470470
eoCallExpression,
471471
filePath,
472472
superClassName,
473-
type = "EmberObject"
473+
type = ""
474474
) {
475475
const varDeclaration = getClosetVariableDeclaration(j, eoCallExpression);
476476
const className =
477477
getVariableName(varDeclaration) || camelCase(path.basename(filePath, "js"));
478-
let capitalizedClassName = capitalizeFirstLetter(className);
478+
let capitalizedClassName = `${capitalizeFirstLetter(
479+
className
480+
)}${capitalizeFirstLetter(type)}`;
479481
if (capitalizedClassName === superClassName) {
480-
capitalizedClassName += capitalizeFirstLetter(type);
482+
capitalizedClassName = capitalizeFirstLetter(className);
481483
}
482484
return capitalizedClassName;
483485
}

0 commit comments

Comments
 (0)