BREAKING(semver): do not accept undefined input in tryParse (#5584)

This commit is contained in:
Yoshiya Hinosawa 2024-07-31 12:59:44 +09:00 committed by GitHub
parent b315e049b6
commit 8baede0eb5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,10 +21,7 @@ import { parse } from "./parse.ts";
* @param version The version string to parse
* @returns A valid SemVer or `undefined`
*/
export function tryParse(version?: string): SemVer | undefined {
if (version === undefined) {
return undefined;
}
export function tryParse(version: string): SemVer | undefined {
try {
return parse(version);
} catch {