-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
89300f5
commit be0dc63
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,33 @@ export { TagUriParsingError } from "./error.ts"; | |
|
||
const internal = Symbol("internal"); | ||
|
||
/** | ||
* Data structure containing the contents of a `tag:` URI. | ||
* | ||
* Instances of this class hold the data for `tag:` URIs as defined by the | ||
* [RFC 4151](https://datatracker.ietf.org/doc/html/rfc4151) or otherwise | ||
* described by [taguri.org](https://taguri.org). | ||
* | ||
* Getting an instance of this can either be done by manually constructing one | ||
* by passing all the necessary data into the {@link constructor} or by parsing | ||
* a `tag:` URI string with {@linkcode parse}. | ||
* | ||
* By using {@linkcode get}, you can get the string representation of the tag. | ||
* Other contained values can be accessed via the various getters. | ||
* Some getters may return `null` as not every tag has to contain them | ||
* (e.g. the `day` of the `date`). | ||
* | ||
* @example Get a instance via `parse` | ||
* ```ts | ||
* const tag = TagUri.parse("tag:[email protected],2001:web/externalHome"); | ||
* | ||
* // Access different parts of the tag URI | ||
* console.log(tag.get()); // tag:[email protected],2001:web/externalHome | ||
* console.log(tag.authorityName); // [email protected] | ||
* console.log(tag.date); // 2001 | ||
* console.log(tag.specific); // web/externalHome | ||
* ``` | ||
*/ | ||
export class TagUri { | ||
private [internal]: TagUriData; | ||
|
||
|