@@ -38,9 +38,30 @@ export function parseVersion(version) {
3838/**
3939 * Validates that a value is a valid ParsedVersion object.
4040 *
41- * @param {unknown } value - The value to validate
42- * @param {string } paramName - The parameter name for error messages
43- * @throws {TypeError } If value is not a valid ParsedVersion object
41+ * This internal helper ensures that values passed to version comparison functions
42+ * conform to the expected ParsedVersion structure with numeric major, minor, and
43+ * patch properties. It provides descriptive error messages when validation fails.
44+ *
45+ * @param {unknown } value - The value to validate as a ParsedVersion object
46+ * @param {string } paramName - The parameter name used in error messages for context
47+ * @returns {void } Returns nothing if validation passes
48+ * @throws {TypeError } If value is null or undefined
49+ * @throws {TypeError } If value is not an object
50+ * @throws {TypeError } If value lacks numeric major, minor, or patch properties
51+ *
52+ * @example
53+ * // Valid ParsedVersion - passes silently
54+ * validateParsedVersion({ major: 1, minor: 2, patch: 3 }, "version")
55+ *
56+ * @example
57+ * // Null value - throws TypeError
58+ * validateParsedVersion(null, "a")
59+ * // Throws: "compareVersions: a must be a ParsedVersion object, got null"
60+ *
61+ * @example
62+ * // Missing properties - throws TypeError
63+ * validateParsedVersion({ major: 1 }, "b")
64+ * // Throws: "compareVersions: b must have numeric major, minor, and patch properties"
4465 */
4566function validateParsedVersion ( value , paramName ) {
4667 if ( value === null || value === undefined ) {
0 commit comments