|
5 | 5 | * supporting common range patterns like ^, ~, >=, >, <=, <, and exact matching. |
6 | 6 | */ |
7 | 7 |
|
| 8 | +/** |
| 9 | + * A parsed semantic version with numeric components. |
| 10 | + * @typedef {Object} ParsedVersion |
| 11 | + * @property {number} major - The major version number (breaking changes) |
| 12 | + * @property {number} minor - The minor version number (new features, backwards compatible) |
| 13 | + * @property {number} patch - The patch version number (bug fixes, backwards compatible) |
| 14 | + */ |
| 15 | + |
8 | 16 | /** |
9 | 17 | * Parses a semver version string into its numeric components. |
10 | 18 | * |
11 | 19 | * @param {string} version - The version string (e.g., "1.2.3") |
12 | | - * @returns {{ major: number, minor: number, patch: number } | null} Parsed version or null if invalid |
| 20 | + * @returns {ParsedVersion | null} Parsed version or null if invalid |
13 | 21 | * @throws {TypeError} If version is not a string |
14 | 22 | */ |
15 | 23 | export function parseVersion(version) { |
@@ -56,8 +64,8 @@ function validateParsedVersion(value, paramName) { |
56 | 64 | /** |
57 | 65 | * Compares two parsed version objects. |
58 | 66 | * |
59 | | - * @param {{ major: number, minor: number, patch: number }} a - First version |
60 | | - * @param {{ major: number, minor: number, patch: number }} b - Second version |
| 67 | + * @param {ParsedVersion} a - First version |
| 68 | + * @param {ParsedVersion} b - Second version |
61 | 69 | * @returns {number} -1 if a < b, 0 if a == b, 1 if a > b |
62 | 70 | * @throws {TypeError} If a or b is not a valid ParsedVersion object |
63 | 71 | */ |
|
0 commit comments