diff --git a/jsdoc_parser/parser.py b/jsdoc_parser/parser.py index cee780d..90b728c 100644 --- a/jsdoc_parser/parser.py +++ b/jsdoc_parser/parser.py @@ -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). diff --git a/jsdoc_parser/utils.py b/jsdoc_parser/utils.py index 3674b5b..f47743f 100644 --- a/jsdoc_parser/utils.py +++ b/jsdoc_parser/utils.py @@ -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' while + accounting for nested generics using bracket counting. Args: type_str (str): The type string from a JSDoc tag. @@ -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.