MCPcopy Index your code
hub / github.com/reactjs/react-codemod / pickReturnValueOrCreateIIFE

Function pickReturnValueOrCreateIIFE

transforms/class.js:365–378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

363 // ---------------------------------------------------------------------------
364 // Collectors
365 const pickReturnValueOrCreateIIFE = value => {
366 if (hasSingleReturnStatement(value)) {
367 if (value.body.type === 'ObjectExpression') {
368 return value.body;
369 } else {
370 return value.body.body[0].argument;
371 }
372 } else {
373 return j.callExpression(
374 value,
375 []
376 );
377 }
378 };
379
380 const createDefaultProps = prop =>
381 withComments(

Callers 2

createDefaultPropsFunction · 0.85

Calls 1

hasSingleReturnStatementFunction · 0.85

Tested by

no test coverage detected