Home / Function/ unbadgeConsole() — react Function Reference

unbadgeConsole() — react Function Reference

Architecture documentation for the unbadgeConsole() function in ReactServerConsoleConfigPlain.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  4bdbb750_a06a_6e8e_10d3_e13c90eb6161["unbadgeConsole()"]
  0f113a58_2b86_7232_e9e3_6df572efc0b7["ReactServerConsoleConfigPlain.js"]
  4bdbb750_a06a_6e8e_10d3_e13c90eb6161 -->|defined in| 0f113a58_2b86_7232_e9e3_6df572efc0b7
  style 4bdbb750_a06a_6e8e_10d3_e13c90eb6161 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-server/src/ReactServerConsoleConfigPlain.js lines 18–57

export function unbadgeConsole(
  methodName: string,
  args: Array<any>,
): null | string {
  let offset = 0;
  switch (methodName) {
    case 'dir':
    case 'dirxml':
    case 'groupEnd':
    case 'table': {
      // These methods cannot be colorized because they don't take a formatting string.
      // So we wouldn't have added any badge in the first place.
      // $FlowFixMe
      return null;
    }
    case 'assert': {
      // assert takes formatting options as the second argument.
      offset = 1;
    }
  }
  const format = args[offset];
  const badge = args[offset + 1];
  if (
    typeof format === 'string' &&
    format.startsWith(badgeFormat) &&
    typeof badge === 'string' &&
    badge.startsWith(pad) &&
    badge.endsWith(pad)
  ) {
    // Remove our badging from the arguments.
    let unbadgedFormat = format.slice(badgeFormat.length);
    if (unbadgedFormat[0] === ' ') {
      // Spacing added on the Client if the original argument was a string.
      unbadgedFormat = unbadgedFormat.slice(1);
    }
    args.splice(offset, 4, unbadgedFormat);
    return badge.slice(padLength, badge.length - padLength);
  }
  return null;
}

Domain

Subdomains

Frequently Asked Questions

What does unbadgeConsole() do?
unbadgeConsole() is a function in the react codebase, defined in packages/react-server/src/ReactServerConsoleConfigPlain.js.
Where is unbadgeConsole() defined?
unbadgeConsole() is defined in packages/react-server/src/ReactServerConsoleConfigPlain.js at line 18.

Analyze Your Own Codebase

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

Try Supermodel Free