MCPcopy Create free account
hub / github.com/microsoft/SandDance / describeComponentFrame

Function describeComponentFrame

docs/external/js/react-dom.development.js:1374–1404  ·  view source on GitHub ↗
(name, source, ownerName)

Source from the content-addressed store, hash-verified

1372
1373 var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
1374 function describeComponentFrame (name, source, ownerName) {
1375 var sourceInfo = '';
1376
1377 if (source) {
1378 var path = source.fileName;
1379 var fileName = path.replace(BEFORE_SLASH_RE, '');
1380
1381 {
1382 // In DEV, include code for a common special case:
1383 // prefer "folder/index.js" instead of just "index.js".
1384 if (/^index\./.test(fileName)) {
1385 var match = path.match(BEFORE_SLASH_RE);
1386
1387 if (match) {
1388 var pathBeforeSlash = match[1];
1389
1390 if (pathBeforeSlash) {
1391 var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
1392 fileName = folderName + '/' + fileName;
1393 }
1394 }
1395 }
1396 }
1397
1398 sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
1399 } else if (ownerName) {
1400 sourceInfo = ' (created by ' + ownerName + ')';
1401 }
1402
1403 return '\n in ' + (name || 'Unknown') + sourceInfo;
1404 }
1405
1406 // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
1407 // nor polyfill, then a plain number is used for performance.

Callers 1

describeFiberFunction · 0.70

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected