import { AbstractControl, ValidationErrors } from "@angular/forms";

export class WhiteSpaceValidator {
  static noWhiteSpace(control: AbstractControl): ValidationErrors | null {
    if (control?.value) {
      const trimmedValue = control.value.trim();
      if (trimmedValue.length !== control.value.length) {
        return { noWhiteSpace: true };
      }
    }
    return null;
  }
}
