Home / File/ inspectedElementSerializer.js — react Source File

inspectedElementSerializer.js — react Source File

Architecture documentation for inspectedElementSerializer.js, a javascript file in the react codebase.

Entity Profile

Relationship Graph

Source Code

// `test` is part of Jest's serializer API
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')
  );
}

// print() is part of Jest's serializer API
export function print(inspectedElement, serialize, indent) {
  // Don't stringify this object; that would break nested serializers.
  return serialize({
    context: inspectedElement.context,
    events: inspectedElement.events,
    hooks: inspectedElement.hooks,
    id: inspectedElement.id,
    owners: inspectedElement.owners,
    props: inspectedElement.props,
    rootType: inspectedElement.rootType,
    state: inspectedElement.state,
  });
}

Domain

Subdomains

Functions

Frequently Asked Questions

What does inspectedElementSerializer.js do?
inspectedElementSerializer.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in inspectedElementSerializer.js?
inspectedElementSerializer.js defines 2 function(s): print, test.
Where is inspectedElementSerializer.js in the architecture?
inspectedElementSerializer.js is located at packages/react-devtools-shared/src/__tests__/__serializers__/inspectedElementSerializer.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/__tests__/__serializers__).

Analyze Your Own Codebase

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

Try Supermodel Free