test-version

    1.0.3 • Public • Published

    test-version

    NPM version build status

    Test if a given version matches a version pattern

    Install

    $ npm install test-version
    

    Usage

    const test = require('test-version');
    
    if (test('v1.0.0', '>=1.0.0')) {
        console.log('matched!');
    }
    else {
        console.log('not matched');
    }
    

    Patterns

    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
    

    Keywords

    Install

    npm i test-version

    DownloadsWeekly Downloads

    10

    Version

    1.0.3

    License

    MIT

    Last publish

    Collaborators

    • viringbells