MCPcopy
hub / github.com/facebook/react / isObjectPrototype

Function isObjectPrototype

packages/shared/ReactSerializationErrors.js:32–52  ·  view source on GitHub ↗
(object: any)

Source from the content-addressed store, hash-verified

30export const jsxChildrenParents: WeakMap<any, any> = new WeakMap();
31
32function isObjectPrototype(object: any): boolean {
33 if (!object) {
34 return false;
35 }
36 const ObjectPrototype = Object.prototype;
37 if (object === ObjectPrototype) {
38 return true;
39 }
40 // It might be an object from a different Realm which is
41 // still just a plain simple object.
42 if (getPrototypeOf(object)) {
43 return false;
44 }
45 const names = Object.getOwnPropertyNames(object);
46 for (let i = 0; i < names.length; i++) {
47 if (!(names[i] in ObjectPrototype)) {
48 return false;
49 }
50 }
51 return true;
52}
53
54export function isGetter(object: any, name: string): boolean {
55 const ObjectPrototype = Object.prototype;

Callers 1

isSimpleObjectFunction · 0.85

Calls 1

getPrototypeOfFunction · 0.50

Tested by

no test coverage detected