MCPcopy Index your code
hub / github.com/nodejs/node / getExpression

Function getExpression

test/fixtures/snapshot/typescript.js:159707–159717  ·  view source on GitHub ↗

* Gets an expression of valid extraction type from a valid statement or expression.

(node)

Source from the content-addressed store, hash-verified

159705 * Gets an expression of valid extraction type from a valid statement or expression.
159706 */
159707 function getExpression(node) {
159708 if (isValidExpression(node)) {
159709 return node;
159710 }
159711 if (ts.isVariableStatement(node)) {
159712 var variable = ts.getSingleVariableOfVariableStatement(node);
159713 var initializer = variable === null || variable === void 0 ? void 0 : variable.initializer;
159714 return initializer && isValidExpression(initializer) ? initializer : undefined;
159715 }
159716 return node.expression && isValidExpression(node.expression) ? node.expression : undefined;
159717 }
159718 /**
159719 * Gets a property access expression which may be nested inside of a binary expression. The final
159720 * expression in an && chain will occur as the right child of the parent binary expression, unless

Callers 1

getInfoFunction · 0.85

Calls 1

isValidExpressionFunction · 0.85

Tested by

no test coverage detected