Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pastelsky/semver-closest

Find the closest matching semver from an array of semver versions
https://github.com/pastelsky/semver-closest

comparison semver

Last synced: about 2 hours ago
JSON representation

Find the closest matching semver from an array of semver versions

Awesome Lists containing this project

README

        

[![Travis](https://img.shields.io/travis/pastelsky/semver-closest.svg)]()
[![npm](https://img.shields.io/npm/v/semver-closest.svg)]()

Find the closest semver formatted version (`..`) from a list of semver formatted versions

## Examples
```js
const closestSemver = require('semver-closest')

closestSemver('1.2.0', ['1.1.9', '1.2.0', '1.2.1'])
// returns '1.2.0'

closestSemver('1.2.0', ['1.1.9', '1.3.1', '1.2.1'])
// returns '1.1.9'

closestSemver('2.2.0', ['4.1.9', '10.3.1', '3.2.1'])
// returns '3.2.1'
```