( obj: Object, )
| 109 | } |
| 110 | |
| 111 | export function getAllEnumerableKeys( |
| 112 | obj: Object, |
| 113 | ): Set<string | number | symbol> { |
| 114 | const keys = new Set<string | number | symbol>(); |
| 115 | let current = obj; |
| 116 | while (current != null) { |
| 117 | const currentKeys = [ |
| 118 | ...Object.keys(current), |
| 119 | ...Object.getOwnPropertySymbols(current), |
| 120 | ]; |
| 121 | const descriptors = Object.getOwnPropertyDescriptors(current); |
| 122 | currentKeys.forEach(key => { |
| 123 | // $FlowFixMe[incompatible-type]: key can be a Symbol https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor |
| 124 | if (descriptors[key].enumerable) { |
| 125 | keys.add(key); |
| 126 | } |
| 127 | }); |
| 128 | current = Object.getPrototypeOf(current); |
| 129 | } |
| 130 | return keys; |
| 131 | } |
| 132 | |
| 133 | // Mirror https://github.com/facebook/react/blob/7c21bf72ace77094fd1910cc350a548287ef8350/packages/shared/getComponentName.js#L27-L37 |
| 134 | export function getWrappedDisplayName( |
no test coverage detected