diff --git a/declarations.d.ts b/declarations.d.ts index 2b3b74e1..ed94ee5b 100644 --- a/declarations.d.ts +++ b/declarations.d.ts @@ -172,6 +172,7 @@ interface ISpawnFromEventOptions { interface IProjectHelper { projectDir: string; generateDefaultAppId(appName: string, baseAppId: string): string; + sanitizeName(appName: string): string; } interface IPropertiesParser { diff --git a/project-helper.ts b/project-helper.ts index 6694ba92..f551bd3b 100644 --- a/project-helper.ts +++ b/project-helper.ts @@ -39,7 +39,7 @@ export class ProjectHelper implements IProjectHelper { } public generateDefaultAppId(appName: string, baseAppId: string): string { - var sanitizedName = _.filter(appName.split(""), (c) => /[a-zA-Z0-9]/.test(c)).join(""); + var sanitizedName = this.sanitizeName(appName); if (sanitizedName) { if (/^\d+$/.test(sanitizedName)) { sanitizedName = "the" + sanitizedName; @@ -50,5 +50,10 @@ export class ProjectHelper implements IProjectHelper { return util.format("%s.%s", baseAppId, sanitizedName); } + + public sanitizeName(appName: string): string { + var sanitizedName = _.filter(appName.split(""), (c) => /[a-zA-Z0-9]/.test(c)).join(""); + return sanitizedName; + } } $injector.register("projectHelper", ProjectHelper);