Skip to content

Commit fc9e259

Browse files
committedMay 27, 2019
chore(plugins.ts): added if-stmt for native plugins
Added if stmt for not doing anything when native plugins comes-in Also Changed the test
1 parent 7d83453 commit fc9e259

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed
 

‎packages/generators/__tests__/add-generator.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe("generatePluginName", () => {
88

99
it("should return webpack Standard Plugin Name for Name : webpack.DefinePlugin", () => {
1010
const pluginName = generatePluginName("webpack.DefinePlugin");
11-
expect(pluginName).toEqual("Webpack.DefinePlugin");
11+
expect(pluginName).toEqual("webpack.DefinePlugin");
1212
});
1313
});
1414

‎packages/generators/utils/plugins.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ export const replaceAt = (str: string, index: number, replace: string) : string
4343
export const generatePluginName = (rawPluginName: string): string => {
4444
let myPluginNameArray : string[];
4545
myPluginNameArray = rawPluginName.split("-");
46-
for (let i = 0; i < myPluginNameArray.length; i++) {
47-
myPluginNameArray[i] = replaceAt(myPluginNameArray[i], 0, myPluginNameArray[i].charAt(0).toUpperCase());
46+
if( myPluginNameArray.length <= 1 ){}
47+
else{
48+
for (let i = 0; i < myPluginNameArray.length; i++) {
49+
myPluginNameArray[i] = replaceAt(myPluginNameArray[i], 0, myPluginNameArray[i].charAt(0).toUpperCase());
50+
}
4851
}
4952
return myPluginNameArray.join("")
5053
}

0 commit comments

Comments
 (0)
Please sign in to comment.