Sort an array of versions.
This module sort an array of versions. Here some exemples of valid versions:
1.1.0
1.1.4
1.1.4.469816
2.4
2.4.2
2.4.20
2.4.20alpha
2.4.20beta
2.4.20rc1
2.4.20rc2
To use it just call the module as a function.
var sort = require('version-sort');
data = [ '2.4.20', '2.4.20rc1', '1.1', '2.4.20beta1' ];
sort(data); // '1.1', '2.4.20beta1', '2.4.20rc1', '2.4.20'
var results = sort(data, options);
ignore_stages
: (default:false
) Only return stables versions and ignore staged versions.[ '1.1', '1.1alpha' ]
will return[ '1.1' ]
.
npm install --save version-sort