refactor: code cleanup

This commit is contained in:
Victor Berchet
2016-07-11 15:27:57 -07:00
parent 9af2d8b810
commit 93d0a01d3d
6 changed files with 35 additions and 50 deletions

View File

@ -21,12 +21,8 @@ export function camelCaseToDashCase(input: string): string {
}
export function splitAtColon(input: string, defaultValues: string[]): string[] {
var parts = StringWrapper.split(input.trim(), /\s*:\s*/g);
if (parts.length > 1) {
return parts;
} else {
return defaultValues;
}
var parts = input.split(':', 2).map((s: string) => s.trim());
return parts.length > 1 ? parts : defaultValues;
}
export function sanitizeIdentifier(name: string): string {