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

Function hasSingleReturnStatement

transforms/class.js:149–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147 );
148
149 const hasSingleReturnStatement = value => (
150 (
151 value.type === 'ArrowFunctionExpression' &&
152 value.body &&
153 value.body.type === 'ObjectExpression'
154 ) || (
155 (
156 value.type === 'FunctionExpression' || value.type === 'ArrowFunctionExpression'
157 ) &&
158 value.body &&
159 value.body.type === 'BlockStatement' &&
160 value.body.body &&
161 value.body.body.length === 1 &&
162 value.body.body[0].type === 'ReturnStatement' &&
163 value.body.body[0].argument
164 )
165 );
166
167 const isInitialStateLiftable = getInitialState => {
168 if (!getInitialState || !(getInitialState.value)) {

Callers 2

isInitialStateLiftableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected