source code is here. The part I'm having trouble with is this:
export function forbiddenNameValidator(nameRe: RegExp): ValidatorFn {
return (control: AbstractControl): ValidationErrors | null => {
const forbidden = nameRe.test(control.value);
return forbidden ? {forbiddenName: {value: control.value}} : null;
};
}
The part I don't understand is the return part. We're returning a function within a function, and it confused me a lot. I've looked around a bit but haven't been able to find any references to this topic. can you help me?