semver-closest
v0.1.2
Published
Find the closest matching semver from an array of semver versions
Downloads
39,086
Readme
Find the closest semver formatted version (<major>.<minor>.<patch>
) from a list of semver formatted versions
Examples
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'