MCPcopy
hub / github.com/react/react / normalizeCodeLocInfo

Function normalizeCodeLocInfo

packages/react-devtools-shared/src/__tests__/utils.js:478–495  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

476}
477
478export function normalizeCodeLocInfo(str) {
479 if (typeof str === 'object' && str !== null) {
480 str = str.stack;
481 }
482 if (typeof str !== 'string') {
483 return str;
484 }
485 // This special case exists only for the special source location in
486 // ReactElementValidator. That will go away if we remove source locations.
487 str = str.replace(/Check your code at .+?:\d+/g, 'Check your code at **');
488 // V8 format:
489 // at Component (/path/filename.js:123:45)
490 // React format:
491 // in Component (at filename.js:123)
492 return str.replace(/\n +(?:at|in) ([\S]+)[^\n]*/g, function (m, name) {
493 return '\n in ' + name + ' (at **)';
494 });
495}

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected