Download react-hook-form/src/logic/skipValidation.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 601 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/logic/skipValidation.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/logic/skipValidation.ts
-
curl -L -o skipValidation.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/logic/skipValidation.ts
601 Bytes
| import type { ValidationModeFlags } from '../types'; | |
| export default ( | |
| isBlurEvent: boolean, | |
| isTouched: boolean, | |
| isSubmitted: boolean, | |
| reValidateMode: { | |
| isOnBlur: boolean; | |
| isOnChange: boolean; | |
| }, | |
| mode: Partial<ValidationModeFlags>, | |
| ) => { | |
| if (mode.isOnAll) { | |
| return false; | |
| } else if (!isSubmitted && mode.isOnTouch) { | |
| return !(isTouched || isBlurEvent); | |
| } else if (isSubmitted ? reValidateMode.isOnBlur : mode.isOnBlur) { | |
| return !isBlurEvent; | |
| } else if (isSubmitted ? reValidateMode.isOnChange : mode.isOnChange) { | |
| return isBlurEvent; | |
| } | |
| return true; | |
| }; | |