MCPcopy Index your code
hub / github.com/react/react / describeBuiltInComponentFrame

Function describeBuiltInComponentFrame

packages/shared/ReactComponentStackFrame.js:20–41  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

18let prefix;
19let suffix;
20export function describeBuiltInComponentFrame(name: string): string {
21 if (prefix === undefined) {
22 // Extract the VM specific prefix used by each line.
23 try {
24 throw Error();
25 } catch (x) {
26 const match = x.stack.trim().match(/\n( *(at )?)/);
27 prefix = (match && match[1]) || '';
28 suffix =
29 x.stack.indexOf('\n at') > -1
30 ? // V8
31 ' (<anonymous>)'
32 : // JSC/Spidermonkey
33 x.stack.indexOf('@') > -1
34 ? '@unknown:0:0'
35 : // Other
36 '';
37 }
38 }
39 // We use the prefix to ensure our stacks line up with native stack frames.
40 return '\n' + prefix + name + suffix;
41}
42
43export function describeDebugInfoFrame(
44 name: string,

Calls

no outgoing calls

Tested by

no test coverage detected