Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public matchingProblems(): ValidationProblem[] {
if (!this.models) {
return [];
}
// Find the relevant problems if not cached.
if (this._problems === undefined) {
this.log("Cache empty, finding matching problems.");
let finder: ProblemFinder = new ProblemFinder(this.properties, this.codes);
for (let model of this.models) {
if (model !== null && model !== undefined) {
if (this.shallow) {
VisitorUtil.visitNode(model, finder);
} else {
VisitorUtil.visitTree(model, finder, TraverserDirection.down);
}
}
}
this._problems = finder.getProblems();
}
return this._problems;
}
public validationProblems(): ValidationProblem[] {
if (this._problems === undefined) {
if (this._model) {
if (this.debug) {
console.info("Getting the list of problems!");
}
let props: string[] = this.property ? [this.property] : null;
let codes: string[] = this.code ? [this.code] : null;
let finder: ProblemFinder = new ProblemFinder(props, codes);
if (this.shallow) {
VisitorUtil.visitNode(this.model, finder);
} else {
VisitorUtil.visitTree(this.model, finder, TraverserDirection.down);
}
this._problems = finder.getProblems();
} else {
this._problems = [];
}
}
return this._problems;
}