Download react-hook-form/src/logic/getResolverOptions.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 737 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/logic/getResolverOptions.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/logic/getResolverOptions.ts
-
curl -L -o getResolverOptions.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/logic/getResolverOptions.ts
737 Bytes
| import type { | |
| CriteriaMode, | |
| Field, | |
| FieldName, | |
| FieldRefs, | |
| FieldValues, | |
| InternalFieldName, | |
| } from '../types'; | |
| import { get } from '../utils'; | |
| import set from '../utils/set'; | |
| export default <TFieldValues extends FieldValues>( | |
| fieldsNames: Set<InternalFieldName> | InternalFieldName[], | |
| _fields: FieldRefs, | |
| criteriaMode?: CriteriaMode, | |
| shouldUseNativeValidation?: boolean | undefined, | |
| ) => { | |
| const fields: Record<InternalFieldName, Field['_f']> = {}; | |
| for (const name of fieldsNames) { | |
| const field: Field = get(_fields, name); | |
| field && set(fields, name, field._f); | |
| } | |
| return { | |
| criteriaMode, | |
| names: [...fieldsNames] as FieldName<TFieldValues>[], | |
| fields, | |
| shouldUseNativeValidation, | |
| }; | |
| }; | |