({
timeout = 0,
shouldFail,
customError = {
async: true,
},
}: {
timeout?: number;
shouldFail: boolean;
customError?: any;
})
| 54 | * @param customError When supplied, overrides the default error `{async: true}` |
| 55 | */ |
| 56 | export function simpleAsyncValidator({ |
| 57 | timeout = 0, |
| 58 | shouldFail, |
| 59 | customError = { |
| 60 | async: true, |
| 61 | }, |
| 62 | }: { |
| 63 | timeout?: number; |
| 64 | shouldFail: boolean; |
| 65 | customError?: any; |
| 66 | }): AsyncValidatorFn { |
| 67 | const result = shouldFail ? customError : null; |
| 68 | return (c: AbstractControl) => |
| 69 | timeout === 0 ? of(result) : createValidationPromise(result, timeout); |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Returns the asynchronous validation state of each provided control |
no test coverage detected
searching dependent graphs…