Skip to content

Commit 2bd6fb2

Browse files
committed
adds top-level jsdoc example
1 parent 4318ce9 commit 2bd6fb2

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"exports": "./mod.ts",
33
"license": "MIT",
44
"name": "@chronver/chronver",
5-
"version": "1.0.2"
5+
"version": "1.0.3"
66
}

mod.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,58 @@
33

44
//// export
55

6+
/**
7+
* The Chronologic Version parser.
8+
*
9+
* ```ts
10+
* import { ChronVer } from "jsr:@chronver/chronver";
11+
*
12+
* // create new version
13+
* const version = new ChronVer("2024.04.03.1");
14+
*
15+
* // convert to string
16+
* console.log(version.toString()); // "2024.04.03.1"
17+
*
18+
* // access version components
19+
* console.log(version.year); // 2024
20+
* console.log(version.month); // 4
21+
* console.log(version.day); // 3
22+
* console.log(version.changeset); // 1
23+
* ```
24+
*
25+
* ### Validation
26+
*
27+
* ```ts
28+
* console.log(ChronVer.isValid("2024.04.03")); // true
29+
* console.log(ChronVer.isValid("invalid")); // false
30+
* console.log(ChronVer.isValid("2024.13.19")); // false (invalid month)
31+
* ```
32+
*
33+
* ### Comparison
34+
*
35+
* ```ts
36+
* const v1 = "2024.04.03.1";
37+
* const v2 = "2024.04.03.2";
38+
*
39+
* console.log(ChronVer.compare(v1, v2)); // -1 (v1 is older than v2)
40+
* console.log(ChronVer.compare(v2, v1)); // 1 (v2 is newer than v1)
41+
* console.log(ChronVer.compare(v1, v1)); // 0 (versions are equal)
42+
* ```
43+
*
44+
* ### Feature Branches and Breaking Changes
45+
*
46+
* ```ts
47+
* // feature branch
48+
* const feature = new ChronVer("2024.04.03-feature");
49+
* console.log(feature.feature); // "feature"
50+
* console.log(feature.toString()); // "2024.04.03-feature"
51+
*
52+
* // breaking change
53+
* const breaking = new ChronVer("2024.04.03.1-break");
54+
* console.log(breaking.isBreaking); // true
55+
* console.log(breaking.toString()); // "2024.04.03.1-break"
56+
* ```
57+
*/
658
export class ChronVer {
759
/** changeset number (0 if not specified) */
860
readonly changeset: number;

0 commit comments

Comments
 (0)