Home / File/ utils.js — react Source File

utils.js — react Source File

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

Entity Profile

Dependency Diagram

graph LR
  7a30ca2b_8808_58b2_56bc_12441f27a1e1["utils.js"]
  276bc34e_3008_101e_3cd7_cc895fcd3848["KeyValue.js"]
  276bc34e_3008_101e_3cd7_cc895fcd3848 --> 7a30ca2b_8808_58b2_56bc_12441f27a1e1
  bb770434_43dc_71aa_77ec_098236a83413["NewArrayValue.js"]
  bb770434_43dc_71aa_77ec_098236a83413 --> 7a30ca2b_8808_58b2_56bc_12441f27a1e1
  0e638bf4_827b_30d0_21d6_77d4d615d353["NewKeyValue.js"]
  0e638bf4_827b_30d0_21d6_77d4d615d353 --> 7a30ca2b_8808_58b2_56bc_12441f27a1e1
  style 7a30ca2b_8808_58b2_56bc_12441f27a1e1 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
 */

/**
 * Converts nested hooks paths to the format expected by the backend.
 * e.g. [''] => ['']
 * e.g. [1, 'value', ...] => [...]
 * e.g. [2, 'subhooks', 1, 'value', ...] => [...]
 * e.g. [1, 'subhooks', 3, 'subhooks', 2, 'value', ...] => [...]
 */
export function parseHookPathForEdit(
  path: Array<string | number>,
): Array<string | number> {
  let index = 0;
  for (let i = 0; i < path.length; i++) {
    if (path[i] === 'value') {
      index = i + 1;
      break;
    }
  }
  return path.slice(index);
}

Domain

Frequently Asked Questions

What does utils.js do?
utils.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What files import utils.js?
utils.js is imported by 3 file(s): KeyValue.js, NewArrayValue.js, NewKeyValue.js.
Where is utils.js in the architecture?
utils.js is located at packages/react-devtools-shared/src/devtools/views/Components/utils.js (domain: BabelCompiler, directory: packages/react-devtools-shared/src/devtools/views/Components).

Analyze Your Own Codebase

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

Try Supermodel Free