summaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/template-mapping/utils/ParserFactory/ASCII-Parser.ts
blob: c9e0a1891da73eacbdf5e37f620c9c0dadb3ebf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { Parser } from './Parser';

export class ASCIIParser implements Parser {
    variables: Set<string> = new Set();
    getVariables(fileContent: string): string[] {
        if (fileContent.includes('$(')) {
            const xmlSplit = fileContent.split('$(');
            for (const val of xmlSplit) {
                const res = val.substring(0, val.indexOf(')'));
                if (res && res.length > 0) {
                    this.variables.add(res);
                }

            }
        }
        return [...this.variables];
    }

}