@stdlib/assert-is-semver
v0.2.2
Published
Test if a value is a semantic version string.
Downloads
4,194
Readme
isSemVer
Test if a value is a semantic version string.
Installation
npm install @stdlib/assert-is-semver
Usage
var isSemVer = require( '@stdlib/assert-is-semver' );
isSemVer( value )
Tests if a value
is a semantic version string.
var bool = isSemVer( '0.0.2' );
// returns true
bool = isSemVer( 'foo' );
// returns false
Examples
var isSemVer = require( '@stdlib/assert-is-semver' );
var bool = isSemVer( '1.0.0' );
// returns true
bool = isSemVer( '1.0.0-alpha.1' );
// returns true
bool = isSemVer( '0.1' );
// returns false
bool = isSemVer( null );
// returns false
See Also
@stdlib/assert-is-semver-cli
: CLI package for use as a command-line utility.
Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2024. The Stdlib Authors.