Function hasSomeAncestor

  • Returns whether any of the ancestors of the given node fulfills the given condition.

    If the given condition is an AST node instead of a function, hasSomeAncestor will behave as if the condition function was d => d === conditionNode.

    The ancestors will be iterated in the order from closest to farthest. The condition function will not be called on the given node.

    Type Parameters

    • T extends Node

    Parameters

    • node: T
    • condition: Node | ((ancestor) => boolean)

    Returns boolean