deno.land / std@0.224.0 / semver / try_parse.ts

try_parse.ts
View Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.// This module is browser compatible.import type { SemVer } from "./types.ts";import { parse } from "./parse.ts";
/** * Returns the parsed version, or undefined if it's not valid. * @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; } try { return parse(version); } catch { return undefined; }}
std

Version Info

Tagged at
6 months ago