INNER CODE UNIT · TypeScript
oldMethod
maciejtreder/ng-toolkit · schematics/_utils/index.ts:155
let oldMethod = oldSignature + oldBody;
tree.overwrite(filePath, fileContent.replace(oldMethod, newMethodContent));
} else {
throw new NgToolkitException(`Method ${name} not found in ${filePath}`, { fileContent: fileContent });
}
}
export function getMethodSignature(tree: Tree, filePath: string, name: string): string | null {
let fileContent = getFileContent(tree, filePath);
let results: any = fileContent.match(new RegExp("(?:public|private|).*" + name + ".*?\\(([\\s\\S]*?\\))"));
if (results) {
fileContent = fileContent.substr(results.index);
let lines = fileContent.split('\n');
let endCut = 0;
let openingBraces = 0;
for (let line of lines) {
endCut += line.length + 1