unbadgeConsole() — react Function Reference
Architecture documentation for the unbadgeConsole() function in ReactServerConsoleConfigBrowser.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD f3105817_b9ae_ec2d_1d6c_f485fdff1b5e["unbadgeConsole()"] 31590b87_bba3_c3e2_cef3_6745ff5d458b["ReactServerConsoleConfigBrowser.js"] f3105817_b9ae_ec2d_1d6c_f485fdff1b5e -->|defined in| 31590b87_bba3_c3e2_cef3_6745ff5d458b style f3105817_b9ae_ec2d_1d6c_f485fdff1b5e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-server/src/ReactServerConsoleConfigBrowser.js lines 27–66
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
Source
Frequently Asked Questions
What does unbadgeConsole() do?
unbadgeConsole() is a function in the react codebase, defined in packages/react-server/src/ReactServerConsoleConfigBrowser.js.
Where is unbadgeConsole() defined?
unbadgeConsole() is defined in packages/react-server/src/ReactServerConsoleConfigBrowser.js at line 27.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free