Download next.js/packages/next/src/shared/lib/is-plain-object.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 674 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/shared/lib/is-plain-object.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/packages/next/src/shared/lib/is-plain-object.ts
-
curl -L -o is-plain-object.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/shared/lib/is-plain-object.ts
674 Bytes
| export function getObjectClassLabel(value: any): string { | |
| return Object.prototype.toString.call(value) | |
| } | |
| export function isPlainObject(value: any): boolean { | |
| if (getObjectClassLabel(value) !== '[object Object]') { | |
| return false | |
| } | |
| const prototype = Object.getPrototypeOf(value) | |
| /** | |
| * this used to be previously: | |
| * | |
| * `return prototype === null || prototype === Object.prototype` | |
| * | |
| * but Edge Runtime expose Object from vm, being that kind of type-checking wrongly fail. | |
| * | |
| * It was changed to the current implementation since it's resilient to serialization. | |
| */ | |
| return prototype === null || prototype.hasOwnProperty('isPrototypeOf') | |
| } | |