CoolFace
Apppublic

strong-tie/inbound-calls

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
max-satisfying.js26 linesDownload Raw Back to ranges
1const SemVer = require('../classes/semver')2const Range = require('../classes/range')3 4const maxSatisfying = (versions, range, options) => {5  let max = null6  let maxSV = null7  let rangeObj = null8  try {9    rangeObj = new Range(range, options)10  } catch (er) {11    return null12  }13  versions.forEach((v) => {14    if (rangeObj.test(v)) {15      // satisfies(v, range, options)16      if (!max || maxSV.compare(v) === -1) {17        // compare(max, v, true)18        max = v19        maxSV = new SemVer(max, options)20      }21    }22  })23  return max24}25module.exports = maxSatisfying26