Mixin: traversalMethods

traversalMethods

Methods

(static) childElements() → {JSXElementCollection}

Returns all children that are JSXElements.
Source:
Returns:
Type
JSXElementCollection

(static) childNodes() → {Collection}

Returns all child nodes, including literals and expressions.
Source:
Returns:
Type
Collection

(static) closest() → {Collection}

Traverse the AST up and finds the closest node of the provided type.
Parameters:
Type Description
Collection
filter
Source:
Returns:
Type
Collection

(static) closestScope() → {Collection}

Returns a collection containing the paths that create the scope of the currently selected paths. Dedupes the paths.
Source:
Returns:
Type
Collection

(static) find() → {Collection}

Find nodes of a specific type within the nodes of this collection.
Parameters:
Type Description
type
filter
Source:
Returns:
Type
Collection

(static) getVariableDeclarators(nameGetter) → {Collection}

Finds the declaration for each selected path. Useful for member expressions or JSXElements. Expects a callback function that maps each path to the name to look for. If the callback returns a falsey value, the element is skipped.
Parameters:
Name Type Description
nameGetter function
Source:
Returns:
Type
Collection

traversalMethods

Methods

(static) childElements() → {JSXElementCollection}

Returns all children that are JSXElements.
Source:
Returns:
Type
JSXElementCollection

(static) childNodes() → {Collection}

Returns all child nodes, including literals and expressions.
Source:
Returns:
Type
Collection

(static) closest() → {Collection}

Traverse the AST up and finds the closest node of the provided type.
Parameters:
Type Description
Collection
filter
Source:
Returns:
Type
Collection

(static) closestScope() → {Collection}

Returns a collection containing the paths that create the scope of the currently selected paths. Dedupes the paths.
Source:
Returns:
Type
Collection

(static) find() → {Collection}

Find nodes of a specific type within the nodes of this collection.
Parameters:
Type Description
type
filter
Source:
Returns:
Type
Collection

(static) getVariableDeclarators(nameGetter) → {Collection}

Finds the declaration for each selected path. Useful for member expressions or JSXElements. Expects a callback function that maps each path to the name to look for. If the callback returns a falsey value, the element is skipped.
Parameters:
Name Type Description
nameGetter function
Source:
Returns:
Type
Collection