Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
577 bytes
|
Line | |
---|
1 | const SemVer = require('../classes/semver')
|
---|
2 | const Range = require('../classes/range')
|
---|
3 | const minSatisfying = (versions, range, options) => {
|
---|
4 | let min = null
|
---|
5 | let minSV = 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 (!min || minSV.compare(v) === 1) {
|
---|
16 | // compare(min, v, true)
|
---|
17 | min = v
|
---|
18 | minSV = new SemVer(min, options)
|
---|
19 | }
|
---|
20 | }
|
---|
21 | })
|
---|
22 | return min
|
---|
23 | }
|
---|
24 | module.exports = minSatisfying
|
---|
Note:
See
TracBrowser
for help on using the repository browser.