(value: any)
| 607 | } |
| 608 | |
| 609 | export function toObservable(value: any): Observable<any> { |
| 610 | const obs = isPromise(value) ? from(value) : value; |
| 611 | if ((typeof ngDevMode === 'undefined' || ngDevMode) && !isSubscribable(obs)) { |
| 612 | let errorMessage = `Expected async validator to return Promise or Observable.`; |
| 613 | // A synchronous validator will return object or null. |
| 614 | if (typeof value === 'object') { |
| 615 | errorMessage += |
| 616 | ' Are you using a synchronous validator where an async validator is expected?'; |
| 617 | } |
| 618 | throw new RuntimeError(RuntimeErrorCode.WRONG_VALIDATOR_RETURN_TYPE, errorMessage); |
| 619 | } |
| 620 | return obs; |
| 621 | } |
| 622 | |
| 623 | function mergeErrors(arrayOfErrors: (ValidationErrors | null)[]): ValidationErrors | null { |
| 624 | let res: {[key: string]: any} = {}; |
no test coverage detected
searching dependent graphs…