Add support for node 4.3.2+
This commit is contained in:
parent
d09f9c7b0c
commit
5c78a37ae0
@ -5,14 +5,15 @@ export abstract class AbstractTemplateParser {
|
|||||||
* makes the assumption that it is an Angular Component
|
* makes the assumption that it is an Angular Component
|
||||||
*/
|
*/
|
||||||
protected _isAngularComponent(path: string): boolean {
|
protected _isAngularComponent(path: string): boolean {
|
||||||
return new RegExp(/\.ts|js$/, 'i').test(path);
|
return (/\.ts|js$/i).test(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts inline template from components
|
* Extracts inline template from components
|
||||||
*/
|
*/
|
||||||
protected _extractInlineTemplate(contents: string): string {
|
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) {
|
if (match !== null) {
|
||||||
return match[2];
|
return match[2];
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,7 @@ export class PipeParser extends AbstractTemplateParser implements ParserInterfac
|
|||||||
protected _parseTemplate(template: string): TranslationCollection {
|
protected _parseTemplate(template: string): TranslationCollection {
|
||||||
let collection: TranslationCollection = new 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;
|
let matches: RegExpExecArray;
|
||||||
while (matches = regExp.exec(template)) {
|
while (matches = regExp.exec(template)) {
|
||||||
collection = collection.add(matches[2]);
|
collection = collection.add(matches[2]);
|
||||||
|
@ -11,7 +11,7 @@ export class ServiceParser implements ParserInterface {
|
|||||||
return collection;
|
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');
|
const regExp: RegExp = new RegExp(`${translateServiceVar}\.${methodRegExp.source}`, 'g');
|
||||||
|
|
||||||
let matches: RegExpExecArray;
|
let matches: RegExpExecArray;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user