Skip to content

Compare version numbers in any format (not necessarily semver)

License

Notifications You must be signed in to change notification settings

MartinKolarik/v-compare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

v-compare

Compare version numbers in any format (not necessarily semver)

Installation

$ npm install v-compare

or

<script src="https://cdn.jsdelivr.net/npm/v-compare@1.0.0"></script>

Usage

const vCompare = require('v-compare'); // or window.vCompare
const versions = [ '2.2', '3', '2.0-alpha', '2.0', '2.1.0', '1', '3.1' ];

versions.sort(vCompare); // => [ '1', '2.0-alpha', '2.0', '2.1.0', '2.2', '3', '3.1' ]
versions.sort(vCompare.rCompare); // => [ '3.1', '3', '2.2', '2.1.0', '2.0', '2.0-alpha', '1' ]

License

Copyright (c) 2017 Martin Kolárik. Released under the MIT license.

About

Compare version numbers in any format (not necessarily semver)

Resources

License

Stars

Watchers

Forks

Packages

No packages published