Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/pastelsky/semver-closest
- Owner: pastelsky
- License: mit
- Created: 2017-10-29T05:53:23.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T10:15:05.000Z (about 2 years ago)
- Last Synced: 2024-11-11T22:10:28.181Z (about 2 months ago)
- Topics: comparison, semver
- Language: JavaScript
- Size: 310 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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'
```