Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 5x 5x 3x 58x 7x 51x 1x 50x | import { ValidatorFn, AbstractControl, ValidationErrors } from "@angular/forms"
import { ScenarioHelper } from "../../scenarioHelper"
 
export function customScenarioNameValidator(): ValidatorFn {
    return (control: AbstractControl): ValidationErrors | null => {
        if (control.value.length === 0) {
            return { Error: "Scenario name is required" }
        }
        if (ScenarioHelper.isScenarioExisting(control.value)) {
            return { Error: "A Scenario with this name already exists" }
        }
        return null
    }
}
  |