\x89PNG\r\n\x1a\n\x00\x00\x00\x0DIHDR\x00\x00\x00\x01\x00 \x00\x00\x01\x08\x06\x00\x00\x00\x1F\x15\xC4\x89\x00\x00\x00 \x0AIDATx\x9Ccb\x00\x00\x00\x06\x00\x03\x1A\x05\x9D\x00\x00 \x00\x00IEND\xAE\x42\x60\x82
| Path : /var/www/html/tool-ob/ToolsPortal/node_modules/@hookform/resolvers/superstruct/src/ |
|
B-Con CMD Config cPanel C-Rdp D-Log Info Jump Mass Ransom Symlink vHost Zone-H |
| Current File : /var/www/html/tool-ob/ToolsPortal/node_modules/@hookform/resolvers/superstruct/src/superstruct.ts |
import { toNestErrors, validateFieldsNatively } from '@hookform/resolvers';
import { FieldError } from 'react-hook-form';
import { StructError, validate } from 'superstruct';
import { Resolver } from './types';
const parseErrorSchema = (error: StructError) =>
error.failures().reduce<Record<string, FieldError>>(
(previous, error) =>
(previous[error.path.join('.')] = {
message: error.message,
type: error.type,
}) && previous,
{},
);
export const superstructResolver: Resolver =
(schema, schemaOptions, resolverOptions = {}) =>
(values, _, options) => {
const result = validate(values, schema, schemaOptions);
if (result[0]) {
return {
values: {},
errors: toNestErrors(parseErrorSchema(result[0]), options),
};
}
options.shouldUseNativeValidation && validateFieldsNatively({}, options);
return {
values: resolverOptions.raw ? values : result[1],
errors: {},
};
};