Skip to main content

JSDoc Parser

Tests Python Package codecov PyPI version Python Versions License: MIT

A Python library for parsing and composing JSDoc strings.

Installation

pip install jsdoc-parser

Usage

from jsdoc_parser import parse_jsdoc, compose_jsdoc

# Parse a JSDoc string into an object
jsdoc_str = """/**
 * Calculates the sum of two numbers
 * @param {number} a - First number
 * @param {number} b - Second number
 * @returns {number} The sum of a and b
 */"""

parsed = parse_jsdoc(jsdoc_str)
print(parsed)
# Output: {'description': 'Calculates the sum of two numbers', 'params': [{'name': 'a', 'type': 'number', 'description': 'First number'}, {'name': 'b', 'type': 'number', 'description': 'Second number'}], 'returns': {'type': 'number', 'description': 'The sum of a and b'}}

# Modify the parsed object
parsed['params'][0]['description'] = 'Modified description'

# Compose the modified object back to a JSDoc string
new_jsdoc = compose_jsdoc(parsed)
print(new_jsdoc)

Features

  • Parse JSDoc strings into structured Python objects
  • Compose JSDoc objects back into properly formatted JSDoc strings
  • Support for various JSDoc tags: @param, @returns, @throws, etc.
  • Easy manipulation of JSDoc components

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Release files for jsdoc-parser 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jsdoc-parser 0.1.1
File Size Uploaded
jsdoc_parser-0.1.1.tar.gz 12.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jsdoc-parser 0.1.1
File Interpreter ABI Platform
jsdoc_parser-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 21.8 kB

Release files / jsdoc_parser-0.1.1.tar.gz

Download URL jsdoc_parser-0.1.1.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
71581ef01817bbc38989fc43b27b61a45e64730742840b24cbf19bf9c60803e7
BLAKE2b-256 checksum
How to use checksums
57d8746f341ed515850445476846aebcd8711a87d36987a6e70f216774ea3467
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / jsdoc_parser-0.1.1-py3-none-any.whl

Download URL jsdoc_parser-0.1.1-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0fff5c0d884422f2a3f5df822e82bcb64e92e86796df3ac54aab8a97648b095
BLAKE2b-256 checksum
How to use checksums
d3d11f6561db6677c9383c9c91bdce3963276e8cad080ae70f0c4e468b81576f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page