semver-sort
Sort array of semver string even which is exist in a strings.
Install
$ npm install --save semver-sort
Usage
var version = [
'v0.0.2',
'v0.1.1',
'2.0.1',
'1.2.2',
'1.1.1',
'v0.0.9'
];
var semverSort = require('semver-sort');
semverSort.asc(version);
semverSort.desc(version);
var tags = [
{ref: 'refs/tags/v1.0.2'},
{ref: 'refs/tags/v0.1.1'},
{ref: 'refs/tags/v0.1.0'},
{ref: 'refs/tags/v1.1.0'},
{ref: 'refs/tags/v1.0.3'},
{ref: 'refs/tags/v1.0.1'},
{ref: 'refs/tags/v1.0.0'}
];
semverSort.asc(tags.map(function (tag) {
return tag.ref;
}));
License
MIT © Jimmy Moon