Download react-hook-form/src/__tests__/utils/isFunction.test.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 696 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/__tests__/utils/isFunction.test.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/__tests__/utils/isFunction.test.ts
-
curl -L -o isFunction.test.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/__tests__/utils/isFunction.test.ts
696 Bytes
| import isFunction from '../../utils/isFunction'; | |
| describe('isFunction', () => { | |
| it('should return true when value is a function', () => { | |
| expect(isFunction(() => null)).toBeTruthy(); | |
| expect( | |
| isFunction(function foo() { | |
| return null; | |
| }), | |
| ).toBeTruthy(); | |
| }); | |
| it('should return false when value is not a function', () => { | |
| expect(isFunction(null)).toBeFalsy(); | |
| expect(isFunction(undefined)).toBeFalsy(); | |
| expect(isFunction(-1)).toBeFalsy(); | |
| expect(isFunction(0)).toBeFalsy(); | |
| expect(isFunction(1)).toBeFalsy(); | |
| expect(isFunction('')).toBeFalsy(); | |
| expect(isFunction({})).toBeFalsy(); | |
| expect(isFunction([])).toBeFalsy(); | |
| }); | |
| }); | |