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

Function getValidParentNodeContainingSpan

test/fixtures/snapshot/typescript.js:159683–159691  ·  view source on GitHub ↗

* Find the least ancestor of the input node that is a valid type for extraction and contains the input span.

(node, span)

Source from the content-addressed store, hash-verified

159681 * Find the least ancestor of the input node that is a valid type for extraction and contains the input span.
159682 */
159683 function getValidParentNodeContainingSpan(node, span) {
159684 while (node.parent) {
159685 if (isValidExpressionOrStatement(node) && span.length !== 0 && node.end >= span.start + span.length) {
159686 return node;
159687 }
159688 node = node.parent;
159689 }
159690 return undefined;
159691 }
159692 /**
159693 * Finds an ancestor of the input node that is a valid type for extraction, skipping subexpressions.
159694 */

Callers 1

getInfoFunction · 0.85

Calls 1

Tested by

no test coverage detected