Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions jsdoc_parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,11 @@ def parse_jsdoc(docstring: str) -> Dict[str, Any]:
def _process_tag(tag: str, content: List[str], result: Dict[str, Any]) -> None:
"""Process a JSDoc tag and update the result dictionary.

The function processes different types of JSDoc tags such as `param`,
`returns`, `throws`, `example`, and others, updating the provided result
dictionary accordingly.
This function processes different types of JSDoc tags such as `param`,
`returns`, `throws`, `example`, and others. It updates the provided result
dictionary accordingly. The function handles nested parameters with dots,
optional parameters with default values, and stores other tags in a structured
format within the result dictionary.

Args:
tag (str): The tag name (without the @ symbol).
Expand Down
13 changes: 9 additions & 4 deletions jsdoc_parser/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ def extract_type_info(type_str: str) -> Dict[str, Any]:

This function parses the input type string to determine if it represents a
union of types, a generic/template type with parameters, or a simple type. It
returns a dictionary containing the parsed type information.
returns a dictionary containing the parsed type information. The function
handles union types by splitting the string on the pipe ('|') character and
processes generics/templates by matching the pattern 'name<params>' while
accounting for nested generics using bracket counting.

Args:
type_str (str): The type string from a JSDoc tag.
Expand Down Expand Up @@ -133,9 +136,11 @@ def remove_jsdoc_component(jsdoc_obj: Dict[str, Any], component_type: str, ident
"""Remove a specified component from a JSDoc object.

This function modifies the provided JSDoc object by removing a component based
on the given type and identifier. If no identifier is provided, it removes all
instances of the component type. The function handles various component types
such as 'description', 'param', 'returns', 'throws', 'example', and 'tag'.
on the given type and identifier. If no identifier is provided, it removes all
instances of the component type. The function handles various component types
such as 'description', 'param', 'returns', 'throws', 'example', and 'tag'. It
processes each component type accordingly, ensuring that the JSDoc object
remains consistent after modification.

Args:
jsdoc_obj (Dict[str, Any]): The JSDoc object to be modified.
Expand Down