Home / Function/ unbadgeConsole() — react Function Reference

unbadgeConsole() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  928365e8_4c52_6cbf_3480_833559500f11["unbadgeConsole()"]
  41e6fe58_7fdb_3ecd_4204_da8170db7e8c["ReactServerConsoleConfigServer.js"]
  928365e8_4c52_6cbf_3480_833559500f11 -->|defined in| 41e6fe58_7fdb_3ecd_4204_da8170db7e8c
  style 928365e8_4c52_6cbf_3480_833559500f11 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-server/src/ReactServerConsoleConfigServer.js lines 26–65

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 style = args[offset + 1];
  const badge = args[offset + 2];
  if (
    typeof format === 'string' &&
    format.startsWith(badgeFormat) &&
    style === badgeStyle &&
    typeof badge === 'string'
  ) {
    // 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/ReactServerConsoleConfigServer.js.
Where is unbadgeConsole() defined?
unbadgeConsole() is defined in packages/react-server/src/ReactServerConsoleConfigServer.js at line 26.

Analyze Your Own Codebase

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

Try Supermodel Free