Home / Function/ test() — react Function Reference

test() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  e13cf5e4_965d_8faf_cbba_2721c0e8d798["test()"]
  1fad50d2_f15a_f358_f6f3_354fa6f86a6d["inspectedElementSerializer.js"]
  e13cf5e4_965d_8faf_cbba_2721c0e8d798 -->|defined in| 1fad50d2_f15a_f358_f6f3_354fa6f86a6d
  style e13cf5e4_965d_8faf_cbba_2721c0e8d798 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/__tests__/__serializers__/inspectedElementSerializer.js lines 2–20

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

  const hasOwnProperty = Object.prototype.hasOwnProperty.bind(
    maybeInspectedElement,
  );

  return (
    hasOwnProperty('canEditFunctionProps') &&
    hasOwnProperty('canEditHooks') &&
    hasOwnProperty('canToggleSuspense') &&
    hasOwnProperty('canToggleError')
  );
}

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__/inspectedElementSerializer.js.
Where is test() defined?
test() is defined in packages/react-devtools-shared/src/__tests__/__serializers__/inspectedElementSerializer.js at line 2.

Analyze Your Own Codebase

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

Try Supermodel Free