📄 isStartOfExpressionStatement.ts
¶
📊 Analysis Summary¶
Metric | Count |
---|---|
🔧 Functions | 1 |
📦 Imports | 2 |
📊 Variables & Constants | 2 |
📚 Table of Contents¶
🛠️ File Location:¶
📂 packages/eslint-plugin/src/util/isStartOfExpressionStatement.ts
📦 Imports¶
Name | Source |
---|---|
TSESTree |
@typescript-eslint/utils |
AST_NODE_TYPES |
@typescript-eslint/utils |
Variables & Constants¶
Name | Type | Kind | Value | Exported |
---|---|---|---|---|
start |
any |
const | node.range[0] |
✗ |
ancestor |
TSESTree.Node | undefined |
let/var | node |
✗ |
Functions¶
isStartOfExpressionStatement(node: TSESTree.Node): boolean
¶
Code
export function isStartOfExpressionStatement(node: TSESTree.Node): boolean {
const start = node.range[0];
let ancestor: TSESTree.Node | undefined = node;
while ((ancestor = ancestor.parent) && ancestor.range[0] === start) {
if (ancestor.type === AST_NODE_TYPES.ExpressionStatement) {
return true;
}
}
return false;
}
-
JSDoc:
-
Parameters:
node: TSESTree.Node
- Return Type:
boolean