eslint-plugin-de-morgan
Version:
ESLint plugin for transforming negated boolean expressions via De Morgan’s laws
23 lines (22 loc) • 882 B
TypeScript
import { Node } from 'estree'
type ParentedNode = {
parent?: ParentedNode
} & Node
/**
* Traverses up the parent chain of the given node (if available) to find the
* outermost logical expression node that is explicitly wrapped in parentheses.
* The function checks the node and its parents (while they are
* LogicalExpression) and returns the first node that is wrapped in parentheses
* (i.e. Where the characters immediately before its range and at its end form a
* matching pair of parentheses). If none is found, the function returns the
* topmost LogicalExpression..
*
* @param node - The starting expression node.
* @param sourceCode - The full source code text.
* @returns The outermost parenthesized node found in the parent chain.
*/
export declare function findOutermostParenthesizedNode(
node: ParentedNode,
sourceCode: string,
): ParentedNode
export {}