MCPcopy Index your code
hub / github.com/github/docs / versionSatisfiesRange

Function versionSatisfiesRange

lib/version-satisfies-range.js:5–19  ·  view source on GitHub ↗
(release, range)

Source from the content-addressed store, hash-verified

3// Where "release" is a release number, like `3.1` for Enterprise Server,
4// and "range" is a semver range operator with another number, like `<=3.2`.
5export default function versionSatisfiesRange(release, range) {
6 // workaround for Enterprise Server 11.10.340 because we can't use semver to
7 // compare it to 2.x like we can with 2.0+
8 if (release === '11.10.340') return range.startsWith('<')
9
10 // If the release is '*', we want it to evaluate to false against the range 'next'
11 // but to true against itself ('*'). Unfortunately by default it will evaluate to
12 // true against 'next'. So we have to do a hack here and replace it with a
13 // dummy value of '1.0', which will get the results we want.
14 if (release === '*') {
15 release = '1.0'
16 }
17
18 return semver.satisfies(semver.coerce(release), range)
19}

Callers 7

helmetMiddlewareFunction · 0.85
getProxyPathFunction · 0.85
evaluateVersionsFunction · 0.85
handleOperatorsFunction · 0.85
redirects.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected