Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

12345678910111213141516171819202122232425
  1. const SemVer = require('../classes/semver')
  2. const Range = require('../classes/range')
  3. const maxSatisfying = (versions, range, options) => {
  4. let max = null
  5. let maxSV = null
  6. let rangeObj = null
  7. try {
  8. rangeObj = new Range(range, options)
  9. } catch (er) {
  10. return null
  11. }
  12. versions.forEach((v) => {
  13. if (rangeObj.test(v)) {
  14. // satisfies(v, range, options)
  15. if (!max || maxSV.compare(v) === -1) {
  16. // compare(max, v, true)
  17. max = v
  18. maxSV = new SemVer(max, options)
  19. }
  20. }
  21. })
  22. return max
  23. }
  24. module.exports = maxSatisfying