|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
593 bytes
|
| Line | |
|---|
| 1 | 'use strict'
|
|---|
| 2 |
|
|---|
| 3 | const SemVer = require('../classes/semver')
|
|---|
| 4 | const Range = require('../classes/range')
|
|---|
| 5 |
|
|---|
| 6 | const maxSatisfying = (versions, range, options) => {
|
|---|
| 7 | let max = null
|
|---|
| 8 | let maxSV = null
|
|---|
| 9 | let rangeObj = null
|
|---|
| 10 | try {
|
|---|
| 11 | rangeObj = new Range(range, options)
|
|---|
| 12 | } catch (er) {
|
|---|
| 13 | return null
|
|---|
| 14 | }
|
|---|
| 15 | versions.forEach((v) => {
|
|---|
| 16 | if (rangeObj.test(v)) {
|
|---|
| 17 | // satisfies(v, range, options)
|
|---|
| 18 | if (!max || maxSV.compare(v) === -1) {
|
|---|
| 19 | // compare(max, v, true)
|
|---|
| 20 | max = v
|
|---|
| 21 | maxSV = new SemVer(max, options)
|
|---|
| 22 | }
|
|---|
| 23 | }
|
|---|
| 24 | })
|
|---|
| 25 | return max
|
|---|
| 26 | }
|
|---|
| 27 | module.exports = maxSatisfying
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.