diff --git a/src/domain/Script.ts b/src/domain/Script.ts index 35e65b6d..aefda55b 100644 --- a/src/domain/Script.ts +++ b/src/domain/Script.ts @@ -13,18 +13,11 @@ export class Script extends BaseEntity implements IScript { if (lines.length === 0) { return; } - const checkForDuplicates = (line: string) => { - const trimmed = line.trim(); - if (trimmed.length === 1 && trimmed === ')' || trimmed === '(') { - return false; - } - return true; - }; const duplicateLines = new Array(); const uniqueLines = new Set(); let validatedLineCount = 0; for (const line of lines) { - if (!checkForDuplicates(line)) { + if (!this.isUniqueLine(line)) { continue; } uniqueLines.add(line); @@ -38,6 +31,14 @@ export class Script extends BaseEntity implements IScript { } } + private static isUniqueLine(codeLine: string): boolean { + const trimmed = codeLine.trim(); + if (trimmed === ')' || trimmed === '(') { // "(" and ")" are used often in batch code + return false; + } + return true; + } + constructor(public name: string, public code: string, public documentationUrls: ReadonlyArray) { super(name); if (code == null || code.length === 0) {