Download react-hook-form/src/__tests__/utils/isPrimitive.test.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 967 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/__tests__/utils/isPrimitive.test.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/__tests__/utils/isPrimitive.test.ts
-
curl -L -o isPrimitive.test.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/__tests__/utils/isPrimitive.test.ts
967 Bytes
| 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 return true when value is a number', () => { | |
| expect(isPrimitive(123)).toBeTruthy(); | |
| }); | |
| it('should return true when value is a symbol', () => { | |
| expect(isPrimitive(Symbol())).toBeTruthy(); | |
| }); | |
| it('should return true when value is null', () => { | |
| expect(isPrimitive(null)).toBeTruthy(); | |
| }); | |
| it('should return true when value is undefined', () => { | |
| expect(isPrimitive(undefined)).toBeTruthy(); | |
| }); | |
| it('should return false when value is an object', () => { | |
| expect(isPrimitive({})).toBeFalsy(); | |
| }); | |
| it('should return false when value is an array', () => { | |
| expect(isPrimitive([])).toBeFalsy(); | |
| }); | |
| }); | |