Home / Function/ test() — react Function Reference

test() — react Function Reference

Architecture documentation for the test() function in treeContextStateSerializer.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  dbabdf40_38df_fa45_48d6_5ca0b61d7390["test()"]
  6368f317_a2ff_596b_8cb4_4dbf63d3f81e["treeContextStateSerializer.js"]
  dbabdf40_38df_fa45_48d6_5ca0b61d7390 -->|defined in| 6368f317_a2ff_596b_8cb4_4dbf63d3f81e
  style dbabdf40_38df_fa45_48d6_5ca0b61d7390 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/__tests__/__serializers__/treeContextStateSerializer.js lines 4–16

export function test(maybeState) {
  if (maybeState === null || typeof maybeState !== 'object') {
    return false;
  }

  const hasOwnProperty = Object.prototype.hasOwnProperty.bind(maybeState);
  // Duck typing at its finest.
  return (
    hasOwnProperty('inspectedElementID') &&
    hasOwnProperty('ownerFlatTree') &&
    hasOwnProperty('ownerSubtreeLeafElementID')
  );
}

Domain

Subdomains

Frequently Asked Questions

What does test() do?
test() is a function in the react codebase, defined in packages/react-devtools-shared/src/__tests__/__serializers__/treeContextStateSerializer.js.
Where is test() defined?
test() is defined in packages/react-devtools-shared/src/__tests__/__serializers__/treeContextStateSerializer.js at line 4.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free