- (feat) add 'key as default value' post processor (closes #109) - (chore) move clean functionality to a post processor - (chore) move sort functionality to a post processor - (refactor) get rid of leading underscore on protected properties/methods
25 lines
553 B
TypeScript
25 lines
553 B
TypeScript
export abstract class AbstractTemplateParser {
|
|
|
|
/**
|
|
* Checks if file is of type javascript or typescript and
|
|
* makes the assumption that it is an Angular Component
|
|
*/
|
|
protected isAngularComponent(path: string): boolean {
|
|
return (/\.ts|js$/i).test(path);
|
|
}
|
|
|
|
/**
|
|
* Extracts inline template from components
|
|
*/
|
|
protected extractInlineTemplate(contents: string): string {
|
|
const regExp: RegExp = /template\s*:\s*(["'`])([^\1]*?)\1/;
|
|
const match = regExp.exec(contents);
|
|
if (match !== null) {
|
|
return match[2];
|
|
}
|
|
|
|
return '';
|
|
}
|
|
|
|
}
|