keep-a-changelog
Version:
Node package to parse and generate changelogs following the [keepachangelog](https://keepachangelog.com/) format.
31 lines (30 loc) • 784 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.canParse = canParse;
// Copyright 2018-2025 the Deno authors. MIT license.
// This module is browser compatible.
const parse_js_1 = require("./parse.js");
/**
* Returns true if the string can be parsed as SemVer.
*
* @example Usage
* ```ts
* import { canParse } from "@std/semver/can-parse";
* import { assert, assertFalse } from "@std/assert";
*
* assert(canParse("1.2.3"));
* assertFalse(canParse("invalid"));
* ```
*
* @param value The version string to check
* @returns `true` if the string can be parsed as SemVer, `false` otherwise
*/
function canParse(value) {
try {
(0, parse_js_1.parse)(value);
return true;
}
catch {
return false;
}
}