(object: any)
| 64 | } |
| 65 | |
| 66 | export function isSimpleObject(object: any): boolean { |
| 67 | if (!isObjectPrototype(getPrototypeOf(object))) { |
| 68 | return false; |
| 69 | } |
| 70 | const names = Object.getOwnPropertyNames(object); |
| 71 | for (let i = 0; i < names.length; i++) { |
| 72 | const descriptor = Object.getOwnPropertyDescriptor(object, names[i]); |
| 73 | if (!descriptor) { |
| 74 | return false; |
| 75 | } |
| 76 | if (!descriptor.enumerable) { |
| 77 | if ( |
| 78 | (names[i] === 'key' || names[i] === 'ref') && |
| 79 | typeof descriptor.get === 'function' |
| 80 | ) { |
| 81 | // React adds key and ref getters to props objects to issue warnings. |
| 82 | // Those getters will not be transferred to the client, but that's ok, |
| 83 | // so we'll special case them. |
| 84 | continue; |
| 85 | } |
| 86 | return false; |
| 87 | } |
| 88 | } |
| 89 | return true; |
| 90 | } |
| 91 | |
| 92 | export function objectName(object: mixed): string { |
| 93 | // $FlowFixMe[method-unbinding] |
no test coverage detected