Home / File/ ReactPerformanceTrackProperties.js — react Source File

ReactPerformanceTrackProperties.js — react Source File

Architecture documentation for ReactPerformanceTrackProperties.js, a javascript file in the react codebase. 6 imports, 0 dependents.

File javascript BabelCompiler Entrypoint 6 imports 4 functions

Entity Profile

Dependency Diagram

graph LR
  b0d758a8_615d_45ad_e2e2_843278426960["ReactPerformanceTrackProperties.js"]
  83d2fbad_2242_aa75_e397_ad184684aed6["ReactSymbols.js"]
  b0d758a8_615d_45ad_e2e2_843278426960 --> 83d2fbad_2242_aa75_e397_ad184684aed6
  d1749588_72f0_305a_3ea3_ab196eddbd95["getComponentNameFromType.js"]
  b0d758a8_615d_45ad_e2e2_843278426960 --> d1749588_72f0_305a_3ea3_ab196eddbd95
  90949571_0369_6d18_87d7_7e2130ff7bfd["getComponentNameFromType"]
  b0d758a8_615d_45ad_e2e2_843278426960 --> 90949571_0369_6d18_87d7_7e2130ff7bfd
  407a8b5c_b84a_7618_4260_d16128394f0e["ReactFlightPropertyAccess"]
  b0d758a8_615d_45ad_e2e2_843278426960 --> 407a8b5c_b84a_7618_4260_d16128394f0e
  a413acd5_7541_e904_f255_d4dd9b5e5bc1["hasOwnProperty"]
  b0d758a8_615d_45ad_e2e2_843278426960 --> a413acd5_7541_e904_f255_d4dd9b5e5bc1
  af78c51d_c7cb_3bf4_550f_f3fcc48f4f34["isArray"]
  b0d758a8_615d_45ad_e2e2_843278426960 --> af78c51d_c7cb_3bf4_550f_f3fcc48f4f34
  style b0d758a8_615d_45ad_e2e2_843278426960 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

import {OMITTED_PROP_ERROR} from 'shared/ReactFlightPropertyAccess';

import hasOwnProperty from 'shared/hasOwnProperty';
import isArray from 'shared/isArray';
import {REACT_ELEMENT_TYPE} from './ReactSymbols';
import getComponentNameFromType from './getComponentNameFromType';

const EMPTY_ARRAY = 0;
const COMPLEX_ARRAY = 1;
const PRIMITIVE_ARRAY = 2; // Primitive values only that are accepted by JSON.stringify
const ENTRIES_ARRAY = 3; // Tuple arrays of string and value (like Headers, Map, etc)

// Showing wider objects in the devtools is not useful.
const OBJECT_WIDTH_LIMIT = 100;

function getArrayKind(array: Object): 0 | 1 | 2 | 3 {
  let kind: 0 | 1 | 2 | 3 = EMPTY_ARRAY;
  for (let i = 0; i < array.length && i < OBJECT_WIDTH_LIMIT; i++) {
    const value = array[i];
    if (typeof value === 'object' && value !== null) {
      if (
        isArray(value) &&
        value.length === 2 &&
        typeof value[0] === 'string'
      ) {
        // Key value tuple
        if (kind !== EMPTY_ARRAY && kind !== ENTRIES_ARRAY) {
          return COMPLEX_ARRAY;
        }
        kind = ENTRIES_ARRAY;
      } else {
        return COMPLEX_ARRAY;
      }
    } else if (typeof value === 'function') {
      return COMPLEX_ARRAY;
    } else if (typeof value === 'string' && value.length > 50) {
      return COMPLEX_ARRAY;
    } else if (kind !== EMPTY_ARRAY && kind !== PRIMITIVE_ARRAY) {
      return COMPLEX_ARRAY;
    } else if (typeof value === 'bigint') {
      return COMPLEX_ARRAY;
    } else {
      kind = PRIMITIVE_ARRAY;
    }
  }
  return kind;
}

export function addObjectToProperties(
  object: Object,
  properties: Array<[string, string]>,
// ... (394 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does ReactPerformanceTrackProperties.js do?
ReactPerformanceTrackProperties.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Entrypoint subdomain.
What functions are defined in ReactPerformanceTrackProperties.js?
ReactPerformanceTrackProperties.js defines 4 function(s): addObjectDiffToProperties, addObjectToProperties, addValueToProperties, readReactElementTypeof.
What does ReactPerformanceTrackProperties.js depend on?
ReactPerformanceTrackProperties.js imports 6 module(s): ReactFlightPropertyAccess, ReactSymbols.js, getComponentNameFromType, getComponentNameFromType.js, hasOwnProperty, isArray.
Where is ReactPerformanceTrackProperties.js in the architecture?
ReactPerformanceTrackProperties.js is located at packages/shared/ReactPerformanceTrackProperties.js (domain: BabelCompiler, subdomain: Entrypoint, directory: packages/shared).

Analyze Your Own Codebase

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

Try Supermodel Free