Download react-hook-form/src/__tests__/isPlainObject.test.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 813 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/__tests__/isPlainObject.test.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/__tests__/isPlainObject.test.ts
-
curl -L -o isPlainObject.test.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/__tests__/isPlainObject.test.ts
813 Bytes
| import isPlainObject from '../utils/isPlainObject'; | |
| import noop from '../utils/noop'; | |
| describe('isPlainObject', function () { | |
| it('should identify plan object or not', function () { | |
| function test() { | |
| return { | |
| test: noop, | |
| }; | |
| } | |
| expect(isPlainObject(Object.create({}))).toBeTruthy(); | |
| expect(isPlainObject(Object.create(Object.prototype))).toBeTruthy(); | |
| expect(isPlainObject({ foo: 'bar' })).toBeTruthy(); | |
| expect(isPlainObject({})).toBeTruthy(); | |
| expect(isPlainObject(Object.create(null))).toBeFalsy(); | |
| expect(!isPlainObject(/foo/)).toBeTruthy(); | |
| expect(!isPlainObject(function () {})).toBeTruthy(); | |
| expect(!isPlainObject(['foo', 'bar'])).toBeTruthy(); | |
| expect(!isPlainObject([])).toBeTruthy(); | |
| expect(!isPlainObject(test)).toBeTruthy(); | |
| }); | |
| }); | |