@tropicalraisel/semver-regexp
v1.1.5
Published
Semantic Version 2.0.0 library powered by Regex.
Downloads
4
Maintainers
Readme
Description
This package aims to fix issues with semver and semver-regex. Primarily, neither pass all tests provided on the semver website. Another small issue is that they allow invalid semantic version strings.
Usage
There are two functions, one default function that permits semantic version strings starting with ~
, ^
, or v
, and another which strictly matches a semantic version.
ESM
import valid, { isValidSemanticVersion } from '@tropicalraisel/semver-regexp'
const version = 'v4.2.0'
console.log(valid(version))
console.log(isValidSemanticVersion(version))
CommonJS
const semver = require('@tropicalraisel/semver-regexp')
const version = 'v4.2.0'
console.log(semver.default(version))
console.log(semver.isValidSemanticVersion(version))