We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ee699c0 commit 56fcc69Copy full SHA for 56fcc69
packages/react-devtools-shared/src/__tests__/treeContextStateSerializer.js
@@ -2,11 +2,13 @@ import {printStore} from 'react-devtools-shared/src/devtools/utils';
2
3
// test() is part of Jest's serializer API
4
export function test(maybeState) {
5
+ if (maybeState === null || typeof maybeState !== 'object') {
6
+ return false;
7
+ }
8
+
9
const hasOwnProperty = Object.prototype.hasOwnProperty.bind(maybeState);
10
// Duck typing at its finest.
11
return (
- maybeState !== null &&
- typeof maybeState === 'object' &&
12
hasOwnProperty('inspectedElementID') &&
13
hasOwnProperty('ownerFlatTree') &&
14
hasOwnProperty('ownerSubtreeLeafElementID')
0 commit comments