Download react-hook-form/src/logic/hasPromiseValidation.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 629 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-hook-form/src/logic/hasPromiseValidation.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/react-hook-form/src/logic/hasPromiseValidation.ts
-
curl -L -o hasPromiseValidation.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-hook-form/src/logic/hasPromiseValidation.ts
629 Bytes
| import type { Field, Validate } from '../types'; | |
| import isFunction from '../utils/isFunction'; | |
| import isObject from '../utils/isObject'; | |
| const ASYNC_FUNCTION = 'AsyncFunction'; | |
| export default (fieldReference: Field['_f']) => | |
| !!fieldReference && | |
| !!fieldReference.validate && | |
| !!( | |
| (isFunction(fieldReference.validate) && | |
| fieldReference.validate.constructor.name === ASYNC_FUNCTION) || | |
| (isObject(fieldReference.validate) && | |
| Object.values(fieldReference.validate).find( | |
| (validateFunction: Validate<unknown, unknown>) => | |
| validateFunction.constructor.name === ASYNC_FUNCTION, | |
| )) | |
| ); | |