Skip to content

Commit

Permalink
BREAKING(semver): remove canParse() non-string overload (#4108)
Browse files Browse the repository at this point in the history
  • Loading branch information
iuioiua committed Jan 5, 2024
1 parent 122e362 commit 98766d1
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions semver/can_parse.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { SemVer } from "./types.ts";
import { parse } from "./parse.ts";

/**
* @deprecated (will be removed in 0.212.0) Use a string argument instead.
*/
export function canParse(version: SemVer): boolean;
export function canParse(version: string): boolean;
export function canParse(version: string | SemVer) {
export function canParse(version: string): boolean {
try {
parse(version as SemVer);
parse(version);
return true;
} catch (err) {
if (!(err instanceof TypeError)) {
Expand Down

0 comments on commit 98766d1

Please sign in to comment.