Permalink
Cannot retrieve contributors at this time
25 lines (24 sloc)
579 Bytes
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/semver/ranges/max-satisfying.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |