Test if a given version matches a version pattern
$ npm install test-version
const test = require('test-version');
if (test('v1.0.0', '>=1.0.0')) {
console.log('matched!');
}
else {
console.log('not matched');
}
version can be like:
1.0.0 => 1.0.0
1-0-0 => 1.0.0
v1.0 => 1.0
version pattern can be like:
1.0.0
1.0.x
1.0.*
!1.0.0
~1.0.0
^1.0.0
>1.0.0
<1.0.0
1.0.0...1.9.9
1.0.0~1.9.9