Urara-Blog/node_modules/.pnpm-store/v3/files/39/a4d2e14c604f7f0c30ad4976ee9f08db39b2f3e0bfaad966b0e8fe023aadb8708fa7e9ce0aad55871b34eb9661dacb5ae5939ca5495951c202118d2136b1fc
2022-08-14 01:14:53 +08:00

25 lines
579 B
Text

const SemVer = require('../classes/semver')
const Range = require('../classes/range')
const maxSatisfying = (versions, range, options) => {
let max = null
let maxSV = null
let rangeObj = null
try {
rangeObj = new Range(range, options)
} catch (er) {
return null
}
versions.forEach((v) => {
if (rangeObj.test(v)) {
// satisfies(v, range, options)
if (!max || maxSV.compare(v) === -1) {
// compare(max, v, true)
max = v
maxSV = new SemVer(max, options)
}
}
})
return max
}
module.exports = maxSatisfying