repo stringlengths 7 64 | file_url stringlengths 81 338 | file_path stringlengths 5 257 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:25:31 2026-01-05 01:50:38 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/isKey.test.ts | src/__tests__/utils/isKey.test.ts | import isKey from '../../utils/isKey';
describe('isKey', () => {
it('should return true when it is not a deep key', () => {
expect(isKey('test')).toBeTruthy();
expect(isKey('fooBar')).toBeTruthy();
});
it('should return false when it is a deep key', () => {
expect(isKey('test.foo')).toBeFalsy();
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/prepend.test.ts | src/__tests__/utils/prepend.test.ts | import prepend from '../../utils/prepend';
describe('prepend', () => {
it('should prepend value to an array', () => {
expect(prepend([2, 3, 4], 1)).toEqual([1, 2, 3, 4]);
expect(
prepend(
[
{
firstName: '2',
lastName: 'Luo',
id: '75309979-e340-49eb-... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/isFileInput.test.ts | src/__tests__/utils/isFileInput.test.ts | import isFileInput from '../../utils/isFileInput';
describe('isFileInput', () => {
it('should return true when type is file', () => {
expect(isFileInput({ name: 'test', type: 'file' })).toBeTruthy();
});
});
| typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/flatten.test.ts | src/__tests__/utils/flatten.test.ts | import { flatten } from '../../utils/flatten';
describe('flatten', () => {
it('should flatten form values into flat form data', () => {
expect(
flatten({
hey: 'test',
array: [
{
test: '1',
test2: '2',
test3: null,
},
],
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/convertToArrayPayload.test.ts | src/__tests__/utils/convertToArrayPayload.test.ts | import convertToArrayPayload from '../../utils/convertToArrayPayload';
describe('convertToArrayPayload', () => {
it('should return the same array when input is already an array', () => {
const arr = [1, 2, 3];
expect(convertToArrayPayload(arr)).toStrictEqual(arr);
});
it('should wrap non-array values in... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/isRadioInput.test.ts | src/__tests__/utils/isRadioInput.test.ts | import isRadioInput from '../../utils/isRadioInput';
describe('isRadioInput', () => {
it('should return true when type is radio', () => {
expect(isRadioInput({ name: 'test', type: 'radio' })).toBeTruthy();
});
});
| typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/isRadioOrCheckbox.test.ts | src/__tests__/utils/isRadioOrCheckbox.test.ts | import isRadioOrCheckbox from '../../utils/isRadioOrCheckbox';
describe('isRadioOrCheckbox', () => {
it('should return true when type is either radio or checkbox', () => {
expect(isRadioOrCheckbox({ name: 'test', type: 'radio' })).toBeTruthy();
expect(isRadioOrCheckbox({ name: 'test', type: 'checkbox' })).to... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/isNullOrUndefined.test.ts | src/__tests__/utils/isNullOrUndefined.test.ts | import isNullOrUndefined from '../../utils/isNullOrUndefined';
describe('isNullOrUndefined', () => {
it('should return true when object is null or undefined', () => {
expect(isNullOrUndefined(null)).toBeTruthy();
expect(isNullOrUndefined(undefined)).toBeTruthy();
});
it('should return false when object ... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/stringToPath.test.ts | src/__tests__/utils/stringToPath.test.ts | import stringToPath from '../../utils/stringToPath';
describe('stringToPath', () => {
it('should convert string to path', () => {
expect(stringToPath('test')).toEqual(['test']);
expect(stringToPath('[test]]')).toEqual(['test']);
expect(stringToPath('test.test[2].data')).toEqual([
'test',
't... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/validationModeChecker.test.ts | src/__tests__/utils/validationModeChecker.test.ts | import { VALIDATION_MODE } from '../../constants';
import validationModeChecker from '../../logic/getValidationModes';
describe('validationModeChecker', () => {
it('should return correct mode', () => {
expect(validationModeChecker(VALIDATION_MODE.onBlur)).toEqual({
isOnSubmit: false,
isOnBlur: true,
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/insert.test.ts | src/__tests__/utils/insert.test.ts | import insert from '../../utils/insert';
describe('insert', () => {
it('should insert value at specific index in array', () => {
expect(insert([1, 3, 4], 1, 2)).toEqual([1, 2, 3, 4]);
expect(
insert(
[
{
firstName: '1',
lastName: 'Luo',
id: '7530997... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/noop.test.ts | src/__tests__/utils/noop.test.ts | import noop from '../../utils/noop';
describe('noop', () => {
it('should be a function', () => {
expect(noop instanceof Function).toBeTruthy();
});
it('should return undefined', () => {
const result = noop();
expect(result).toBeUndefined();
});
});
| typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/deepMerge.test.ts | src/__tests__/utils/deepMerge.test.ts | import deepMerge from '../../utils/deepMerge';
describe('deepMerge', () => {
it('should deep merge object correctly', () => {
expect(
deepMerge(
{ test: { value: 1, data: { test: 1 } } },
{ test: { value2: 2 } },
),
).toEqual({
test: { value: 1, value2: 2, data: { test: 1 } ... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/fillEmptyArray.test.ts | src/__tests__/utils/fillEmptyArray.test.ts | import fillEmptyArray from '../../utils/fillEmptyArray';
describe('fillEmptyArray', () => {
it('should return an array of undefined or empty array when value is an array', () => {
expect(fillEmptyArray([1])).toEqual([undefined]);
expect(fillEmptyArray([])).toEqual([]);
expect(fillEmptyArray(['2', true]))... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/swap.test.ts | src/__tests__/utils/swap.test.ts | import swap from '../../utils/swap';
describe('swap', () => {
it('should swap value positions', () => {
const test1 = [1, 2, 3, 4];
swap(test1, 1, 2);
expect(test1).toEqual([1, 3, 2, 4]);
const test2 = [
{
firstName: '1',
lastName: 'Luo',
id: '75309979-e340-49eb-8016-5f... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/set.test.ts | src/__tests__/utils/set.test.ts | import set from '../../utils/set';
describe('set', () => {
it('should set the correct values', () => {
const test1 = { a: [{ b: { c: 3 } }] };
set(test1, 'a[0].b.c', 4);
expect(test1.a[0].b.c).toEqual(4);
const test2 = { foo: { bar: 'baz' } };
set(test2, 'foo.arr[0]', 3);
expect(test2).toEqu... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/isUndefined.test.ts | src/__tests__/utils/isUndefined.test.ts | import isUndefined from '../../utils/isUndefined';
describe('isUndefined', () => {
it('should return true when it is an undefined value', () => {
expect(isUndefined(undefined)).toBeTruthy();
});
it('should return false when it is not an undefined value', () => {
expect(isUndefined(null)).toBeFalsy();
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/remove.test.ts | src/__tests__/utils/remove.test.ts | import remove from '../../utils/remove';
describe('remove', () => {
it('should remove item accordingly', () => {
expect(
remove([, , { type: 'required', message: '', ref: 'test' }], 1),
).toEqual([undefined, { type: 'required', message: '', ref: 'test' }]);
expect(
remove([, , { type: 'requi... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/cloneObject.test.ts | src/__tests__/utils/cloneObject.test.ts | import cloneObject from '../../utils/cloneObject';
import noop from '../../utils/noop';
describe('clone', () => {
it('should clone object and not mutate the original object', () => {
const fileData = new File([''], 'filename');
const data: Record<string, any> = {
items: [],
test: {
date: ... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/live.test.ts | src/__tests__/utils/live.test.ts | import type { Ref } from '../../types';
import isHTMLElement from '../../utils/isHTMLElement';
import live from '../../utils/live';
jest.mock('../../utils/isHTMLElement');
const mockIsHTMLElement = isHTMLElement as jest.MockedFunction<
typeof isHTMLElement
>;
describe('live', () => {
afterEach(() => {
jest.r... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/unset.test.ts | src/__tests__/utils/unset.test.ts | import unset from '../../utils/unset';
describe('unset', () => {
it('should unset the array', () => {
const test = ['test', 'test1', 'test2'];
expect(unset(test, '[0]')).toEqual([undefined, 'test1', 'test2']);
expect(unset(test, '[1]')).toEqual([undefined, undefined, 'test2']);
expect(unset(test, '[2... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/createSubject.test.ts | src/__tests__/utils/createSubject.test.ts | import createSubject from '../../utils/createSubject';
describe('createSubject', () => {
it('should subscribe to all the correct observer', () => {
const subject = createSubject();
const next = jest.fn();
subject.subscribe({
next,
});
subject.subscribe({
next,
});
expect(su... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/utils/isPrimitive.test.ts | src/__tests__/utils/isPrimitive.test.ts | import isPrimitive from '../../utils/isPrimitive';
describe('isPrimitive', () => {
it('should return true when value is a string', () => {
expect(isPrimitive('foobar')).toBeTruthy();
});
it('should return true when value is a boolean', () => {
expect(isPrimitive(false)).toBeTruthy();
});
it('should... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/useFieldArray/replace.test.tsx | src/__tests__/useFieldArray/replace.test.tsx | import React from 'react';
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import { VALIDATION_MODE } from '../../constants';
import { useController } from '../../useController';
import { useFieldArray } from '../../useFieldArray';
import { useForm } from '../../useForm';
import { FormProv... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/useFieldArray/prepend.test.tsx | src/__tests__/useFieldArray/prepend.test.tsx | import React from 'react';
import {
act,
fireEvent,
render,
renderHook,
screen,
waitFor,
} from '@testing-library/react';
import { VALIDATION_MODE } from '../../constants';
import type { Control, FieldPath } from '../../types';
import { useController } from '../../useController';
import { useFieldArray } f... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/useFieldArray/update.test.tsx | src/__tests__/useFieldArray/update.test.tsx | import React from 'react';
import {
act,
fireEvent,
render,
renderHook,
screen,
waitFor,
} from '@testing-library/react';
import { VALIDATION_MODE } from '../../constants';
import type { Control } from '../../types';
import { useController } from '../../useController';
import { useFieldArray } from '../../... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/useFieldArray/focus.test.tsx | src/__tests__/useFieldArray/focus.test.tsx | import React from 'react';
import { fireEvent, render, screen } from '@testing-library/react';
import { useFieldArray } from '../../useFieldArray';
import { useForm } from '../../useForm';
import noop from '../../utils/noop';
describe('useFieldArray focus', () => {
it('should not focus any element when shouldFocus ... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/useFieldArray/swap.test.tsx | src/__tests__/useFieldArray/swap.test.tsx | import React from 'react';
import {
act,
fireEvent,
render,
renderHook,
screen,
waitFor,
} from '@testing-library/react';
import { VALIDATION_MODE } from '../../constants';
import { useFieldArray } from '../../useFieldArray';
import { useForm } from '../../useForm';
import noop from '../../utils/noop';
le... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/useFieldArray/move.test.tsx | src/__tests__/useFieldArray/move.test.tsx | import React from 'react';
import {
act,
fireEvent,
render,
renderHook,
screen,
waitFor,
} from '@testing-library/react';
import { VALIDATION_MODE } from '../../constants';
import { useFieldArray } from '../../useFieldArray';
import { useForm } from '../../useForm';
import noop from '../../utils/noop';
le... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/useFieldArray/insert.test.tsx | src/__tests__/useFieldArray/insert.test.tsx | import React from 'react';
import {
act,
fireEvent,
render,
renderHook,
screen,
waitFor,
} from '@testing-library/react';
import { VALIDATION_MODE } from '../../constants';
import type { Control, FieldPath } from '../../types';
import { useController } from '../../useController';
import { useFieldArray } f... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/useFieldArray/remove.test.tsx | src/__tests__/useFieldArray/remove.test.tsx | import React from 'react';
import {
act,
fireEvent,
render,
renderHook,
screen,
waitFor,
} from '@testing-library/react';
import { VALIDATION_MODE } from '../../constants';
import { Controller } from '../../controller';
import type { Control, DeepMap, FieldError } from '../../types';
import { useFieldArray... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | true |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/useFieldArray/append.test.tsx | src/__tests__/useFieldArray/append.test.tsx | import React from 'react';
import {
act,
fireEvent,
render,
renderHook,
screen,
waitFor,
} from '@testing-library/react';
import { VALIDATION_MODE } from '../../constants';
import type { Control, FieldPath } from '../../types';
import { useController } from '../../useController';
import { useFieldArray } f... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/validateField.test.tsx | src/__tests__/logic/validateField.test.tsx | import getCheckboxValue from '../../logic/getCheckboxValue';
import getRadioValue from '../../logic/getRadioValue';
import validateField from '../../logic/validateField';
jest.mock('../../logic/getRadioValue');
jest.mock('../../logic/getCheckboxValue');
describe('validateField', () => {
it('should return required t... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | true |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/getValueAndMessage.test.ts | src/__tests__/logic/getValueAndMessage.test.ts | import getValueAndMessage from '../../logic/getValueAndMessage';
describe('getValueAndMessage', () => {
it('should return message and value correctly', () => {
expect(getValueAndMessage(0).value).toEqual(0);
expect(getValueAndMessage(3).value).toEqual(3);
expect(getValueAndMessage({ value: 0, message: 'w... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/isNameInFieldArray.test.ts | src/__tests__/logic/isNameInFieldArray.test.ts | import isNameInFieldArray from '../../logic/isNameInFieldArray';
describe('isNameInFieldArray', () => {
it('should find match array field', () => {
expect(isNameInFieldArray(new Set(['test']), 'test.0')).toBeTruthy();
expect(isNameInFieldArray(new Set(['te']), 'test.0')).toBeFalsy();
expect(isNameInField... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/schemaErrorLookup.test.ts | src/__tests__/logic/schemaErrorLookup.test.ts | import schemaErrorLookup from '../../logic/schemaErrorLookup';
describe('errorsLookup', () => {
it('should be able to look up the error', () => {
expect(
schemaErrorLookup<{
test: {
deep: string;
};
}>(
{
test: {
type: 'test',
messag... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/isWatched.test.ts | src/__tests__/logic/isWatched.test.ts | import isWatched from '../../logic/isWatched';
describe('isWatched', () => {
it('should return watched fields', () => {
expect(
isWatched('', {
mount: new Set(),
disabled: new Set(),
unMount: new Set(),
array: new Set(),
watch: new Set(),
focus: '',
w... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/getValidateError.test.ts | src/__tests__/logic/getValidateError.test.ts | import getValidateError from '../../logic/getValidateError';
import noop from '../../utils/noop';
describe('getValidateError', () => {
it('should return field error in correct format', () => {
expect(
getValidateError(
'This is a required field',
{
name: 'test1',
value: ... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/createFormControl.test.ts | src/__tests__/logic/createFormControl.test.ts | import { createFormControl } from '../../logic/createFormControl';
import isEmptyObject from '../../utils/isEmptyObject';
jest.mock('../../utils/isEmptyObject', () => {
const original = jest.requireActual('../../utils/isEmptyObject');
return {
__esModule: true,
default: jest.fn(original.default),
};
});
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/shouldSubscribeByName.test.ts | src/__tests__/logic/shouldSubscribeByName.test.ts | import shouldSubscribeByName from '../../logic/shouldSubscribeByName';
describe('shouldSubscribeByName', () => {
it('should return correct response for subscription name coverage', () => {
expect(shouldSubscribeByName(undefined, 'test')).toBeTruthy();
expect(shouldSubscribeByName('test', undefined)).toBeTrut... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/generateId.test.ts | src/__tests__/logic/generateId.test.ts | import generateId from '../../logic/generateId';
describe('generateId', () => {
it('should generate a unique id', () => {
expect(/\w{8}-\w{4}-4\w{3}-\w{4}-\w{12}/i.test(generateId())).toBeTruthy();
});
it('should fallback to performance if crypto is undefined', () => {
Object.defineProperty(window, 'cry... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/getDirtyFields.test.ts | src/__tests__/logic/getDirtyFields.test.ts | import getDirtyFields from '../../logic/getDirtyFields';
describe('getDirtyFields', () => {
it('should return all the dirty fields', () => {
expect(
getDirtyFields(
{},
{
test: {
test1: 'bill',
test2: 'luo',
},
test1: ['1', '2', '3'],
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/getFieldValue.test.ts | src/__tests__/logic/getFieldValue.test.ts | import getFieldValue from '../../logic/getFieldValue';
import type { Field } from '../../types';
jest.mock('../../logic/getRadioValue', () => ({
__esModule: true,
default: () => ({
value: 2,
}),
}));
jest.mock('../../logic/getCheckboxValue', () => ({
__esModule: true,
default: () => ({
value: 'testV... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/iterateFieldsByAction.test.ts | src/__tests__/logic/iterateFieldsByAction.test.ts | import iterateFieldsByAction from '../../logic/iterateFieldsByAction';
describe('iterateFieldsByAction', () => {
it('should focus on the first error it encounter', () => {
const focus = jest.fn();
iterateFieldsByAction(
{
test: {
_f: {
name: 'test',
ref: {
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/getEventValue.test.ts | src/__tests__/logic/getEventValue.test.ts | import getEventValue from '../../logic/getEventValue';
test('getEventValue should return correct value', () => {
expect(
getEventValue({
target: { checked: true, type: 'checkbox' },
}),
).toEqual(true);
expect(
getEventValue({
target: { checked: true, type: 'checkbox', value: 'test' },
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/getFieldValueAs.test.ts | src/__tests__/logic/getFieldValueAs.test.ts | import getFieldValueAs from '../../logic/getFieldValueAs';
describe('getFieldValueAs', () => {
it('should return undefined when value is undefined', () => {
expect(
getFieldValueAs(undefined, {
ref: {
name: 'test',
},
name: 'test',
valueAsNumber: true,
valu... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/getRuleValue.test.ts | src/__tests__/logic/getRuleValue.test.ts | import getRuleValue from '../../logic/getRuleValue';
describe('getRuleValue', () => {
it('should return associated rule value', () => {
expect(getRuleValue('1990/09/09')).toEqual('1990/09/09');
expect(getRuleValue('2')).toEqual('2');
expect(getRuleValue(2)).toEqual(2);
expect(getRuleValue(/test/)).t... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/appendErrors.test.ts | src/__tests__/logic/appendErrors.test.ts | import appendErrors from '../../logic/appendErrors';
describe('appendErrors', () => {
it('should return empty object when validateAllFieldCriteria is false', () => {
const errors = {
test: {
type: 'required',
message: 'test',
},
};
expect(appendErrors('test', false, errors, 'm... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/unsetEmptyArray.test.ts | src/__tests__/logic/unsetEmptyArray.test.ts | import unsetEmptyArray from '../../logic/unsetEmptyArray';
import unset from '../../utils/unset';
jest.mock('../../utils/unset', () => ({
__esModule: true,
default: jest.fn(),
}));
describe('unsetEmptyArray', () => {
const mockedUnset = unset as jest.MockedFunction<typeof unset>;
beforeAll(() => {
mocked... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/getNodeParentName.test.ts | src/__tests__/logic/getNodeParentName.test.ts | import getNodeParentName from '../../logic/getNodeParentName';
describe('getNodeParentName', () => {
it('should return parent name when name is field array', () => {
expect(getNodeParentName('test.0')).toBe('test');
expect(getNodeParentName('test1.1')).toBe('test1');
expect(getNodeParentName('test.0.data... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/getCheckboxValue.test.ts | src/__tests__/logic/getCheckboxValue.test.ts | import getCheckboxValue from '../../logic/getCheckboxValue';
describe('getCheckboxValue', () => {
it('should return default value if not valid or empty options', () => {
expect(getCheckboxValue(undefined)).toEqual({
value: false,
isValid: false,
});
});
it('should return checked value if sin... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/shouldRenderFormState.test.ts | src/__tests__/logic/shouldRenderFormState.test.ts | import shouldRenderFormState from '../../logic/shouldRenderFormState';
import type { ReadFormState } from '../../types';
describe('shouldRenderFormState', () => {
const updateFormState = jest.fn();
beforeEach(() => {
updateFormState.mockClear();
});
it('should return true when formState is Empty', () => ... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/skipValidation.test.ts | src/__tests__/logic/skipValidation.test.ts | import skipValidation from '../../logic/skipValidation';
describe('should skip validation', () => {
it('when is onChange mode and blur event', () => {
expect(
skipValidation(
false,
false,
false,
{
isOnChange: true,
isOnBlur: false,
},
{
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/hasPromiseValidation.test.ts | src/__tests__/logic/hasPromiseValidation.test.ts | import hasPromiseValidation from '../../logic/hasPromiseValidation';
const commonParam = {
mount: true,
name: 'test1',
ref: {
name: 'test1',
value: '',
},
};
describe('hasPromiseValidation', () => {
it('validate option does not exist', () => {
expect(hasPromiseValidation(commonParam)).toEqual(fa... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/getResolverOptions.test.ts | src/__tests__/logic/getResolverOptions.test.ts | import type { InternalFieldName } from '../..';
import getResolverOptions from '../../logic/getResolverOptions';
describe('getFielfs', () => {
it('should return fields from `fieldsNames` and `fieldsRef`', () => {
const fieldNames: Set<InternalFieldName> = new Set(['test.sub', 'test1']);
const fieldsRef: any ... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/getRadioValue.test.ts | src/__tests__/logic/getRadioValue.test.ts | import getRadioValue from '../../logic/getRadioValue';
describe('getRadioValue', () => {
it('should return default value if not valid or empty options', () => {
expect(getRadioValue(undefined)).toEqual({
isValid: false,
value: null,
});
});
it('should return valid to true when value found', ... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/getValidationModes.test.ts | src/__tests__/logic/getValidationModes.test.ts | import { VALIDATION_MODE } from '../../constants';
import getValidationModes from '../../logic/getValidationModes';
describe('getValidationModes', () => {
it('shold return correct flags for each mode', () => {
expect(getValidationModes(VALIDATION_MODE.onBlur)).toEqual({
isOnSubmit: false,
isOnBlur: t... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/hasValidation.test.ts | src/__tests__/logic/hasValidation.test.ts | import hasValidation from '../../logic/hasValidation';
import type { Field } from '../../types';
describe('hasValidation', () => {
it('should return false if mount is not defined', () => {
const noMount = { required: true } as Field['_f'];
expect(hasValidation(noMount)).toBeFalsy();
});
const base = { mo... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/__tests__/logic/getFocusFieldName.test.ts | src/__tests__/logic/getFocusFieldName.test.ts | import getFocusFieldName from '../../logic/getFocusFieldName';
describe('getFocusFieldName', () => {
it('should return expected focus name', () => {
expect(getFocusFieldName('test', 0, { shouldFocus: false })).toEqual('');
expect(
getFocusFieldName('test', 0, { shouldFocus: true, focusName: 'test' }),
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/types/fields.ts | src/types/fields.ts | import type { IsFlatObject, Noop } from './utils';
import type { RegisterOptions } from './validator';
export type InternalFieldName = string;
export type FieldName<TFieldValues extends FieldValues> =
IsFlatObject<TFieldValues> extends true
? Extract<keyof TFieldValues, string>
: string;
export type Custom... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/types/errors.ts | src/types/errors.ts | import type { FieldValues, InternalFieldName, Ref } from './fields';
import type { BrowserNativeObject, IsAny, LiteralUnion, Merge } from './utils';
import type { RegisterOptions, ValidateResult } from './validator';
export type Message = string;
export type MultipleFieldErrors = {
[K in keyof RegisterOptions]?: Va... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/types/controller.ts | src/types/controller.ts | import type React from 'react';
import type {
Control,
FieldError,
FieldPath,
FieldPathValue,
FieldValues,
Noop,
RefCallBack,
UseFormStateReturn,
} from './';
import type { RegisterOptions } from './validator';
export type ControllerFieldState = {
invalid: boolean;
isTouched: boolean;
isDirty: b... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/types/utils.ts | src/types/utils.ts | import type { NestedValue } from './form';
/*
Projects that React Hook Form installed don't include the DOM library need these interfaces to compile.
React Native applications is no DOM available. The JavaScript runtime is ES6/ES2015 only.
These definitions allow such projects to compile with only --lib ES6.
Warning:... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/types/watch.ts | src/types/watch.ts | import type { ReactNode } from 'react';
import type { FieldValues } from './fields';
import type { Control } from './form';
import type { FieldPath, FieldPathValue, FieldPathValues } from './path';
import type { DeepPartialSkipArrayKey } from './utils';
export type UseWatchProps<TFieldValues extends FieldValues = Fie... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/types/fieldArray.ts | src/types/fieldArray.ts | import type { FieldValues } from './fields';
import type { Control } from './form';
import type { FieldArrayPath, FieldArrayPathValue } from './path';
import type { RegisterOptions, Validate } from './validator';
export type UseFieldArrayProps<
TFieldValues extends FieldValues = FieldValues,
TFieldArrayName extend... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/types/resolvers.ts | src/types/resolvers.ts | import type { FieldErrors } from './errors';
import type {
Field,
FieldName,
FieldValues,
InternalFieldName,
} from './fields';
import type { CriteriaMode } from './form';
export type ResolverSuccess<TTransformedValues> = {
values: TTransformedValues;
errors: Record<string, never>;
};
export type Resolver... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/types/form.ts | src/types/form.ts | import type React from 'react';
import type { VALIDATION_MODE } from '../constants';
import type { Subject, Subscription } from '../utils/createSubject';
import type { ErrorOption, FieldError, FieldErrors } from './errors';
import type { EventType } from './events';
import type { FieldArray } from './fieldArray';
imp... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/types/validator.ts | src/types/validator.ts | import type { INPUT_VALIDATION_RULES } from '../constants';
import type { Message } from './errors';
import type { FieldValues } from './fields';
import type { FieldPath, FieldPathValue } from './path';
export type ValidationValue = boolean | number | string | RegExp;
export type ValidationRule<
TValidationValue e... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/types/index.ts | src/types/index.ts | export * from './controller';
export * from './errors';
export * from './events';
export * from './fieldArray';
export * from './fields';
export * from './form';
export * from './path';
export * from './resolvers';
export * from './utils';
export * from './validator';
export * from './watch';
| typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/types/events.ts | src/types/events.ts | export type EventType =
| 'focus'
| 'blur'
| 'change'
| 'changeText'
| 'valueChange'
| 'contentSizeChange'
| 'endEditing'
| 'keyPress'
| 'submitEditing'
| 'layout'
| 'selectionChange'
| 'longPress'
| 'press'
| 'pressIn'
| 'pressOut'
| 'momentumScrollBegin'
| 'momentumScrollEnd'
| 'sc... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/types/path/common.ts | src/types/path/common.ts | import type { IsAny, IsNever } from '../utils';
/**
* Type alias to `string` which describes a lodash-like path through an object.
* E.g. `'foo.bar.0.baz'`
*/
export type PathString = string;
/**
* Type which can be traversed through with a {@link PathString}.
* I.e. objects, arrays, and tuples
*/
export type T... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/types/path/eager.ts | src/types/path/eager.ts | import type { FieldValues } from '../fields';
import type { BrowserNativeObject, IsAny, IsEqual, Primitive } from '../utils';
import type { ArrayKey, IsTuple, TupleKeys } from './common';
/**
* Helper function to break apart T1 and check if any are equal to T2
*
* See {@link IsEqual}
*/
type AnyIsEqual<T1, T2> = ... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/types/path/index.ts | src/types/path/index.ts | /** Re-export public API */
export { PathString } from './common';
export {
ArrayPath,
FieldArrayPath,
FieldArrayPathByValue,
FieldArrayPathValue,
FieldPath,
FieldPathByValue,
FieldPathValue,
FieldPathValues,
Path,
PathValue,
} from './eager';
| typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/schemaErrorLookup.ts | src/logic/schemaErrorLookup.ts | import type { FieldError, FieldErrors, FieldValues } from '../types';
import get from '../utils/get';
import isKey from '../utils/isKey';
export default function schemaErrorLookup<T extends FieldValues = FieldValues>(
errors: FieldErrors<T>,
_fields: FieldValues,
name: string,
): {
error?: FieldError;
name: ... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/getValidateError.ts | src/logic/getValidateError.ts | import type { FieldError, Ref, ValidateResult } from '../types';
import isBoolean from '../utils/isBoolean';
import isString from '../utils/isString';
export default function getValidateError(
result: ValidateResult,
ref: Ref,
type = 'validate',
): FieldError | void {
if (
isString(result) ||
(Array.is... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/getFieldValue.ts | src/logic/getFieldValue.ts | import type { Field } from '../types';
import isCheckBox from '../utils/isCheckBoxInput';
import isFileInput from '../utils/isFileInput';
import isMultipleSelect from '../utils/isMultipleSelect';
import isRadioInput from '../utils/isRadioInput';
import isUndefined from '../utils/isUndefined';
import getCheckboxValue f... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/getNodeParentName.ts | src/logic/getNodeParentName.ts | export default (name: string) =>
name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
| typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/getProxyFormState.ts | src/logic/getProxyFormState.ts | import { VALIDATION_MODE } from '../constants';
import type { Control, FieldValues, FormState, ReadFormState } from '../types';
export default <
TFieldValues extends FieldValues,
TContext = any,
TTransformedValues = TFieldValues,
>(
formState: FormState<TFieldValues>,
control: Control<TFieldValues, TContext,... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/hasPromiseValidation.ts | src/logic/hasPromiseValidation.ts | 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.val... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/hasValidation.ts | src/logic/hasValidation.ts | import type { Field } from '../types';
export default (options: Field['_f']) =>
options.mount &&
(options.required ||
options.min ||
options.max ||
options.maxLength ||
options.minLength ||
options.pattern ||
options.validate);
| typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/createFormControl.ts | src/logic/createFormControl.ts | import { EVENTS, VALIDATION_MODE } from '../constants';
import type {
BatchFieldArrayUpdate,
ChangeHandler,
Control,
DeepPartial,
DelayCallback,
EventType,
Field,
FieldError,
FieldErrors,
FieldNamesMarkedBoolean,
FieldPath,
FieldRefs,
FieldValues,
FormState,
FromSubscribe,
GetIsDirty,
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | true |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/appendErrors.ts | src/logic/appendErrors.ts | import type {
InternalFieldErrors,
InternalFieldName,
ValidateResult,
} from '../types';
export default (
name: InternalFieldName,
validateAllFieldCriteria: boolean,
errors: InternalFieldErrors,
type: string,
message: ValidateResult,
) =>
validateAllFieldCriteria
? {
...errors[name],
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/getFocusFieldName.ts | src/logic/getFocusFieldName.ts | import type { FieldArrayMethodProps, InternalFieldName } from '../types';
import isUndefined from '../utils/isUndefined';
export default (
name: InternalFieldName,
index: number,
options: FieldArrayMethodProps = {},
): string =>
options.shouldFocus || isUndefined(options.shouldFocus)
? options.focusName ||... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/getFieldValueAs.ts | src/logic/getFieldValueAs.ts | import type { Field, NativeFieldValue } from '../types';
import isString from '../utils/isString';
import isUndefined from '../utils/isUndefined';
export default <T extends NativeFieldValue>(
value: T,
{ valueAsNumber, valueAsDate, setValueAs }: Field['_f'],
) =>
isUndefined(value)
? value
: valueAsNumbe... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/getRadioValue.ts | src/logic/getRadioValue.ts | type RadioFieldResult = {
isValid: boolean;
value: number | string | null;
};
const defaultReturn: RadioFieldResult = {
isValid: false,
value: null,
};
export default (options?: HTMLInputElement[]): RadioFieldResult =>
Array.isArray(options)
? options.reduce(
(previous, option): RadioFieldResult... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/unsetEmptyArray.ts | src/logic/unsetEmptyArray.ts | import compact from '../utils/compact';
import get from '../utils/get';
import unset from '../utils/unset';
export default <T>(ref: T, name: string) =>
!compact(get(ref, name)).length && unset(ref, name);
| typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/updateFieldArrayRootError.ts | src/logic/updateFieldArrayRootError.ts | import type {
FieldError,
FieldErrors,
FieldValues,
InternalFieldName,
} from '../types';
import convertToArrayPayload from '../utils/convertToArrayPayload';
import get from '../utils/get';
import set from '../utils/set';
export default <T extends FieldValues = FieldValues>(
errors: FieldErrors<T>,
error: ... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/isNameInFieldArray.ts | src/logic/isNameInFieldArray.ts | import type { InternalFieldName } from '../types';
import getNodeParentName from './getNodeParentName';
export default (names: Set<InternalFieldName>, name: InternalFieldName) =>
names.has(getNodeParentName(name));
| typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/validateField.ts | src/logic/validateField.ts | import { INPUT_VALIDATION_RULES } from '../constants';
import type {
Field,
FieldError,
FieldValues,
InternalFieldErrors,
InternalNameSet,
MaxType,
Message,
MinType,
NativeFieldValue,
} from '../types';
import get from '../utils/get';
import isBoolean from '../utils/isBoolean';
import isCheckBoxInput ... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/shouldSubscribeByName.ts | src/logic/shouldSubscribeByName.ts | import convertToArrayPayload from '../utils/convertToArrayPayload';
export default <T extends string | readonly string[] | undefined>(
name?: T,
signalName?: string,
exact?: boolean,
) =>
!name ||
!signalName ||
name === signalName ||
convertToArrayPayload(name).some(
(currentName) =>
currentNa... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/getRuleValue.ts | src/logic/getRuleValue.ts | import type {
ValidationRule,
ValidationValue,
ValidationValueMessage,
} from '../types';
import isObject from '../utils/isObject';
import isRegex from '../utils/isRegex';
import isUndefined from '../utils/isUndefined';
export default <T extends ValidationValue>(
rule?: ValidationRule<T> | ValidationValueMessa... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/generateId.ts | src/logic/generateId.ts | export default () => {
if (typeof crypto !== 'undefined' && crypto.randomUUID) {
return crypto.randomUUID();
}
const d =
typeof performance === 'undefined' ? Date.now() : performance.now() * 1000;
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
const r = ((Math.random() * 1... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/isWatched.ts | src/logic/isWatched.ts | import type { InternalFieldName, Names } from '../types';
export default (
name: InternalFieldName,
_names: Names,
isBlurEvent?: boolean,
) =>
!isBlurEvent &&
(_names.watchAll ||
_names.watch.has(name) ||
[..._names.watch].some(
(watchName) =>
name.startsWith(watchName) &&
/^\.\... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/getResolverOptions.ts | src/logic/getResolverOptions.ts | 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,
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/getEventValue.ts | src/logic/getEventValue.ts | import isCheckBoxInput from '../utils/isCheckBoxInput';
import isObject from '../utils/isObject';
type Event = { target: any };
export default (event: unknown) =>
isObject(event) && (event as Event).target
? isCheckBoxInput((event as Event).target)
? (event as Event).target.checked
: (event as Event... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/skipValidation.ts | src/logic/skipValidation.ts | 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 (!isSubmi... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/getValueAndMessage.ts | src/logic/getValueAndMessage.ts | import type { ValidationRule } from '../types';
import isObject from '../utils/isObject';
import isRegex from '../utils/isRegex';
export default (validationData?: ValidationRule) =>
isObject(validationData) && !isRegex(validationData)
? validationData
: {
value: validationData,
message: '',
... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/index.ts | src/logic/index.ts | import appendErrors from './appendErrors';
import { createFormControl } from './createFormControl';
export { appendErrors, createFormControl };
| typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/generateWatchOutput.ts | src/logic/generateWatchOutput.ts | import type { DeepPartial, FieldValues, Names } from '../types';
import get from '../utils/get';
import isString from '../utils/isString';
export default <T>(
names: string | string[] | undefined,
_names: Names,
formValues?: FieldValues,
isGlobal?: boolean,
defaultValue?: DeepPartial<T> | unknown,
) => {
i... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
react-hook-form/react-hook-form | https://github.com/react-hook-form/react-hook-form/blob/a084dcb8597d5fb872ef54c0e8425133d490a711/src/logic/iterateFieldsByAction.ts | src/logic/iterateFieldsByAction.ts | import type { FieldRefs, InternalFieldName, Ref } from '../types';
import { get } from '../utils';
import isObject from '../utils/isObject';
const iterateFieldsByAction = (
fields: FieldRefs,
action: (ref: Ref, name: string) => 1 | undefined | void,
fieldsNames?: Set<InternalFieldName> | InternalFieldName[] | 0,... | typescript | MIT | a084dcb8597d5fb872ef54c0e8425133d490a711 | 2026-01-04T15:43:31.044549Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.