Function getPattern

  • Returns the pattern node of the JS RegExp of a given node.

    This operation is guaranteed to always success for all node types except for flags nodes. Flags nodes have an optional parent which, if not set, means that this function can't access the pattern node. If the function can't access the pattern node from a flags node, an error will be thrown.

    Parameters

    • node: Node

    Returns Pattern