Add support for node 4.3.2+

This commit is contained in:
Kim Biesbjerg 2016-12-23 05:45:06 +01:00
parent d09f9c7b0c
commit 5c78a37ae0
3 changed files with 5 additions and 5 deletions

View File

@ -5,14 +5,15 @@ export abstract class AbstractTemplateParser {
* makes the assumption that it is an Angular Component
*/
protected _isAngularComponent(path: string): boolean {
return new RegExp(/\.ts|js$/, 'i').test(path);
return (/\.ts|js$/i).test(path);
}
/**
* Extracts inline template from components
*/
protected _extractInlineTemplate(contents: string): string {
const match = new RegExp(/template\s*:\s*(["'`])([^\1]*?)\1/).exec(contents);
const regExp: RegExp = /template\s*:\s*(["'`])([^\1]*?)\1/;
const match = regExp.exec(contents);
if (match !== null) {
return match[2];
}

View File

@ -15,8 +15,7 @@ export class PipeParser extends AbstractTemplateParser implements ParserInterfac
protected _parseTemplate(template: string): TranslationCollection {
let collection: TranslationCollection = new TranslationCollection();
const regExp = new RegExp(/(['"`])([^\1\r\n]*?)\1\s*\|\s*translate/, 'g');
const regExp: RegExp = /(['"`])([^\1\r\n]*?)\1\s*\|\s*translate/g;
let matches: RegExpExecArray;
while (matches = regExp.exec(template)) {
collection = collection.add(matches[2]);

View File

@ -11,7 +11,7 @@ export class ServiceParser implements ParserInterface {
return collection;
}
const methodRegExp: RegExp = new RegExp(/(?:get|instant)\s*\(\s*(\[?\s*(['"`])([^\1\r\n]*)\2\s*\]?)/);
const methodRegExp: RegExp = /(?:get|instant)\s*\(\s*(\[?\s*(['"`])([^\1\r\n]*)\2\s*\]?)/;
const regExp: RegExp = new RegExp(`${translateServiceVar}\.${methodRegExp.source}`, 'g');
let matches: RegExpExecArray;