Skip to content

Commit 346e2c6

Browse files
committed
Add documentation comments for PurlError and PackageURL classes
Adds JSDoc comments to improve code documentation: - PurlError class: Documents custom error class for PURL failures - PackageURL class: Documents main PURL parser and constructor These additions ensure all major classes have descriptive comments explaining their purpose and functionality.
1 parent f7c954f commit 346e2c6

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/error.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ function formatPurlErrorMessage(message = ''): string {
2828
return `Invalid purl: ${formatted}`
2929
}
3030

31+
/**
32+
* Custom error class for Package URL parsing and validation failures.
33+
*/
3134
class PurlError extends Error {
3235
constructor(message?: string | undefined, options?: ErrorOptions) {
3336
super(formatPurlErrorMessage(message), options)

src/package-url.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ const OTHER_SCHEME_PATTERN = /^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//
5454
// Pattern to match purl-like strings with type/name format.
5555
const PURL_LIKE_PATTERN = /^[a-zA-Z0-9+.-]+\//
5656

57+
/**
58+
* Package URL parser and constructor implementing the PURL specification.
59+
* Provides methods to parse, construct, and manipulate Package URLs with validation and normalization.
60+
*/
5761
class PackageURL {
5862
static Component = recursiveFreeze(PurlComponent)
5963
static KnownQualifierNames = recursiveFreeze(PurlQualifierNames)

0 commit comments

Comments
 (0)