Home / File/ invertObject.js — react Source File

invertObject.js — react Source File

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

Entity Profile

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.
 */
'use strict';

/**
 * turns
 *   { 'MUCH ERROR': '0', 'SUCH WRONG': '1' }
 * into
 *   { 0: 'MUCH ERROR', 1: 'SUCH WRONG' }
 */
function invertObject(targetObj) {
  const result = {};
  const mapKeys = Object.keys(targetObj);

  // eslint-disable-next-line no-for-of-loops/no-for-of-loops
  for (const originalKey of mapKeys) {
    const originalVal = targetObj[originalKey];

    result[originalVal] = originalKey;
  }

  return result;
}

module.exports = invertObject;

Domain

Subdomains

Functions

Frequently Asked Questions

What does invertObject.js do?
invertObject.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 invertObject.js?
invertObject.js defines 1 function(s): invertObject.
Where is invertObject.js in the architecture?
invertObject.js is located at scripts/error-codes/invertObject.js (domain: BabelCompiler, subdomain: Entrypoint, directory: scripts/error-codes).

Analyze Your Own Codebase

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

Try Supermodel Free